package YellowBot::API::Request::JSON;
{
$YellowBot::API::Request::JSON::VERSION = '0.96';
}
use Moose;
use HTTP::Request;
use JSON qw(encode_json);
use namespace::clean -except => 'meta';
exten
lf->_more_args;
# JSON POST request
my $req = HTTP::Request->new('POST', $uri, ['Content-Type' => 'application/json; charset=utf-8']);
my $req_content = encode_json(\%extra);
$req->co
ing utf8
=head1 NAME
YellowBot::API::Request::Json - Request object for YellowBot::API (JSON POST)
=head1 SYNOPSIS
This class manages setting up JSON POST requests for the YellowBot::API.
No user
ellowBot::API::Response;
{
$YellowBot::API::Response::VERSION = '0.96';
}
use Moose;
use JSON qw(decode_json);
use namespace::clean -except => 'meta';
has http => (
is => 'ro',
isa => 'HTTP:
ine,
};
}
my $data = decode_json($self->http->content);
if ($ENV{API_DEBUG} and $ENV{API_DEBUG} > 2) {
warn "JSON response:\n" . $self->http->content . "\n";
}
%REQ_CLASS = (
'post' => 'YellowBot::API::Request',
'j-post' => 'YellowBot::API::Request::JSON',
);
sub _request {
my ($self, $method, %args) = @_;
my $request_class = $REQ_CLASS{$se