line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Qiita::V2::Client; |
2
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
108
|
|
3
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
112
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
1901
|
use WebService::Qiita::V2::Client::Methods; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
1241
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
4
|
|
|
4
|
0
|
9
|
my ($class, $params) = @_; |
9
|
|
|
|
|
|
|
|
10
|
4
|
|
50
|
|
|
28
|
$params ||= {}; |
11
|
4
|
|
|
|
|
36
|
my $args = { |
12
|
|
|
|
|
|
|
methods => WebService::Qiita::V2::Client::Methods->new, |
13
|
|
|
|
|
|
|
token => undef, |
14
|
|
|
|
|
|
|
team => undef, |
15
|
|
|
|
|
|
|
}; |
16
|
4
|
|
|
|
|
18
|
$args = {%$args, %$params}; |
17
|
4
|
|
|
|
|
9
|
my $self = bless $args, $class; |
18
|
4
|
|
|
|
|
13
|
$self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub AUTOLOAD { |
22
|
5
|
|
|
5
|
|
2130
|
my $self = shift; |
23
|
5
|
|
|
|
|
10
|
my $method = our $AUTOLOAD; |
24
|
5
|
|
|
|
|
11
|
my (@args) = @_; |
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
16
|
$self->call($method, @args); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
0
|
|
|
sub DESTROY {} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub call { |
32
|
5
|
|
|
5
|
0
|
10
|
my ($self, $method, @args) = @_; |
33
|
|
|
|
|
|
|
|
34
|
5
|
|
|
|
|
27
|
$method =~ s/.*:://; |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
10
|
my $common_args; |
37
|
5
|
100
|
|
|
|
21
|
$common_args->{headers} = { Authorization => "Bearer " . $self->{token} } if $self->{token}; |
38
|
5
|
100
|
|
|
|
16
|
$common_args->{team} = $self->{team} if $self->{team}; |
39
|
5
|
100
|
|
|
|
14
|
push @args, $common_args if defined $common_args; |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
33
|
$self->{methods}->$method(@args); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_error { |
45
|
3
|
|
|
3
|
0
|
11
|
my $self = shift; |
46
|
3
|
|
|
|
|
23
|
return $self->{methods}->{error}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |