lib/WebService/Braintree/AddressGateway.pm

filter: Statementstmt 77.7% 28 / 36 Branchbran 25.0% 2 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 4 totaltotal 59.4% 41 / 69 CC 7 SCAR 14.1
CC
7
Cov
64%
delete
12.0
update
6.0
find
3.5
CRAP 4.1
« lib/WebService/Braintree/MerchantAccountGateway.pm ↑ Summary lib/WebService/Braintree/Validations.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package # hide from pause
4 WebService::Braintree::AddressGateway;
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;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 22 with 'WebService::Braintree::Role::MakeRequest';
11  
12 22 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 22 ▶use WebService::Braintree::Util qw(validate_id);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 22 ▶use WebService::Braintree::Validations qw(verify_params address_signature);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 22 ▶use WebService::Braintree::_::Address;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.6
Pod undocumented
20 1 my($self, $params) = @_;
21 1 my $customer_id = delete($params->{'customer_id'});
22 1 ▶ confess "ArgumentError" unless verify_params($params, address_signature());
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, address_signature()) 1 0 1
23 0 $self->_make_request("/customers/$customer_id/addresses", "post", {address => $params});
24 }
25  
26 4 ▶sub find {
Subroutine find: called CC=3 SCAR=12.5
Pod undocumented
27 4 my ($self, $customer_id, $address_id) = @_;
28 4 ▶ confess "NotFoundError" unless validate_id($address_id) && validate_id($customer_id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($address_id) and validate_id($customer_id) 4 0 4
Condition66%2/3
validate_id($address_id) and validate_id($customer_id)
!ll&&!rl&&r
220
MC/DC0%0/2
validate_id($address_id) and validate_id($customer_id)
validate_id($address_id) validate_id($customer_id)
Truth table66%2/3
A and B
A= validate_id($address_id)B= validate_id($customer_id)
ABresult
0X0
100
111
29 0 $self->_make_request("/customers/$customer_id/addresses/$address_id", "get")->address;
30 }
31  
32 0 ▶sub update {
Subroutine update: not called CC=2 SCAR=17.9
Pod undocumented
33 0 my ($self, $customer_id, $address_id, $params) = @_;
34 0 ▶ confess "ArgumentError" unless verify_params($params, address_signature());
Branch: 1 branch
BranchTrueFalseTotal
unless verify_params($params, address_signature()) 0 0 0
35 0 $self->_make_request("/customers/$customer_id/addresses/$address_id", "put", {address => $params});
36 }
37  
38 0 ▶sub delete {
Subroutine delete: not called CC=3 SCAR=24.8
Pod undocumented
39 0 my ($self, $customer_id, $address_id) = @_;
40 0 ▶ confess "NotFoundError" unless validate_id($address_id) && validate_id($customer_id);
Branch: 1 branch
BranchTrueFalseTotal
unless validate_id($address_id) and validate_id($customer_id) 0 0 0
Condition0%0/3
validate_id($address_id) and validate_id($customer_id)
!ll&&!rl&&r
000
MC/DC0%0/2
validate_id($address_id) and validate_id($customer_id)
validate_id($address_id) validate_id($customer_id)
Truth table0%0/3
A and B
A= validate_id($address_id)B= validate_id($customer_id)
ABresult
0X0
100
111
41 0 $self->_make_request("/customers/$customer_id/addresses/$address_id", "delete");
42 }
43  
44 22 __PACKAGE__->meta->make_immutable;
45  
46 22 1;
47 __END__
« lib/WebService/Braintree/MerchantAccountGateway.pm ↑ Summary lib/WebService/Braintree/Validations.pm »