| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Braintree::Address; |
|
2
|
|
|
|
|
|
|
$WebService::Braintree::Address::VERSION = '0.93'; |
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
WebService::Braintree::Address |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 PURPOSE |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
This class creates, updates, deletes, and finds addresses. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
515
|
use Moose; |
|
|
1
|
|
|
|
|
597966
|
|
|
|
1
|
|
|
|
|
7
|
|
|
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 address created. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub create { |
|
25
|
0
|
|
|
0
|
1
|
|
my($class, $params) = @_; |
|
26
|
0
|
|
|
|
|
|
$class->gateway->address->create($params); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 find() |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This takes a customer_id and an address_id and returns the address (if it |
|
32
|
|
|
|
|
|
|
exists). |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub find { |
|
37
|
0
|
|
|
0
|
1
|
|
my ($class, $customer_id, $address_id) = @_; |
|
38
|
0
|
|
|
|
|
|
$class->gateway->address->find($customer_id, $address_id); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 update() |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This takes a customer_id, an address_id, and a hashref of parameters. It will |
|
44
|
|
|
|
|
|
|
update the corresponding address (if found) and returns the updated address. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub update { |
|
49
|
0
|
|
|
0
|
1
|
|
my ($class, $customer_id, $address_id, $params) = @_; |
|
50
|
0
|
|
|
|
|
|
$class->gateway->address->update($customer_id, $address_id, $params); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 delete() |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This takes a customer_id and an address_id and deletes the corresponding |
|
56
|
|
|
|
|
|
|
address (if found). |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub delete { |
|
61
|
0
|
|
|
0
|
1
|
|
my ($class, $customer_id, $address_id) = @_; |
|
62
|
0
|
|
|
|
|
|
$class->gateway->address->delete($customer_id, $address_id); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub gateway { |
|
66
|
0
|
|
|
0
|
0
|
|
return WebService::Braintree->configuration->gateway; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub BUILD { |
|
70
|
0
|
|
|
0
|
0
|
|
my ($self, $attributes) = @_; |
|
71
|
0
|
|
|
|
|
|
$self->set_attributes_from_hash($self, $attributes); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
In addition to the methods provided by the keys returned from Braintree, this |
|
77
|
|
|
|
|
|
|
class provides the following methods: |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 full_name() |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This returns the full name of this address. This is the first_name and the |
|
82
|
|
|
|
|
|
|
last_name concatenated with a space. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub full_name { |
|
87
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
88
|
0
|
|
|
|
|
|
return $self->first_name . " " . $self->last_name |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
__END__ |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 TODO |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item Need to document the keys and values that are returned |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item Need to document the required and optional input parameters |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item Need to document the possible errors/exceptions |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |