| 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
| |||||||||||
| 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
| |||||||||||
| 27 | 0 | ▶ | return wantarray ? @$err : join("\n", @$err); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||