line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ZooTool::Item; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2393
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
with 'Net::ZooTool::Utils'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Carp; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use namespace::autoclean; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has auth => ( |
14
|
|
|
|
|
|
|
isa => 'Net::ZooTool::Auth', |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILD { |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
before [ 'info', 'popular' ] => sub { |
23
|
|
|
|
|
|
|
# Appends apikey to all registered methods |
24
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
croak |
27
|
|
|
|
|
|
|
"You are trying to use a feature that requires authentication without providing username and password" |
28
|
|
|
|
|
|
|
if $args->{login} and ( !$self->auth->user or !$self->auth->password ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$args->{apikey} = $self->auth->apikey; |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 |
34
|
|
|
|
|
|
|
Get the info for an item by uid |
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
sub info { |
37
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
38
|
|
|
|
|
|
|
my $data = _fetch('/items/info/' . _hash_to_query_string($args)); |
39
|
|
|
|
|
|
|
return $data; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 |
43
|
|
|
|
|
|
|
Get the most popular items |
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
sub popular { |
46
|
|
|
|
|
|
|
my ( $self, $args ) = @_; |
47
|
|
|
|
|
|
|
my $data = _fetch('/items/popular/' . _hash_to_query_string($args)); |
48
|
|
|
|
|
|
|
return $data; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
no Moose; |
52
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |