| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Shutterstock::Image; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$WebService::Shutterstock::Image::VERSION = '0.006'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Represent the set of information about a Shutterstock image as returned by the API |
|
7
|
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
72505
|
use strict; |
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
376
|
|
|
9
|
11
|
|
|
11
|
|
370
|
use warnings; |
|
|
11
|
|
|
|
|
19
|
|
|
|
11
|
|
|
|
|
285
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
11
|
|
|
11
|
|
2307
|
use Moo; |
|
|
11
|
|
|
|
|
34165
|
|
|
|
11
|
|
|
|
|
65
|
|
|
12
|
11
|
|
|
11
|
|
14388
|
use WebService::Shutterstock::DeferredData qw(deferred); |
|
|
11
|
|
|
|
|
39
|
|
|
|
11
|
|
|
|
|
456
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
11
|
|
|
11
|
|
12057
|
use WebService::Shutterstock::HasClient; |
|
|
11
|
|
|
|
|
54
|
|
|
|
11
|
|
|
|
|
5412
|
|
|
15
|
|
|
|
|
|
|
with 'WebService::Shutterstock::HasClient'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has id => ( is => 'ro', required => 1, init_arg => 'image_id' ); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
deferred( |
|
21
|
|
|
|
|
|
|
qw( |
|
22
|
|
|
|
|
|
|
categories |
|
23
|
|
|
|
|
|
|
description |
|
24
|
|
|
|
|
|
|
enhanced_license_available |
|
25
|
|
|
|
|
|
|
illustration |
|
26
|
|
|
|
|
|
|
is_available |
|
27
|
|
|
|
|
|
|
is_vector |
|
28
|
|
|
|
|
|
|
keywords |
|
29
|
|
|
|
|
|
|
model_release |
|
30
|
|
|
|
|
|
|
r_rated |
|
31
|
|
|
|
|
|
|
sizes |
|
32
|
|
|
|
|
|
|
submitter |
|
33
|
|
|
|
|
|
|
submitter_id |
|
34
|
|
|
|
|
|
|
vector_type |
|
35
|
|
|
|
|
|
|
web_url |
|
36
|
|
|
|
|
|
|
), |
|
37
|
|
|
|
|
|
|
sub { |
|
38
|
|
|
|
|
|
|
my $self = shift; |
|
39
|
|
|
|
|
|
|
my $client = $self->client; |
|
40
|
|
|
|
|
|
|
$client->GET( sprintf( '/images/%s.json', $self->id ) ); |
|
41
|
|
|
|
|
|
|
my $data = $client->process_response(404 => sub { |
|
42
|
|
|
|
|
|
|
return { is_available => 0 }; |
|
43
|
|
|
|
|
|
|
}); |
|
44
|
|
|
|
|
|
|
$data->{is_available} = 1 if ! exists $data->{is_available}; |
|
45
|
|
|
|
|
|
|
return $data; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub size { |
|
50
|
2
|
|
|
2
|
1
|
1325
|
my $self = shift; |
|
51
|
2
|
|
|
|
|
5
|
my $size = shift; |
|
52
|
2
|
100
|
|
|
|
8
|
return exists($self->sizes->{$size}) ? $self->sizes->{$size} : undef; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub similar { |
|
56
|
1
|
|
|
1
|
1
|
138
|
my $self = shift; |
|
57
|
1
|
|
|
|
|
8
|
my $client = $self->client; |
|
58
|
1
|
|
|
|
|
11
|
$client->GET(sprintf('/images/%s/similar.json', $self->id)); |
|
59
|
1
|
|
|
|
|
8
|
my $images = $client->process_response; |
|
60
|
1
|
|
|
|
|
654
|
return [ map { $self->new_with_client( 'WebService::Shutterstock::Image', %$_ ) } @$images ]; |
|
|
1
|
|
|
|
|
12
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |