| 1 | package WWW::BigDoor::Profile; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | #use Smart::Comments -ENV; | ||||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use WWW::BigDoor::EndUser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use base qw(WWW::BigDoor::Resource Class::Accessor); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 2 | __PACKAGE__->follow_best_practice; | |||||||||
| 14 | 2 | __PACKAGE__->mk_accessors( | |||||||||
| 15 | qw(id provider email first_name last_name display_name profile_photo end_user_obj is_saved ) ); | ||||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 18 | 1 | my ( $class, $end_user_obj, $args ) = @_; | |||||||||
| 19 | |||||||||||
| 20 | 1 | my $self = $class->SUPER::new( $args ); | |||||||||
| 21 | |||||||||||
| 22 | 1 | $self->set_is_saved( 0 ); | |||||||||
| 23 | 1 | $self->set_end_user_obj( $end_user_obj ); | |||||||||
| 24 | 1 | return $self; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 2 | ▶ | sub get_id { | ||||||||
|
Subroutine
get_id: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 28 | 2 | my ( $self ) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 2 | ▶ | return $self->get_provider() if $self->get_is_saved; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | |||||||||||
| 32 | 1 | return; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | sub end_point { | ||||||||
|
Subroutine
end_point: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 36 | 2 | my ( $self, $end_user_obj ) = @_; | |||||||||
| 37 | 2 | my $ep = $self->_end_point; | |||||||||
| 38 | |||||||||||
| 39 | 2 | ▶ | unless ( defined $end_user_obj ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 2 | ▶ | croak "Need EndUser object as parameter" unless ref $self; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 2 | $end_user_obj = $self->get_end_user_obj; | |||||||||
| 42 | } | ||||||||||
| 43 | ### end_user_obj: Dumper($end_user_obj) | ||||||||||
| 44 | |||||||||||
| 45 | 2 | my $end_user_login = $end_user_obj->get_end_user_login(); | |||||||||
| 46 | ### end_user_login: $end_user_login | ||||||||||
| 47 | ### _end_point: $self->_end_point() | ||||||||||
| 48 | ### _parent_end_point: $self->_parent_end_point() | ||||||||||
| 49 | |||||||||||
| 50 | 2 | $ep = sprintf '%s/%s/%s', $self->_parent_end_point(), $end_user_login, $self->_end_point(); | |||||||||
| 51 | ### ep with parent: $ep | ||||||||||
| 52 | 2 | return $ep; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | sub save { | ||||||||
|
Subroutine
save: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | 1 | my ( $self, @args ) = @_; | |||||||||
| 57 | 1 | $self->SUPER::save( @args ); | |||||||||
| 58 | 1 | $self->set_is_saved( 1 ); | |||||||||
| 59 | 1 | return $self; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 0 | ▶ | sub load { | ||||||||
|
Subroutine
load: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 63 | 0 | my ( $self, @args ) = @_; | |||||||||
| 64 | 0 | $self->SUPER::load( @args ); | |||||||||
| 65 | 0 | $self->set_is_saved( 1 ); | |||||||||
| 66 | 0 | return $self; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 1 | ▶ | sub remove { | ||||||||
|
Subroutine
remove: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 70 | 1 | my $self = shift; | |||||||||
| 71 | 1 | $self->SUPER::remove( @_ ); | |||||||||
| 72 | 1 | $self->set_is_saved( 0 ); | |||||||||
| 73 | 1 | return $self; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 2 | ▶ | sub _parent_end_point { ## no critic (ProhibitUnusedPrivateSubroutines) | ||||||||
|
Subroutine
_parent_end_point: called CC=1 SCAR=0.0
| |||||||||||
| 77 | 2 | return 'end_user'; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 0 | ▶ | sub _parent_id_attr { ## no critic (ProhibitUnusedPrivateSubroutines) | ||||||||
|
Subroutine
_parent_id_attr: not called CC=1 SCAR=6.9
| |||||||||||
| 81 | 0 | return 'end_user_login'; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 2 | 1; | |||||||||
| 85 | __END__ | ||||||||||