blib/lib/Paws/API/Caller.pm

filter: Statementstmt 40.4% 19 / 47 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 24.0% 25 / 104 CC 17 SCAR 54.2
CC
17
Cov
23%
response_to_object
306.0
BEGIN
1.0
BEGIN
1.0
CRAP 226.4
↑ Summary blib/lib/Paws/Net/RestXMLResponse.pm »
1 package Paws::API::Caller;
2 32 ▶ use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 32 ▶ use Paws;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 32 ▶ use Paws::Net::APIRequest;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 32 ▶ use Paws::API::Response;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 32 has caller => (is => 'ro', required => 1);
8  
9 32 has credentials => (
10 is => 'ro',
11 does => 'Paws::Credential',
12 required => 1,
13 handles => [ 'access_key', 'secret_key', 'session_token' ],
14 );
15  
16 # converts the params the user passed to the call into objects that represent the call
17 808 ▶ sub new_with_coercions {
Subroutine new_with_coercions: called CC=1 SCAR=0.0
Pod undocumented
18 808 my ($self, $class, %params) = @_;
19  
20 808 Paws->new_with_coercions($class, %params);
21 }
22  
23 113 ▶ sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod undocumented
24 113 my ($self, $params) = @_;
25  
26 113 return Paws->to_hash($params);
27 }
28  
29 0 ▶ sub response_to_object {
Subroutine response_to_object: not called CC=17 SCAR=57.2
Pod undocumented
30 0 my ($self, $call_object, $http_status, $content, $headers) = @_;
31  
32 0 $call_object = $call_object->meta->name;
33  
34 0 ▶ my $returns = (defined $call_object->_returns) && ($call_object->_returns ne 'Paws::API::Response');
Condition0%0/3
defined $call_object->_returns && $call_object->_returns ne 'Paws::API::Response'
!ll&&!rl&&r
000
MC/DC0%0/2
defined $call_object->_returns && $call_object->_returns ne 'Paws::API::Response'
defined $call_object->_returns $call_object->_returns ne 'Paws::API::Response'
Truth table0%0/3
A && B
A= defined $call_object->_returnsB= $call_object->_returns ne 'Paws::API::Response'
ABresult
0X0
100
111
35 0 ▶ my $ret_class = $returns ? $call_object->_returns : 'Paws::API::Response';
Branch: 1 branch
BranchTrueFalseTotal
$returns ? : 0 0 0
36 0 Paws->load_class($ret_class);
37
38 0 my $unserialized_struct;
39  
40 0 ▶ if ($ret_class->can('_stream_param')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_class->can('_stream_param')) { } 0 0 0
41 0 $unserialized_struct = {}
42 } else {
43 0 ▶ if (not defined $content or $content eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or $content eq '') { } 0 0 0
Condition0%0/3
not defined $content or $content eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $content or $content eq ""
not defined $content $content eq ""
Truth table0%0/3
not(A) or B
A= not defined $contentB= $content eq ""
ABresult
1X1
011
000
44 0 $unserialized_struct = {}
45 } else {
46 0 ▶ if ($ret_class->can('_payload')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_class->can('_payload')) { } 0 0 0
47 0 $unserialized_struct = {$ret_class->_payload => $content};
48 }
49 else {
50 0 $unserialized_struct = eval { $self->unserialize_response( $content ) };
51 }
52 0 ▶ if ($@){
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
53 0 return Paws::Exception->new(
54 message => $@,
55 code => 'InvalidContent',
56 request_id => '', #$request_id,
57 http_status => $http_status,
58 );
59 }
60 }
61 }
62  
63 my $request_id = $headers->{'x-amz-request-id'}
64 || $headers->{'x-amzn-requestid'}
65 || $unserialized_struct->{'requestId'}
66 || $unserialized_struct->{'RequestId'}
67 || $unserialized_struct->{'RequestID'}
68 0 ▶ || $unserialized_struct->{ ResponseMetadata }->{ RequestId };
Condition0%0/15
$headers->{'x-amz-request-id'} || $headers->{'x-amzn-requestid'} || $unserialized_struct->{'requestId'} || $unserialized_struct->{'RequestId'} || $unserialized_struct->{'RequestID'} || $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
l!l&&r!l&&!r
000
$headers->{"x-amz-request-id"} or $headers->{"x-amzn-requestid"} or $unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"} or $unserialized_struct->{"RequestID"}
l!l&&r!l&&!r
000
$headers->{"x-amz-request-id"} or $headers->{"x-amzn-requestid"} or $unserialized_struct->{"requestId"} or $unserialized_struct->{"RequestId"}
l!l&&r!l&&!r
000
$headers->{"x-amz-request-id"} or $headers->{"x-amzn-requestid"} or $unserialized_struct->{"requestId"}
l!l&&r!l&&!r
000
$headers->{"x-amz-request-id"} or $headers->{"x-amzn-requestid"}
l!l&&r!l&&!r
000
MC/DC0%0/6
$headers->{'x-amz-request-id'} || $headers->{'x-amzn-requestid'} || $unserialized_struct->{'requestId'} || $unserialized_struct->{'RequestId'} || $unserialized_struct->{'RequestID'} || $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
$headers->{"x-amz-request-id"} $headers->{"x-amzn-requestid"} $unserialized_struct->{"requestId"} $unserialized_struct->{"RequestId"} $unserialized_struct->{"RequestID"} $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
Truth table0%0/7
A or B or C or D or E || F
A= $headers->{"x-amz-request-id"}B= $headers->{"x-amzn-requestid"}C= $unserialized_struct->{"requestId"}D= $unserialized_struct->{"RequestId"}E= $unserialized_struct->{"RequestID"}F= $unserialized_struct->{'ResponseMetadata'}{'RequestId'}
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
69
70 0 ▶ if ($call_object->_result_key){
Branch: 1 branch
BranchTrueFalseTotal
if ($call_object->_result_key) 0 0 0
71 0 $unserialized_struct = $unserialized_struct->{ $call_object->_result_key };
72 }
73  
74 0 $unserialized_struct->{ _request_id } = $request_id;
75
76 0 ▶ if ($returns){
Branch: 1 branch
BranchTrueFalseTotal
if ($returns) { } 0 0 0
77 0 ▶ if ($ret_class->can('_stream_param')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_class->can("_stream_param")) 0 0 0
78 0 $unserialized_struct->{ $ret_class->_stream_param } = $content
79 }
80  
81 0 foreach my $key (keys %$headers){
82 0 $unserialized_struct->{lc $key} = $headers->{$key};
83 }
84  
85 0 my $o_result = $self->new_from_result_struct($call_object->_returns, $unserialized_struct);
86 0 return $o_result;
87 } else {
88 0 return Paws::API::Response->new(
89 _request_id => $request_id,
90 );
91 }
92 }
93  
94 32 1;
↑ Summary blib/lib/Paws/Net/RestXMLResponse.pm »