File Coverage

blib/lib/WWW/PayPal/Plan.pm
Criterion Covered Total %
statement 7 26 26.9
branch n/a
condition n/a
subroutine 3 13 23.0
pod 11 11 100.0
total 21 50 42.0


line stmt bran cond sub pod time code
1             package WWW::PayPal::Plan;
2              
3             # ABSTRACT: PayPal Billing Plan entity
4              
5 2     2   13 use Moo;
  2         5  
  2         14  
6 2     2   794 use namespace::clean;
  2         3  
  2         15  
7              
8             our $VERSION = '0.002';
9              
10              
11             has _client => (
12             is => 'ro',
13             required => 1,
14             weak_ref => 1,
15             init_arg => 'client',
16             );
17              
18             has data => ( is => 'rw', required => 1 );
19              
20              
21 1     1 1 8387 sub id { $_[0]->data->{id} }
22 0     0 1   sub product_id { $_[0]->data->{product_id} }
23 0     0 1   sub name { $_[0]->data->{name} }
24 0     0 1   sub description { $_[0]->data->{description} }
25 0     0 1   sub status { $_[0]->data->{status} }
26 0     0 1   sub billing_cycles { $_[0]->data->{billing_cycles} }
27 0     0 1   sub create_time { $_[0]->data->{create_time} }
28 0     0 1   sub update_time { $_[0]->data->{update_time} }
29              
30              
31             sub activate {
32 0     0 1   my ($self) = @_;
33 0           $self->_client->plans->activate($self->id);
34 0           $self->refresh;
35 0           return $self;
36             }
37              
38             sub deactivate {
39 0     0 1   my ($self) = @_;
40 0           $self->_client->plans->deactivate($self->id);
41 0           $self->refresh;
42 0           return $self;
43             }
44              
45              
46             sub refresh {
47 0     0 1   my ($self) = @_;
48 0           my $fresh = $self->_client->plans->get($self->id);
49 0           $self->data($fresh->data);
50 0           return $self;
51             }
52              
53              
54             1;
55              
56             __END__