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