line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Shutterstock::Lightbox; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$WebService::Shutterstock::Lightbox::VERSION = '0.006'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Representation of a lightbox in Shutterstock's public API |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
28686
|
use strict; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
577
|
|
9
|
10
|
|
|
10
|
|
10090
|
use version; |
|
10
|
|
|
|
|
24590
|
|
|
10
|
|
|
|
|
158
|
|
10
|
10
|
|
|
10
|
|
1790
|
use Moo; |
|
10
|
|
|
|
|
26828
|
|
|
10
|
|
|
|
|
83
|
|
11
|
10
|
|
|
10
|
|
12172
|
use WebService::Shutterstock::Image; |
|
10
|
|
|
|
|
36
|
|
|
10
|
|
|
|
|
456
|
|
12
|
10
|
|
|
10
|
|
102
|
use WebService::Shutterstock::DeferredData qw(deferred); |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
115
|
|
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
10
|
|
11229
|
use WebService::Shutterstock::AuthedClient; |
|
10
|
|
|
|
|
30
|
|
|
10
|
|
|
|
|
5537
|
|
15
|
|
|
|
|
|
|
with 'WebService::Shutterstock::AuthedClient'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
deferred( |
18
|
|
|
|
|
|
|
['lightbox_name' => 'name', 'rw'], |
19
|
|
|
|
|
|
|
['images' => '_images', 'ro'], |
20
|
|
|
|
|
|
|
sub { |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
my $client = $self->client; |
23
|
|
|
|
|
|
|
$client->GET( sprintf('/lightboxes/%s/extended.json', $self->id), $self->with_auth_params ); |
24
|
|
|
|
|
|
|
return $client->process_response; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has id => ( is => 'rw', init_arg => 'lightbox_id' ); |
30
|
|
|
|
|
|
|
has public_url => ( is => 'lazy' ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _build_public_url { |
33
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
34
|
0
|
|
|
|
|
0
|
my $client = $self->client; |
35
|
0
|
|
|
|
|
0
|
$client->GET( sprintf( '/lightboxes/%s/public_url.json', $self->id ), $self->with_auth_params ); |
36
|
0
|
0
|
|
|
|
0
|
if(my $data = $client->process_response){ |
37
|
0
|
|
|
|
|
0
|
return $data->{public_url}; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
0
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub delete_image { |
44
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
45
|
1
|
|
|
|
|
3
|
my $image_id = shift; |
46
|
1
|
|
|
|
|
5
|
my $client = $self->client; |
47
|
1
|
|
|
|
|
13
|
$client->DELETE( |
48
|
|
|
|
|
|
|
sprintf( '/lightboxes/%s/images/%s.json', $self->id, $image_id ), |
49
|
|
|
|
|
|
|
$self->with_auth_params( username => $self->username ) |
50
|
|
|
|
|
|
|
); |
51
|
1
|
|
|
|
|
9
|
delete $self->{_images}; |
52
|
1
|
|
|
|
|
7
|
return $client->process_response; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub add_image { |
57
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
58
|
1
|
|
|
|
|
3
|
my $image_id = shift; |
59
|
1
|
|
|
|
|
6
|
my $client = $self->client; |
60
|
1
|
|
|
|
|
9
|
$client->PUT( |
61
|
|
|
|
|
|
|
sprintf( |
62
|
|
|
|
|
|
|
'/lightboxes/%s/images/%s.json?%s', |
63
|
|
|
|
|
|
|
$self->id, |
64
|
|
|
|
|
|
|
$image_id, |
65
|
|
|
|
|
|
|
$client->buildQuery( |
66
|
|
|
|
|
|
|
username => $self->username, |
67
|
|
|
|
|
|
|
auth_token => $self->auth_token |
68
|
|
|
|
|
|
|
) |
69
|
|
|
|
|
|
|
) |
70
|
|
|
|
|
|
|
); |
71
|
1
|
|
|
|
|
9
|
delete $self->{_images}; |
72
|
1
|
|
|
|
|
7
|
return $client->process_response; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub images { |
77
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
78
|
1
|
50
|
|
|
|
2
|
return [ map { $self->new_with_auth('WebService::Shutterstock::Image', %$_ ) } @{ $self->_images || [] } ]; |
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
4
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |