line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::MollieAPI::Resource; |
2
|
4
|
|
|
4
|
|
49993
|
use Moo::Role; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
24
|
|
3
|
4
|
|
|
4
|
|
1385
|
use HTTP::Request; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
119
|
|
4
|
4
|
|
|
4
|
|
9096
|
use HTTP::Request::Common; |
|
4
|
|
|
|
|
9796
|
|
|
4
|
|
|
|
|
342
|
|
5
|
4
|
|
|
4
|
|
46
|
use JSON::XS; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
2106
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has client => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires 'name'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _create_request { |
14
|
0
|
|
|
0
|
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my %args = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $url = URI->new_abs( |
18
|
|
|
|
|
|
|
'/' . $self->client->version . '/' . $self->name, |
19
|
|
|
|
|
|
|
$self->client->endpoint); |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $body = encode_json(\%args); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $req = POST $url->as_string, |
24
|
|
|
|
|
|
|
Content_Type => 'application/json', |
25
|
|
|
|
|
|
|
Content => $body; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
return $req; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub create { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
my $req = $self->_create_request(@_); |
33
|
0
|
|
|
|
|
|
my $res = $self->client->perform($req); |
34
|
0
|
|
|
|
|
|
return $res; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _get_request { |
38
|
0
|
|
|
0
|
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my ($id) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $url = URI->new_abs( |
42
|
|
|
|
|
|
|
'/' . $self->client->version . '/' . $self->name . '/' . $id, |
43
|
|
|
|
|
|
|
$self->client->endpoint); |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return GET $url->as_string; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub get { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
my $req = $self->_get_request(@_); |
51
|
0
|
|
|
|
|
|
my $res = $self->client->perform($req); |
52
|
0
|
|
|
|
|
|
return $res; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _all_request { |
56
|
0
|
|
|
0
|
|
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $url = URI->new_abs( |
59
|
|
|
|
|
|
|
'/' . $self->client->version . '/' . $self->name, |
60
|
|
|
|
|
|
|
$self->client->endpoint); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return GET $url->as_string; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub all { |
66
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
67
|
0
|
|
|
|
|
|
my $req = $self->_all_request(@_); |
68
|
0
|
|
|
|
|
|
my $res = $self->client->perform($req); |
69
|
0
|
|
|
|
|
|
return $res; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|