line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PagSeguro::API::Base; |
2
|
6
|
|
|
6
|
|
42
|
use strict; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
230
|
|
3
|
6
|
|
|
6
|
|
29
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
223
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
13128
|
use LWP::UserAgent; |
|
6
|
|
|
|
|
399037
|
|
|
6
|
|
|
|
|
298
|
|
6
|
6
|
|
|
6
|
|
5925
|
use PagSeguro::API::Resource; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
1931
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
0
|
|
return bless {}, shift; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# accessors |
13
|
|
|
|
|
|
|
sub resource { |
14
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# return resources key |
17
|
0
|
|
|
|
|
|
my $res = PagSeguro::API::Resource->instance; |
18
|
0
|
0
|
0
|
|
|
|
return ($res->get($_[0]) || undef) if $_[0]; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# method |
22
|
|
|
|
|
|
|
sub get { |
23
|
0
|
|
|
0
|
0
|
|
my ($self, $url) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
26
|
0
|
|
0
|
|
|
|
my $response = $ua->get($url) || undef; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# success |
29
|
0
|
0
|
0
|
|
|
|
return $response->decoded_content |
30
|
|
|
|
|
|
|
if $response && $response->is_success |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub post { |
34
|
0
|
|
|
0
|
0
|
|
my ($self, $url, $params) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $ua = LWP::UserAgent->new; |
37
|
0
|
|
0
|
|
|
|
my $response = $ua->post($url, $params) || undef; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# success |
40
|
0
|
0
|
0
|
|
|
|
return $response->decoded_content |
41
|
|
|
|
|
|
|
if $response && $response->is_success; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# error |
44
|
0
|
|
|
|
|
|
return $response->status_line; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |