File Coverage

blib/lib/WebService/Shutterstock/SearchResult/Video.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition 4 9 44.4
subroutine 7 7 100.0
pod 1 2 50.0
total 35 41 85.3


line stmt bran cond sub pod time code
1             package WebService::Shutterstock::SearchResult::Video;
2             {
3             $WebService::Shutterstock::SearchResult::Video::VERSION = '0.006';
4             }
5              
6             # ABSTRACT: Class representing a single video search result from the Shutterstock API
7              
8 9     9   57 use strict;
  9         18  
  9         430  
9 9     9   51 use warnings;
  9         18  
  9         361  
10 9     9   48 use Moo;
  9         18  
  9         55  
11              
12 9     9   2796 use WebService::Shutterstock::HasClient;
  9         23  
  9         304  
13 9     9   52 use WebService::Shutterstock::SearchResult::Item;
  9         20  
  9         2425  
14              
15             with 'WebService::Shutterstock::HasClient', 'WebService::Shutterstock::SearchResult::Item';
16              
17              
18              
19             sub BUILDARGS {
20 2     2 0 5338 my $class = shift;
21 2         17 my $args = $class->SUPER::BUILDARGS(@_);
22 2   66     35 $args->{thumb_video} ||= $args->{sizes}->{thumb_video};
23 2   33     11 $args->{preview_video} ||= $args->{sizes}->{preview_video};
24 2   33     17 $args->{preview_image_url} ||= $args->{sizes}->{preview_image}->{url};
25 2         46 return $args;
26             }
27              
28             has video_id => ( is => 'ro' ); # sic, should be image_id to be consistant I think
29              
30             has thumb_video => ( is => 'ro' );
31             has preview_video => ( is => 'ro' );
32             has preview_image_url => ( is => 'ro' );
33              
34             has submitter_id => ( is => 'ro' );
35             has duration => ( is => 'ro' );
36             has aspect_ratio_common => ( is => 'ro' );
37             has aspect => ( is => 'ro' );
38              
39              
40             sub video {
41 1     1 1 1705 my $self = shift;
42 1         8 return $self->new_with_client( 'WebService::Shutterstock::Video', %$self );
43             }
44              
45             1;
46              
47             __END__