File Coverage

lib/WebService/Braintree/PaymentMethodGateway.pm
Criterion Covered Total %
statement 14 25 56.0
branch 0 2 0.0
condition n/a
subroutine 5 9 55.5
pod 0 4 0.0
total 19 40 47.5


line stmt bran cond sub pod time code
1             package WebService::Braintree::PaymentMethodGateway;
2             $WebService::Braintree::PaymentMethodGateway::VERSION = '0.94';
3 20     20   434 use 5.010_001;
  20         65  
4 20     20   118 use strictures 1;
  20         150  
  20         823  
5              
6 20     20   2052 use Moose;
  20         41  
  20         129  
7             with 'WebService::Braintree::Role::MakeRequest';
8              
9 20     20   123394 use Carp qw(confess);
  20         49  
  20         1446  
10              
11             has 'gateway' => (is => 'ro');
12              
13 20     20   120 use WebService::Braintree::Util qw(validate_id);
  20         40  
  20         4633  
14              
15             sub create {
16 0     0 0   my ($self, $params) = @_;
17 0           $self->_make_request("/payment_methods", 'post', {payment_method => $params});
18             }
19              
20             sub update {
21 0     0 0   my ($self, $token, $params) = @_;
22 0           $self->_make_request("/payment_methods/any/" . $token, "put", {payment_method => $params});
23             }
24              
25             sub delete {
26 0     0 0   my ($self, $token) = @_;
27 0           $self->_make_request("/payment_methods/any/" . $token, 'delete');
28             }
29              
30             sub find {
31 0     0 0   my ($self, $token) = @_;
32 0 0         if (!validate_id($token)) {
33 0           confess "NotFoundError";
34             }
35              
36 0           my $response = $self->_make_request("/payment_methods/any/" . $token, 'get');
37 0           return $response->payment_method;
38             }
39              
40             __PACKAGE__->meta->make_immutable;
41              
42             1;
43             __END__
44