line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Payjp::Resource; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
57
|
use strict; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
251
|
|
4
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
258
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
49
|
use base 'Net::Payjp'; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
5160
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub create{ |
9
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
10
|
0
|
|
|
|
|
0
|
my %p = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
0
|
$self->_request(method => 'POST', url => $self->_class_url, param => \%p); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub retrieve{ |
16
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
17
|
0
|
|
|
|
|
0
|
my $id = shift; |
18
|
0
|
0
|
|
|
|
0
|
$self->id($id) if $id; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
$self->_request(method => 'GET', url => $self->_instance_url); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub save{ |
24
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
25
|
0
|
|
|
|
|
0
|
my %p = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
$self->_request(method => 'POST', url => $self->_instance_url, param => \%p); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub all{ |
31
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
32
|
0
|
|
|
|
|
0
|
my %p = @_; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
$self->_request(method => 'GET', url => $self->_class_url, param => \%p); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub delete{ |
38
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
39
|
0
|
|
|
|
|
0
|
my %p = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
$self->_request(method => 'DELETE', url => $self->_instance_url); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _instance_url{ |
45
|
1
|
|
|
1
|
|
4
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
|
|
9
|
if(ref($self) =~ /Net::Payjp::Customer::Card/){ |
|
|
0
|
|
|
|
|
|
48
|
1
|
|
|
|
|
10
|
return $self->api_base.'/v1/'.'customers/'.$self->cus_id.'/cards'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif(ref($self) =~ /Net::Payjp::Customer::Subscription/){ |
51
|
0
|
|
|
|
|
|
return $self->api_base.'/v1/'.'customers/'.$self->cus_id.'/subscriptions'; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else{ |
54
|
0
|
|
|
|
|
|
return $self->_class_url.'/'.$self->id; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _class_url{ |
59
|
0
|
|
|
0
|
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
my ($class) = lc(ref($self)) =~ /([^:]*$)/; |
61
|
0
|
|
|
|
|
|
return $self->api_base.'/v1/'.$class.'s'; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |