line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # private |
2
|
|
|
|
|
|
|
Net::COLOURlovers::Lover; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use JSON qw( from_json ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub lover { |
10
|
0
|
|
|
0
|
0
|
|
my ( $self, $lover ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $response = |
13
|
|
|
|
|
|
|
$self->{'ua'} |
14
|
|
|
|
|
|
|
->post("http://www.colourlovers.com/api/lover/$lover?format=json"); |
15
|
0
|
|
|
|
|
|
return ( from_json $response->content )->[0]; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub lovers { |
19
|
0
|
|
|
0
|
0
|
|
my ( $self, $args, $url ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$args = |
22
|
|
|
|
|
|
|
Net::COLOURlovers::_build_parametres( $args, |
23
|
|
|
|
|
|
|
[qw( orderCol sortBy numResults resultOffset )] ); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
0
|
|
|
|
my $response = |
26
|
|
|
|
|
|
|
$self->{'ua'} |
27
|
|
|
|
|
|
|
->post( $url || 'http://www.colourlovers.com/api/lovers?format=json', |
28
|
|
|
|
|
|
|
$args ); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return from_json $response->content; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub lovers_new { |
34
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
35
|
0
|
|
|
|
|
|
return $self->lovers( $args, |
36
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/lovers/new?format=json' ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub lovers_top { |
40
|
0
|
|
|
0
|
0
|
|
my ( $self, $args ) = @_; |
41
|
0
|
|
|
|
|
|
return $self->lovers( $args, |
42
|
|
|
|
|
|
|
'http://www.colourlovers.com/api/lovers/top?format=json' ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |