line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Braintree::ResultObject; |
2
|
1
|
|
|
1
|
|
1006
|
use Net::Braintree::Util qw(is_arrayref is_hashref); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
3
|
1
|
|
|
1
|
|
5
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my $meta = __PACKAGE__->meta; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub set_attributes_from_hash { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $target, $attributes) = @_; |
9
|
0
|
|
|
|
|
|
while(my($attribute, $value) = each(%$attributes)) { |
10
|
0
|
|
|
|
|
|
$meta->add_attribute($attribute, is => 'rw'); |
11
|
0
|
|
|
|
|
|
$target->$attribute($self->set_attr_value($value)); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub set_attr_value { |
16
|
0
|
|
|
0
|
0
|
|
my ($self, $value) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if(is_hashref($value)) { |
|
|
0
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return Hash::Inflator->new($value); |
20
|
|
|
|
|
|
|
} elsif(is_arrayref($value)) { |
21
|
0
|
|
|
|
|
|
my $new_array = []; |
22
|
0
|
|
|
|
|
|
foreach(@$value) { |
23
|
0
|
|
|
|
|
|
push(@$new_array, $self->set_attr_value($_)); |
24
|
|
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $new_array; |
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
|
|
|
|
|
return $value; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub setup_sub_objects { |
32
|
0
|
|
|
0
|
0
|
|
my($self, $target, $params, $sub_objects) = @_; |
33
|
0
|
|
|
|
|
|
while(my($attribute, $class) = each(%$sub_objects)) { |
34
|
0
|
|
|
|
|
|
$meta->add_attribute($attribute, is => 'rw'); |
35
|
0
|
0
|
|
|
|
|
if (is_arrayref($params->{$attribute})) { |
36
|
0
|
|
|
|
|
|
my $new_array = []; |
37
|
0
|
|
|
|
|
|
foreach my $element (@{$params->{$attribute}}) { |
|
0
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
push(@$new_array, $class->new($element)) if is_hashref($element); |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
$target->$attribute($new_array); |
41
|
|
|
|
|
|
|
} else { |
42
|
0
|
0
|
|
|
|
|
push(@{$target->$attribute}, $class->new($params->{$attribute})) if is_hashref($params->{$attribute}); |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
delete($params->{$attribute}); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
0
|
|
sub credit_card_details { shift->credit_card; } |
50
|
0
|
|
|
0
|
0
|
|
sub customer_details { shift->customer; } |
51
|
0
|
|
|
0
|
0
|
|
sub billing_details { shift->billing; } |
52
|
0
|
|
|
0
|
0
|
|
sub shipping_details { shift->shipping; } |
53
|
0
|
|
|
0
|
0
|
|
sub subscription_details { shift->subscription; } |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |