File Coverage

lib/WebService/Braintree/PaymentMethod.pm
Criterion Covered Total %
statement 8 17 47.0
branch n/a
condition n/a
subroutine 3 8 37.5
pod 4 5 80.0
total 15 30 50.0


line stmt bran cond sub pod time code
1             package WebService::Braintree::PaymentMethod;
2             $WebService::Braintree::PaymentMethod::VERSION = '0.94';
3 20     20   7181 use 5.010_001;
  20         64  
4 20     20   96 use strictures 1;
  20         110  
  20         651  
5              
6             =head1 NAME
7              
8             WebService::Braintree::PaymentMethod
9              
10             =head1 PURPOSE
11              
12             This class creates and finds payment methods.
13              
14             =cut
15              
16 20     20   1653 use Moose;
  20         37  
  20         98  
17             extends 'WebService::Braintree::ResultObject';
18              
19             =head1 CLASS METHODS
20              
21             =head2 create()
22              
23             This takes a hashref of parameters and returns the payment method created.
24              
25             =cut
26              
27             sub create {
28 0     0 1   my ($class, $params) = @_;
29 0           $class->gateway->payment_method->create($params);
30             }
31              
32             =head2 update()
33              
34             This takes a token and a hashref of parameters. It will update the
35             corresponding payment method (if found) and returns the updated payment method.
36              
37             =cut
38              
39             sub update {
40 0     0 1   my ($class, $token, $params) = @_;
41 0           $class->gateway->payment_method->update($token, $params);
42             }
43              
44             =head2 delete()
45              
46             This takes a token and deletes the corresponding payment method (if found).
47              
48             =cut
49              
50             sub delete {
51 0     0 1   my ($class, $token) = @_;
52 0           $class->gateway->payment_method->delete($token);
53             }
54              
55             =head2 find()
56              
57             This takes a token and returns the payment method (if it exists).
58              
59             =cut
60              
61             sub find {
62 0     0 1   my ($class, $token) = @_;
63 0           $class->gateway->payment_method->find($token);
64             }
65              
66             sub gateway {
67 0     0 0   return WebService::Braintree->configuration->gateway;
68             }
69              
70             =head1 OBJECT METHODS
71              
72             In addition to the methods provided by the keys returned from Braintree, this
73             class provides the following methods:
74              
75             =head2 token()
76              
77             =cut
78              
79             has token => ( is => 'rw' );
80              
81             __PACKAGE__->meta->make_immutable;
82              
83             1;
84             __END__
85              
86             =head1 TODO
87              
88             =over 4
89              
90             =item Need to document the keys and values that are returned
91              
92             =item Need to document the required and optional input parameters
93              
94             =item Need to document the possible errors/exceptions
95              
96             =back
97              
98             =cut