| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::PutIo::Result; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
26
|
use base qw/Mojo::Base/; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
452
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
23
|
use Mojo::JSON; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
181
|
|
|
6
|
4
|
|
|
4
|
|
25
|
use Carp qw/croak/; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1090
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->attr(qw/response/); |
|
9
|
|
|
|
|
|
|
__PACKAGE__->attr('json' => sub { Mojo::JSON->new }); |
|
10
|
|
|
|
|
|
|
__PACKAGE__->attr( data => sub { my $self=shift;$self->json->decode($self->response->body) }); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub count { |
|
13
|
0
|
|
|
0
|
1
|
|
return shift->data->{response}->{total}; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub results { |
|
17
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
|
18
|
0
|
0
|
|
|
|
|
if($self->data->{error}) { |
|
19
|
0
|
|
|
|
|
|
croak('API Request failed: '. $self->data->{error_message}); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
0
|
|
|
|
|
|
return $self->data->{response}->{results}; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
WebService::PutIo - WebService client for the put.io API |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use WebService::PutIo::Result; |
|
32
|
|
|
|
|
|
|
my $res=WebService::PutIo::Result->new(response=>$res); |
|
33
|
|
|
|
|
|
|
foreach my $file (@{$res->results}) { |
|
34
|
|
|
|
|
|
|
print "Got ". Data::Dumper($file); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Result object for the put.io Web Service API. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 response |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
A L object representing the response from put.io |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 json |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
JSON object for deserializing. Defaults to a plain L. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 data |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The deserialized JSON body. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 count |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Number of elements returned by the web service call. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 results |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Returns an arrayref of results as perl structures. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Marcus Ramberg, C. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Copyright (C) 2010, Marcus Ramberg. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
|
75
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |