File Coverage

blib/lib/WebService/Braintree/PaymentMethod.pm
Criterion Covered Total %
statement 3 12 25.0
branch n/a
condition n/a
subroutine 1 6 16.6
pod 4 5 80.0
total 8 23 34.7


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