lib/WebService/Braintree/Role/MakeRequest.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 6 / 9 Podpod n/a totaltotal 51.0% 25 / 49 CC 4 SCAR 12.5
CC
4
Cov
49%
_make_request
6.0
_make_raw_request
6.0
_array_request
6.0
CRAP 3.5
« lib/WebService/Braintree/Validations.pm ↑ Summary lib/WebService/Braintree/TransparentRedirect/QueryString.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package # hide from pause
4 WebService::Braintree::Role::MakeRequest;
5  
6 22 ▶use 5.010_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 22 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 22 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 22 has 'gateway' => (is => 'ro');
12  
13 22 ▶use WebService::Braintree::ErrorResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 22 ▶use WebService::Braintree::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 22 ▶use WebService::Braintree::Util qw(to_instance_array);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶sub _make_request {
Subroutine _make_request: not called CC=2 SCAR=17.9
18 0 my($self, $path, $verb, @args) = @_;
19 0 my $response = $self->gateway->http->$verb($path, @args);
20  
21 0 ▶ if (exists $response->{api_error_response}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'api_error_response'}) { } 0 0 0
22 return WebService::Braintree::ErrorResult->new(
23 $response->{api_error_response},
24 0 );
25 }
26 else {
27 0 return WebService::Braintree::Result->new({
28 response => $response,
29 %$response,
30 });
31 }
32 }
33  
34 0 ▶sub _make_raw_request {
Subroutine _make_raw_request: not called CC=2 SCAR=17.9
35 0 my($self, $path, $verb, @args) = @_;
36 0 my $response = $self->gateway->http->$verb($path, @args);
37  
38 0 ▶ if (exists $response->{api_error_response}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $response->{'api_error_response'}) { } 0 0 0
39 return WebService::Braintree::ErrorResult->new(
40 $response->{api_error_response},
41 0 );
42 }
43 else {
44 0 return $response;
45 }
46 }
47  
48 0 ▶sub _array_request {
Subroutine _array_request: not called CC=2 SCAR=17.9
49 0 my ($self, $path, $key, $class) = @_;
50 0 my $response = $self->gateway->http->get($path);
51 0 ▶ my $attrs = $response->{$key} || [];
Condition0%0/2
$response->{$key} || []
l!l
00
MC/DC0%0/1
$response->{$key} || []
$response->{$key}
Truth table0%0/2
A
A= $response->{$key}
Aresult
11
00
52 0 return to_instance_array($attrs, $class);
53 }
54  
55 22 1;
56 __END__
« lib/WebService/Braintree/Validations.pm ↑ Summary lib/WebService/Braintree/TransparentRedirect/QueryString.pm »