::Socket::SSL;
use MIME::Base64;
use Furl;
use JSON::MaybeXS ();
use Moo;
use URI;
use Net::Moip::V2::Endpoint;
our $VERSION = "0.06";
my $JSON = JSON::MaybeXS->new->utf8;
has 'ua', is => 'ro', de
> 'no-cache'
], $body);
return { error => $res->status_line } if $res->code >= 500;
$JSON->decode($res->content);
}
sub endpoint {
my ($self, $path, $params) = @_;
die "Syntax
my $endpoint = shift;
$self->endpoint($endpoint)->post(@_);
}
sub decode_json {
my $self = shift;
$JSON->decode($_[0]);
}
1;
__END__
=encoding utf-8
=head1 NAME
Net::Moip::V2 -
et::Moip::V2::Endpoint;
use IO::Socket::SSL;
use MIME::Base64;
use Furl;
use JSON::MaybeXS ();
use Moo;
my $JSON = JSON::MaybeXS->new->utf8;
has 'path', is => 'ro', required => 1;
has 'api_url',
on/json',
'Authorization' => $self->_authorization_string
]);
}
sub post {
my ($self, $data) = @_;
$self->ua->post($self->url, [
'Content-Type' => 'application/json',
'Authorization' => $self->_authorization_string
], $JSON->encode($data) );
}
sub oauth_get {
my $self = shift;
local $self->{is_oauth} = 1;
$self->get(@_);
}
sub oauth_post