File Coverage

blib/lib/WebService/AbuseIPDB/Response.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 26 26 100.0


line stmt bran cond sub pod time code
1             package WebService::AbuseIPDB::Response;
2              
3             #===============================================================================
4             # FILE: Response.pm
5             # DESCRIPTION: Generic Response Object - See POD for details
6             # AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
7             # ORGANIZATION: Openstrike
8             # CREATED: 12/08/19 14:38:21
9             #===============================================================================
10              
11 6     6   3466 use strict;
  6         14  
  6         170  
12 6     6   28 use warnings;
  6         13  
  6         138  
13              
14 6     6   31 use WebService::AbuseIPDB;
  6         10  
  6         870  
15              
16             our $VERSION = $WebService::AbuseIPDB::VERSION;
17              
18             sub new {
19 9     9 1 539 my ($class, $res) = @_;
20 9 100       45 my $self =
21             ref $res
22             ? $res
23             : {
24             errors => [
25             { status => 500,
26             detail => 'Client could not connect'
27             }
28             ]
29             };
30 9         73 bless ($self, $class);
31 9         101 return $self;
32             }
33              
34             # Accessors
35              
36 8     8 1 1054 sub successful { return not exists shift->{errors} }
37 4     4 1 34 sub errors { return shift->{errors} }
38              
39             1;
40              
41             __END__