idators
>;
use JSON;
use Types::Standard qw< Enum HashRef InstanceOf Maybe Str >;
our $VERSION = '0.001';
our $DEBUG = 0;
=head1 NAME
MooX::Role::REST - Simple HTTP client for JSON-REST as a Moo::
s::CompiledValidators'));
=head1 DESCRIPTION
Helper role to implement a simple REST client with JSON.
=head2 call
Mandatory method that implements the actual HTTP stuff.
=cut
sub call {
my $
ndpoint->query($params) if $params;
}
else {
@body = $cdata ? { content => encode_json($cdata) } : ();
}
print STDERR ">>>$hmethod($endpoint)>>>@body<<<\n"
if $DEBUG;
PSIS
package My::Client;
use Moo;
with qw< MooX::Role::HTTP::Tiny >;
use JSON qw< encode_json >;
# implent a call to the API of a webservice
sub call {
my $self = shi
i->path . $path : $path)
if $path;
my @params = $args ? ({ content => encode_json($args) }) : ();
if (uc($method) eq 'GET') {
my $query = $self->www_form_urlen
webservice that uses the HTTP(S)
transport protocol.
Some best known protocols are I<XMLRPC>, I<JSONRPC> and I<REST>, and can be
implemented through the required C<call()> method.
=cut
sub _build_