ZooTool/Item.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« ZooTool.pm ↑ Summary ZooTool/User.pm »
1 package Net::ZooTool::Item;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 with 'Net::ZooTool::Utils';
5  
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=2.6
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;
« ZooTool.pm ↑ Summary ZooTool/User.pm »