|
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]=general.get_one'
. '¶ms[module]=competition'
. '¶ms[id]='
. $args {id};
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new( GET => $url );
my $response = $ua ->request( $request );
return decode_json $response ->content
if $response ->code == 200;
return { error => 'Error retreiving competitor info' };
}
1;
|