File Coverage

lib/WebService/Braintree/Disbursement.pm
Criterion Covered Total %
statement 11 19 57.8
branch n/a
condition n/a
subroutine 4 7 57.1
pod 1 2 50.0
total 16 28 57.1


line stmt bran cond sub pod time code
1             package WebService::Braintree::Disbursement;
2             $WebService::Braintree::Disbursement::VERSION = '0.94';
3 20     20   474 use 5.010_001;
  20         70  
4 20     20   119 use strictures 1;
  20         163  
  20         845  
5              
6             =head1 NAME
7              
8             WebService::Braintree::Disbursement
9              
10             =head1 PURPOSE
11              
12             This class represents a disbursement.
13              
14             =cut
15              
16 20     20   2393 use WebService::Braintree::Transaction;
  20         39  
  20         444  
17              
18 20     20   97 use Moose;
  20         36  
  20         138  
19             extends "WebService::Braintree::ResultObject";
20              
21             =head1 CLASS METHODS
22              
23             This class is B<NOT> an interface, so it does B<NOT> have any class methods.
24              
25             =head1 OBJECT METHODS
26              
27             =cut
28              
29             sub BUILD {
30 0     0 0   my ($self, $attributes) = @_;
31              
32 0           $self->merchant_account(WebService::Braintree::MerchantAccount->new($attributes->{merchant_account}));
33 0           delete($attributes->{merchant_account});
34 0           $self->set_attributes_from_hash($self, $attributes);
35             }
36              
37             =pod
38              
39             In addition to the methods provided by B<TODO>, this class provides the
40             following methods:
41              
42             =head2 merchant_account()
43              
44             This returns the merchant account associated with this notification (if any).
45             This will be an object of type L<WebService::Braintree::MerchantAccount/>.
46              
47             =cut
48              
49             has merchant_account => (is => 'rw');
50              
51             =head2 transactions()
52              
53             This returns the transactions associated with this disbursement. This is a
54             wrapper around L<WebService::Braintree::Transaction/search()>.
55              
56             =cut
57              
58             sub transactions {
59 0     0 1   my $self = shift;
60             WebService::Braintree::Transaction->search(sub {
61 0     0     my $search = shift;
62 0           $search->ids->in($self->transaction_ids);
63 0           });
64             }
65              
66             __PACKAGE__->meta->make_immutable;
67              
68             1;
69             __END__
70              
71             =head1 TODO
72              
73             =over 4
74              
75             =item Need to document the keys and values that are returned
76              
77             =item Need to document the required and optional input parameters
78              
79             =item Need to document the possible errors/exceptions
80              
81             =back
82              
83             =cut