Braintree/ClientTokenGateway.pm

filter: Statementstmt 56.6% 17 / 30 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 1 totaltotal 48.8% 22 / 45 CC 4 SCAR 16.1
CC
4
Cov
47%
generate
12.0
_conditionally_verify_params
6.0
_make_request
2.0
CRAP 5.0
« Braintree/ValidationErrorCollection.pm ↑ Summary Braintree/AddressGateway.pm »
1 package Net::Braintree::ClientTokenGateway;
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 client_token_signature_with_customer_id client_token_signature_without_customer_id);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Net::Braintree::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has 'gateway' => (is => 'ro');
9  
10 0 ▶sub generate {
Subroutine generate: not called CC=3 SCAR=24.8
Pod undocumented
11 0 my ($self, $params) = @_;
12 0 ▶ if ($params) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params) 0 0 0
13 0 ▶ confess "ArgumentError" unless $self->_conditionally_verify_params($params);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_conditionally_verify_params($params) 0 0 0
14 0 $params = {client_token => $params};
15 }
16 0 my $result = $self->_make_request("/client_token", 'post', $params);
17 0 $result->{"response"}->{"client_token"}->{"value"};
18 }
19  
20 0 ▶sub _make_request {
Subroutine _make_request: not called CC=1 SCAR=6.9
21 0 my($self, $path, $verb, $params) = @_;
22 0 my $response = $self->gateway->http->$verb($path, $params);
23 0 Net::Braintree::Result->new(response => $response);
24 }
25  
26 0 ▶sub _conditionally_verify_params {
Subroutine _conditionally_verify_params: not called CC=2 SCAR=17.9
27 0 my ($self, $params) = @_;
28  
29 0 ▶ if (exists $params->{"customer_id"}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{'customer_id'}) { } 0 0 0
30 0 verify_params($params, client_token_signature_with_customer_id);
31 } else {
32 0 verify_params($params, client_token_signature_without_customer_id);
33 };
34 }
35  
36 1 1;
« Braintree/ValidationErrorCollection.pm ↑ Summary Braintree/AddressGateway.pm »