our
$VERSION
=
'0.001'
;
has
'url'
=> (
is
=>
'ro'
,
);
sub
competition {
my
(
$self
,
%args
) =
@_
;
return
{
error
=>
'id parameter is required'
}
unless
defined
$args
{id};
my
$url
=
$self
->url
.
'?params[action]=contest.find'
.
'¶ms[id_weight]=0'
.
'¶ms[order_by]=cnum'
.
'¶ms[id_competition]='
.
$args
{id};
my
$ua
= LWP::UserAgent->new;
my
$request
= HTTP::Request->new(
GET
=>
$url
);
my
$response
=
$ua
->request(
$request
);
return
decode_json (
$response
->content)->{contests}
if
$response
->code == 200;
return
{
error
=>
'Error retreiving competitor info'
};
}
1;