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