File Coverage

blib/lib/API/Instagram/Search.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod 1 1 100.0
total 13 13 100.0


line stmt bran cond sub pod time code
1             package API::Instagram::Search;
2              
3             # ABSTRACT: Instagram Search Object
4              
5 15     15   84 use Moo;
  15         29  
  15         92  
6              
7             my $search = {
8             user => 'users/search',
9             media => 'media/search',
10             tag => 'tags/search',
11             location => 'locations/search',
12             };
13              
14             has type => ( is => 'ro', required => 1, isa => sub { die "Type not supported." unless $search->{$_[0]} } );
15              
16              
17             sub find {
18 1     1 1 758 my $self = shift;
19 1         4 my %opts = @_;
20 1         6 my $type = $self->type;
21 1         2 my $url = $search->{$type};
22 1         5 my $api = API::Instagram->instance;
23 1         11 [ map { $api->$type($_) } $api->_get_list( { %opts, url => $url } ) ]
  22         58  
24             }
25              
26              
27             1;
28              
29             __END__