File Coverage

blib/lib/Flickr/API2/Interestingness.pm
Criterion Covered Total %
statement 17 17 100.0
branch 1 2 50.0
condition 1 2 50.0
subroutine 5 5 100.0
pod 1 1 100.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package Flickr::API2::Interestingness;
2 4     4   27 use 5.12.0;
  4         9  
3 4     4   12 use warnings;
  4         4  
  4         82  
4 4     4   11 use Moo;
  4         11  
  4         14  
5 4     4   751 use Flickr::API2::Photo;
  4         4  
  4         431  
6             extends 'Flickr::API2::Base';
7              
8             =head1 NAME
9              
10             Flickr::API2::Interestingness
11              
12             =head1 SYNOPSIS
13              
14             See getList() below.
15              
16             =head1 METHODS
17              
18             =head2 getList
19              
20             Returns the list of interesting photos for the most recent day or a
21             user-specified date.
22              
23             See http://www.flickr.com/services/api/flickr.interestingness.getList.html
24             for available options.
25              
26             =cut
27              
28             # Note - this is basically a carbon-copy of the photos.search method :/
29             sub getList {
30 1     1 1 15 my $self = shift;
31 1         3 my %args = @_;
32              
33 1   50     8 $args{extras} ||= join(',',
34             qw(
35             date_upload date_taken owner_name url_s url_m url_l path_alias
36             )
37             );
38              
39 1         13 my $r = $self->api->execute_method(
40             'flickr.interestingness.getList', \%args
41             );
42             die("Didn't understand response (or no photos)")
43 1 50       5 unless exists $r->{photos};
44            
45             return $self->_response_to_photos($r->{photos})
46 1         14 }
47              
48             1;