| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
24
|
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
$Webservice::Judobase::Contests::VERSION = '0.08'; |
|
5
|
|
|
|
|
|
|
# VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Moo; |
|
8
|
1
|
|
|
1
|
|
5
|
use HTTP::Request; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
9
|
1
|
|
|
1
|
|
277
|
use JSON::Tiny 'decode_json'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
29
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
11
|
1
|
|
|
1
|
|
556
|
|
|
|
1
|
|
|
|
|
20991
|
|
|
|
1
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
|
|
use namespace::clean; |
|
13
|
1
|
|
|
1
|
|
8
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
14
|
|
|
|
|
|
|
has 'ua' => ( |
|
15
|
|
|
|
|
|
|
is => 'ro', |
|
16
|
|
|
|
|
|
|
required => 1, |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has 'url' => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
required => 1, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ( $self, %args ) = @_; |
|
25
|
|
|
|
|
|
|
return { error => 'id parameter is required' } |
|
26
|
0
|
|
|
0
|
1
|
|
unless defined $args{id}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
my $url |
|
29
|
|
|
|
|
|
|
= $self->url |
|
30
|
|
|
|
|
|
|
. '?params[action]=contest.find' |
|
31
|
|
|
|
|
|
|
. '¶ms[id_weight]=0' |
|
32
|
|
|
|
|
|
|
. '¶ms[order_by]=cnum' |
|
33
|
|
|
|
|
|
|
. '¶ms[limit]=9999' |
|
34
|
|
|
|
|
|
|
. '¶ms[id_competition]=' |
|
35
|
|
|
|
|
|
|
. $args{id}; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new( GET => $url ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $response = $self->ua->request($request); |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return decode_json( $response->content )->{contests} |
|
42
|
|
|
|
|
|
|
if $response->code == 200; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return { error => 'Error retreiving competitor info' }; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
0
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my ( $self, %args ) = @_; |
|
48
|
|
|
|
|
|
|
return { error => 'id parameter is required' } |
|
49
|
|
|
|
|
|
|
unless defined $args{id}; |
|
50
|
0
|
|
|
0
|
1
|
|
|
|
51
|
|
|
|
|
|
|
# https://data.ijf.org/api/get_json?access_token=¶ms[action]=contest.find¶ms[__ust]=¶ms[contest_code]=wc_sen2019_m_0060_0010¶ms[part]=info,score_list,media,events |
|
52
|
0
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $url |
|
54
|
|
|
|
|
|
|
= $self->url |
|
55
|
|
|
|
|
|
|
. '?params[action]=contest.find' |
|
56
|
|
|
|
|
|
|
. '¶ms[part]=info,score_list,media,events' |
|
57
|
|
|
|
|
|
|
. '¶ms[contest_code]=' |
|
58
|
|
|
|
|
|
|
. $args{id}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $request = HTTP::Request->new( GET => $url ); |
|
61
|
0
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $response = $self->ua->request($request); |
|
63
|
0
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
return decode_json( $response->content )->{contests} |
|
65
|
0
|
|
|
|
|
|
if $response->code == 200; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
return { error => 'Error retreiving contest info' }; |
|
68
|
0
|
0
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
1; |