line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Qiita::Client; |
2
|
6
|
|
|
6
|
|
2071
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
186
|
|
3
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
172
|
|
4
|
6
|
|
|
6
|
|
27
|
use utf8; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
|
|
30
|
use parent qw( |
7
|
|
|
|
|
|
|
WebService::Qiita::Client::Users |
8
|
|
|
|
|
|
|
WebService::Qiita::Client::Tags |
9
|
|
|
|
|
|
|
WebService::Qiita::Client::Items |
10
|
6
|
|
|
6
|
|
4933
|
); |
|
6
|
|
|
|
|
1892
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
32
|
|
|
32
|
0
|
5435
|
my ($class, $options) = @_; |
14
|
|
|
|
|
|
|
|
15
|
32
|
|
50
|
|
|
128
|
$options ||= {}; |
16
|
32
|
|
33
|
|
|
191
|
my $self = bless $options, ref($class) || $class; |
17
|
32
|
100
|
100
|
|
|
252
|
if (! $options->{token} && $options->{url_name} && $options->{password}) { |
|
|
|
66
|
|
|
|
|
18
|
1
|
|
|
|
|
4
|
$self->_login($options); |
19
|
|
|
|
|
|
|
} |
20
|
32
|
|
|
|
|
101
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub rate_limit { |
24
|
1
|
|
|
1
|
0
|
3
|
my ($self, $params) = @_; |
25
|
1
|
|
|
|
|
12
|
$self->get('/rate_limit', $params); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _login { |
29
|
1
|
|
|
1
|
|
2
|
my ($self, $args) = @_; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
10
|
my $info = $self->post('/auth', { |
32
|
|
|
|
|
|
|
url_name => $args->{url_name}, |
33
|
|
|
|
|
|
|
password => $args->{password}, |
34
|
|
|
|
|
|
|
}); |
35
|
1
|
|
|
|
|
86
|
$self->token($info->{token}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |