line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::BigDoor::CurrencyBalance; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
50429
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
144
|
|
4
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
98
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
43
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
227
|
|
7
|
3
|
|
|
3
|
|
16
|
use Data::Dumper; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
168
|
|
8
|
|
|
|
|
|
|
#use Smart::Comments -ENV; |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
16
|
use base qw(WWW::BigDoor::Resource Class::Accessor); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1462
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->follow_best_practice; |
13
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( |
14
|
|
|
|
|
|
|
qw(id read_only end_user_obj adjustment_amount curr_balance prev_balance transaction_group_id) |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
3
|
|
|
3
|
1
|
1798
|
my ( $class, $end_user_obj, $args ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
62
|
my $self = $class->SUPER::new( $args ); |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
12
|
$self->set_end_user_obj( $end_user_obj ); |
23
|
3
|
|
|
|
|
63
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub end_point { |
27
|
2
|
|
|
2
|
1
|
7
|
my ( $self, $end_user_obj ) = @_; |
28
|
2
|
|
|
|
|
21
|
my $ep = $self->_end_point; |
29
|
|
|
|
|
|
|
|
30
|
2
|
50
|
|
|
|
11
|
unless ( defined $end_user_obj ) { |
31
|
0
|
0
|
|
|
|
0
|
croak "Need EndUser object as parameter" unless ref $self; |
32
|
0
|
|
|
|
|
0
|
$end_user_obj = $self->get_end_user_obj; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
### end_user_obj: Dumper($end_user_obj) |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
14
|
my $end_user_login = $end_user_obj->get_end_user_login(); |
37
|
|
|
|
|
|
|
### end_user_login: $end_user_login |
38
|
|
|
|
|
|
|
### _end_point: $self->_end_point() |
39
|
|
|
|
|
|
|
### _parent_end_point: $self->_parent_end_point() |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
32
|
$ep = sprintf '%s/%s/%s', $self->_parent_end_point(), $end_user_login, $self->_end_point(); |
42
|
|
|
|
|
|
|
### ep with parent: $ep |
43
|
2
|
|
|
|
|
8
|
return $ep; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub all { |
47
|
2
|
|
|
2
|
1
|
15834
|
my ( $self, $client, $end_user_obj ) = @_; |
48
|
2
|
|
|
|
|
12
|
my $ep = $self->end_point( $end_user_obj ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
## end_point: $ep |
51
|
|
|
|
|
|
|
### check: defined $ep |
52
|
2
|
|
|
|
|
15
|
my $data = $client->GET( $ep ); |
53
|
2
|
|
|
|
|
4
|
my @all; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
### data: $data |
56
|
|
|
|
|
|
|
|
57
|
2
|
|
|
|
|
4
|
foreach my $object ( @{@$data[0]} ) { |
|
2
|
|
|
|
|
6
|
|
58
|
|
|
|
|
|
|
### object: $object |
59
|
1
|
|
|
|
|
7
|
push @all, $self->new( $end_user_obj, $object ); |
60
|
|
|
|
|
|
|
### next... |
61
|
|
|
|
|
|
|
} |
62
|
2
|
|
|
|
|
14
|
return [@all]; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _parent_end_point { ## no critic (ProhibitUnusedPrivateSubroutines) |
66
|
2
|
|
|
2
|
|
10
|
return 'end_user'; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _parent_id_attr { ## no critic (ProhibitUnusedPrivateSubroutines) |
70
|
0
|
|
|
0
|
|
|
return 'end_user_login'; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |