DNSMadeEasy/Response.pm

filter: Statementstmt 83.3% 20 / 24 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 33.3% 2 / 6 totaltotal 68.1% 30 / 44 CC 4 SCAR 14.3
CC
4
Cov
70%
error
12.0
as_hashref
2.0
BEGIN
1.0
CRAP 4.2
« DNSMadeEasy/ManagedDomain.pm ↑ Summary DNSMadeEasy.pm »
1 package WWW::DNSMadeEasy::Response;
2 8 our $VERSION = '0.100';
3 8 our $AUTHORITY = 'cpan:GETTY';
4 # ABSTRACT: DNSMadeEasy Response
5  
6 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 has http_response => (
10 is => 'ro',
11 required => 1,
12 handles => ['is_success', 'content', 'decoded_content', 'status_line', 'code', 'header', 'as_string'],
13 );
14  
15 5 ▶sub data { shift->as_hashref(@_) }
Subroutine data: called CC=1 SCAR=0.0
Pod undocumented
16  
17 17 ▶sub as_hashref {
Subroutine as_hashref: called CC=2 SCAR=7.1
Pod documented
18 17 my ($self) = @_;
19 17 ▶ return unless $self->http_response->content; # DELETE return 200 but empty content
Branch: 1 branch
BranchTrueFalseTotal
unless $self->http_response->content 0 17 17
20 17 return decode_json($self->http_response->content);
21 }
22  
23 0 ▶sub error {
Subroutine error: not called CC=3 SCAR=24.8
Pod documented
24 0 my ($self) = @_;
25 0 my $err = $self->data->{error};
26 0 ▶ $err = [$err] unless ref($err) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $err eq "ARRAY" 0 0 0
27 0 ▶ return wantarray ? @$err : join("\n", @$err);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
28 }
29  
30 1 ▶sub request_id {
Subroutine request_id: called CC=1 SCAR=0.0
Pod undocumented
31 1 my ( $self ) = @_;
32 1 $self->header('x-dnsme-requestId');
33 }
34  
35 1 ▶sub request_limit {
Subroutine request_limit: called CC=1 SCAR=0.0
Pod undocumented
36 1 my ( $self ) = @_;
37 1 $self->header('x-dnsme-requestLimit');
38 }
39  
40 1 ▶sub requests_remaining {
Subroutine requests_remaining: called CC=1 SCAR=0.0
Pod undocumented
41 1 my ( $self ) = @_;
42 1 $self->header('x-dnsme-requestsRemaining');
43 }
44  
45 8 1;
46  
47 __END__
« DNSMadeEasy/ManagedDomain.pm ↑ Summary DNSMadeEasy.pm »