client->get('/bpi/currentprice.json')->{bpi}{USD}{rate_float};
my $client2 = CoinDeskClient->new();
say $client2->get('https://api.coindesk.com/v1/bpi/currentprice.json')
->{bpi}{USD}{rate_float}
;
my $client3 = CoinDeskClient->new(
base_url => 'https://api.coindesk.com/v1',
mode => 'v99',
);
say $client3->get('/bpi/currentprice.json')->data->{bpi}{USD}{rate_float};
package WebService::Client::Response;
use Moo;
our $VERSION = '1.0001'; # VERSION
use JSON::MaybeXS ();
has res => (
is => 'ro',
isa => sub {
die 'res must be a HTTP::Response objec
us_line
)],
);
has json => (
is => 'ro',
lazy => 1,
default => sub { JSON::MaybeXS->new() },
);
sub data {
my ($self) = @_;
return $self->json->decode($self->decoded_
ON
use Carp qw(croak);
use HTTP::Request;
use HTTP::Request::Common qw(DELETE GET POST PUT);
use JSON::MaybeXS ();
use LWP::UserAgent;
use WebService::Client::Response;
has base_url => (
is
lt => sub { 'application/json' },
);
has deserializer => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
my $json = $self->json;
sub {
eturn $json->decode($res->content);
}
},
);
has serializer => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
my $json = $self->json;
b 'lib';
my $client = Client->new();
my $btc_url = 'https://api.coindesk.com/v1/bpi/currentprice.json';
say $client->get($btc_url)->{bpi}{USD}{rate_float};
my $token = 'pk_da8de08f10a04315b26641ed3f