package WebService::HMRC::Request;
use 5.006;
use Carp;
use JSON::MaybeXS qw(encode_json);
use LWP::UserAgent;
use Moose;
use namespace::autoclean;
use URI;
use WebService::HMRC::Response;
=head1 N
s_success;
# post data as json to an application-restricted endpoint
my $data = {serviceNames => ['mtd-vat']};
my $response = $r->post_endpoint_json({
endpoint => '/create-tes
ethods for calling api endpoints, mapping their response
into a standard class and decoding their JSON payload. It also provides a
LWP::UserAgent with appropriate headers set and a lower-level method
package WebService::HMRC::Response;
use 5.006;
use Carp;
use JSON::MaybeXS qw(decode_json);
use Moose;
use namespace::autoclean;
use Try::Tiny;
=head1 NAME
WebService::HMRC::Response - Response ob
erl hash representing an api call's json response.
This property is updated on object creation when the http property is set.
If an api call returns no valid json response, this property is
populate
lass's `data` property to reflect the json content of
# the supplied HTTP::Response object. Returns a reference to the Perl data
# structure representing the json response.
sub _parse_http_response {