File Coverage

blib/lib/WWW/GetProve/Verification.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 14 100.0


line stmt bran cond sub pod time code
1             package WWW::GetProve::Verification;
2             BEGIN {
3 1     1   307359 $WWW::GetProve::Verification::AUTHORITY = 'cpan:GETTY';
4             }
5             {
6             $WWW::GetProve::Verification::VERSION = '0.001';
7             }
8             # ABSTRACT: Verification response object
9              
10              
11 1     1   11 use Moo;
  1         2  
  1         23  
12 1     1   8132 use DateTime;
  1         208276  
  1         47  
13 1     1   1052 use DateTime::Format::ISO8601;
  1         56132  
  1         336  
14              
15             for my $attr (qw( id tel country )) {
16             has $attr => (
17             is => 'ro',
18             predicate => 1,
19             coerce => sub { "$_[0]" },
20             );
21             }
22              
23             for my $attr (qw( test verified call text )) {
24             has $attr => (
25             is => 'ro',
26             predicate => 1,
27             coerce => sub { $_[0] ? 1 : 0 },
28             );
29             }
30              
31             for my $attr (qw( created updated )) {
32             has $attr => (
33             is => 'ro',
34             predicate => 1,
35             isa => sub {
36             die $_[0]." need to be DateTime object (or an ISO8601 string that we coerce to it)" unless ref $_[0] && $_[0]->isa('DateTime')
37             },
38             coerce => sub {
39             DateTime::Format::ISO8601->parse_datetime($_[0]) unless ref $_[0] && $_[0]->isa('DateTime')
40             },
41             );
42             }
43              
44             1;
45             __END__