line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Braintree::ResultObject; |
2
|
|
|
|
|
|
|
$WebService::Braintree::ResultObject::VERSION = '0.94'; |
3
|
20
|
|
|
20
|
|
9720
|
use 5.010_001; |
|
20
|
|
|
|
|
59
|
|
4
|
20
|
|
|
20
|
|
101
|
use strictures 1; |
|
20
|
|
|
|
|
143
|
|
|
20
|
|
|
|
|
746
|
|
5
|
|
|
|
|
|
|
|
6
|
20
|
|
|
20
|
|
1904
|
use Moose; |
|
20
|
|
|
|
|
34
|
|
|
20
|
|
|
|
|
84
|
|
7
|
20
|
|
|
20
|
|
111860
|
use WebService::Braintree::Util qw(is_arrayref is_hashref); |
|
20
|
|
|
|
|
43
|
|
|
20
|
|
|
|
|
9042
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub set_attributes_from_hash { |
10
|
0
|
|
|
0
|
0
|
|
my ($self, $target, $attributes) = @_; |
11
|
0
|
|
|
|
|
|
while (my($attribute, $value) = each(%$attributes)) { |
12
|
0
|
|
|
|
|
|
__PACKAGE__->meta->add_attribute($attribute, is => 'rw'); |
13
|
0
|
|
|
|
|
|
$target->$attribute($self->set_attr_value($value)); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub set_attr_value { |
18
|
0
|
|
|
0
|
0
|
|
my ($self, $value) = @_; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if (is_hashref($value)) { |
|
|
0
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return Hash::Inflator->new($value); |
22
|
|
|
|
|
|
|
} elsif (is_arrayref($value)) { |
23
|
0
|
|
|
|
|
|
my $new_array = []; |
24
|
0
|
|
|
|
|
|
foreach (@$value) { |
25
|
0
|
|
|
|
|
|
push(@$new_array, $self->set_attr_value($_)); |
26
|
|
|
|
|
|
|
} |
27
|
0
|
|
|
|
|
|
return $new_array; |
28
|
|
|
|
|
|
|
} else { |
29
|
0
|
|
|
|
|
|
return $value; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub build_sub_object { |
34
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
35
|
0
|
|
|
|
|
|
my ($attributes, %options) = @_; |
36
|
0
|
|
|
|
|
|
my ($method, $class, $key) = @options{qw/method class key/}; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if (is_hashref($attributes->{$key})) { |
39
|
0
|
|
|
|
|
|
$self->$method( "WebService::Braintree::${class}"->new($attributes->{$key}) ); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
delete($attributes->{$key}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub setup_sub_objects { |
45
|
0
|
|
|
0
|
0
|
|
my($self, $target, $params, $sub_objects) = @_; |
46
|
0
|
|
|
|
|
|
while (my($attribute, $class) = each(%$sub_objects)) { |
47
|
0
|
|
|
|
|
|
__PACKAGE__->meta->add_attribute($attribute, is => 'rw'); |
48
|
0
|
0
|
|
|
|
|
if (is_arrayref($params->{$attribute})) { |
49
|
0
|
|
|
|
|
|
my $new_array = []; |
50
|
0
|
|
|
|
|
|
foreach my $element (@{$params->{$attribute}}) { |
|
0
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
push(@$new_array, $class->new($element)) if is_hashref($element); |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
$target->$attribute($new_array); |
54
|
|
|
|
|
|
|
} else { |
55
|
0
|
0
|
|
|
|
|
push(@{$target->$attribute}, $class->new($params->{$attribute})) if is_hashref($params->{$attribute}); |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
delete($params->{$attribute}); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
0
|
|
sub credit_card_details { shift->credit_card; } |
62
|
0
|
|
|
0
|
0
|
|
sub customer_details { shift->customer; } |
63
|
0
|
|
|
0
|
0
|
|
sub billing_details { shift->billing; } |
64
|
0
|
|
|
0
|
0
|
|
sub shipping_details { shift->shipping; } |
65
|
0
|
|
|
0
|
0
|
|
sub subscription_details { shift->subscription; } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
__END__ |