| 1 | package Net::Braintree::AddressGateway; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Carp qw(confess); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Net::Braintree::Validations qw(verify_params address_signature); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Net::Braintree::Util qw(validate_id); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Net::Braintree::Result; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | has 'gateway' => (is => 'ro'); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub create { | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 0 | my($self, $params) = @_; | |||||||||||||||||||||||||||
| 12 | 0 | my $customer_id = delete($params->{'customer_id'}); | |||||||||||||||||||||||||||
| 13 | 0 | ▶ | confess "ArgumentError" unless verify_params($params, address_signature()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | 0 | $self->_make_request("/customers/$customer_id/addresses", "post", {address => $params}); | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub find { | ||||||||||||||||||||||||||
|
Subroutine
find: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 0 | my ($self, $customer_id, $address_id) = @_; | |||||||||||||||||||||||||||
| 19 | 0 | ▶ | confess "NotFoundError" unless (validate_id($address_id) && validate_id($customer_id)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
validate_id($address_id) and validate_id($customer_id)
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)
| |||||||||||||||||||||||||||||
| 20 | 0 | $self->_make_request("/customers/$customer_id/addresses/$address_id", "get")->address; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub update { | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 0 | my ($self, $customer_id, $address_id, $params) = @_; | |||||||||||||||||||||||||||
| 25 | 0 | ▶ | confess "ArgumentError" unless verify_params($params, address_signature()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | $self->_make_request("/customers/$customer_id/addresses/$address_id", "put", {address => $params}); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | my ($self, $customer_id, $address_id) = @_; | |||||||||||||||||||||||||||
| 31 | 0 | $self->_make_request("/customers/$customer_id/addresses/$address_id", "delete"); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub _make_request { | ||||||||||||||||||||||||||
|
Subroutine
_make_request: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 35 | 0 | my($self, $path, $verb, $params) = @_; | |||||||||||||||||||||||||||
| 36 | 0 | my $response = $self->gateway->http->$verb($path, $params); | |||||||||||||||||||||||||||
| 37 | 0 | my $result = Net::Braintree::Result->new(response => $response); | |||||||||||||||||||||||||||
| 38 | 0 | return $result; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||