File Coverage

blib/lib/WebService/Async/Onfido/Check.pm
Criterion Covered Total %
statement 18 21 85.7
branch n/a
condition 0 2 0.0
subroutine 7 9 77.7
pod 0 4 0.0
total 25 36 69.4


line stmt bran cond sub pod time code
1             package WebService::Async::Onfido::Check;
2              
3 2     2   11 use strict;
  2         25  
  2         67  
4 2     2   11 use warnings;
  2         3  
  2         49  
5              
6 2     2   10 use parent qw(WebService::Async::Onfido::Base::Check);
  2         2  
  2         9  
7              
8             our $VERSION = '0.005'; # VERSION
9              
10             =head1 NAME
11              
12             WebService::Async::Onfido::Check - represents data for Onfido
13              
14             =head1 DESCRIPTION
15              
16             =cut
17              
18 2     2   107 use Log::Any qw($log);
  2         4  
  2         29  
19              
20             sub as_string {
21 0     0 0 0 my ($self) = @_;
22              
23 0         0 return sprintf 'Check %s, result was %s (created %s as ID %s)', $self->status, $self->result, $self->created_at, $self->id;
24             }
25              
26 0   0 0 0 0 sub applicant { return shift->{applicant} // die 'no applicant defined' }
27              
28 2     2 0 13 sub onfido { return shift->{onfido} }
29              
30             sub reports {
31 1     1 0 2302 my ($self, %args) = @_;
32              
33             # return Ryu::Source->from($self->{reports}) if $self->{reports};
34             return $self->onfido->report_list(
35             check_id => $self->id,
36             %args
37 1     2   5 )->map(sub { $log->debugf('Have report %s', $_->as_string); $_->{check} = $self; $_ });
  2         120  
  2         16  
  2         14  
38             }
39              
40             1;
41              
42             __END__
43              
44             =head1 AUTHOR
45              
46             deriv.com C<< DERIV@cpan.org >>
47              
48             =head1 LICENSE
49              
50             Copyright deriv.com 2019. Licensed under the same terms as Perl itself.
51