line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Trello.com API Client |
2
|
|
|
|
|
|
|
package API::Trello; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1474
|
use namespace::autoclean -except => 'has'; |
|
1
|
|
|
|
|
19373
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
730
|
use Data::Object::Class; |
|
1
|
|
|
|
|
13750
|
|
|
1
|
|
|
|
|
9
|
|
7
|
1
|
|
|
1
|
|
2170
|
use Data::Object::Class::Syntax; |
|
1
|
|
|
|
|
6194
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
868
|
use Data::Object::Signatures; |
|
1
|
|
|
|
|
277635
|
|
|
1
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8378
|
use Data::Object qw(load); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
97
|
|
11
|
1
|
|
|
1
|
|
5
|
use Data::Object::Library qw(Str); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
extends 'API::Client'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.04'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $DEFAULT_URL = "https://api.trello.com"; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ATTRIBUTES |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has key => rw; |
22
|
|
|
|
|
|
|
has token => rw; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# CONSTRAINTS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
req key => Str; |
27
|
|
|
|
|
|
|
req token => Str; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# DEFAULTS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
def casing => 'camelcase'; |
32
|
|
|
|
|
|
|
def identifier => 'API::Trello (Perl)'; |
33
|
|
|
|
|
|
|
def url => method { load('Mojo::URL')->new($DEFAULT_URL) }; |
34
|
|
|
|
|
|
|
def version => 1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# CONSTRUCTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
after BUILD => method { |
39
|
|
|
|
|
|
|
my $key = $self->key; |
40
|
|
|
|
|
|
|
my $token = $self->token; |
41
|
|
|
|
|
|
|
my $version = $self->version; |
42
|
|
|
|
|
|
|
my $url = $self->url; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$url->path("/$version"); |
45
|
|
|
|
|
|
|
$url->query(key => $key, $token ? (token => $token) : ()); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return $self; |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# METHODS |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
0
|
|
method PREPARE ($ua, $tx, %args) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $headers = $tx->req->headers; |
54
|
0
|
|
|
|
|
|
my $url = $tx->req->url; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# default headers |
57
|
0
|
|
|
|
|
|
$headers->header('Content-Type' => 'application/json'); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
0
|
|
method resource (@segments) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# build new resource instance |
62
|
0
|
|
|
|
|
|
my $instance = __PACKAGE__->new( |
63
|
|
|
|
|
|
|
debug => $self->debug, |
64
|
|
|
|
|
|
|
fatal => $self->fatal, |
65
|
|
|
|
|
|
|
retries => $self->retries, |
66
|
|
|
|
|
|
|
timeout => $self->timeout, |
67
|
|
|
|
|
|
|
user_agent => $self->user_agent, |
68
|
|
|
|
|
|
|
key => $self->key, |
69
|
|
|
|
|
|
|
token => $self->token, |
70
|
|
|
|
|
|
|
identifier => $self->identifier, |
71
|
|
|
|
|
|
|
version => $self->version, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# resource locator |
75
|
0
|
|
|
|
|
|
my $url = $instance->url; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# modify resource locator if possible |
78
|
0
|
|
|
|
|
|
$url->path(join '/', $self->url->path, @segments); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# return resource instance |
81
|
0
|
|
|
|
|
|
return $instance; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |