File Coverage

blib/lib/WebService/Bitly/Result/ClicksByDay.pm
Criterion Covered Total %
statement 24 24 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 2 50.0
total 34 35 97.1


line stmt bran cond sub pod time code
1             package WebService::Bitly::Result::ClicksByDay;
2              
3 1     1   6 use warnings;
  1         2  
  1         42  
4 1     1   5 use strict;
  1         1  
  1         34  
5 1     1   5 use Carp;
  1         1  
  1         79  
6              
7 1     1   5 use base qw(WebService::Bitly::Result);
  1         11  
  1         105  
8              
9 1     1   6 use WebService::Bitly::Util;
  1         7  
  1         10  
10              
11             sub new {
12 1     1 1 3 my ($class, $result_clicks) = @_;
13 1         12 my $self = $class->SUPER::new($result_clicks);
14              
15 1         22 $self->{results}
16             = WebService::Bitly::Util->make_entries($self->data->{clicks_by_day});
17 1         4 for my $result ($self->results) { # nest Entry object
18 2         7 my $clicks = WebService::Bitly::Util->make_entries($result->clicks);
19 2         5 $result->{clicks} = $clicks;
20             }
21              
22 1         27 return $self;
23             }
24              
25             sub results {
26 2     2 0 526 my $results = shift->{results};
27 2 100       9 return wantarray ? @$results : $results;
28             }
29              
30             1;