line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CloudHealth::API::Caller; |
2
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
306
|
use HTTP::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
455
|
use CloudHealth::API::HTTPResponse; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
189
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has ua => (is => 'ro', default => sub { |
7
|
|
|
|
|
|
|
HTTP::Tiny->new( |
8
|
|
|
|
|
|
|
agent => 'CloudHealth::API Perl Client ' . $CloudHealth::API::VERSION, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
}); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub call { |
13
|
0
|
|
|
0
|
0
|
|
my ($self, $req) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
my $res = $self->ua->request( |
16
|
|
|
|
|
|
|
$req->method, |
17
|
|
|
|
|
|
|
$req->url, |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
headers => $req->headers, |
20
|
|
|
|
|
|
|
(defined $req->content) ? (content => $req->content) : (), |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return CloudHealth::API::HTTPResponse->new( |
25
|
|
|
|
|
|
|
status => $res->{ status }, |
26
|
0
|
0
|
|
|
|
|
(defined $res->{ content })?( content => $res->{ content } ) : (), |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
1; |