aller;
$Sensu::API::Client::APICaller::VERSION = '0.02';
use 5.010;
use Moo::Role;
use Carp;
use JSON;
use HTTP::Tiny;
our @CARP_NOT = qw/ Sensu::API::Client /;
has ua => (
is => 'ro',
def
is => 'ro',
default => sub { {
'Accept' => 'application/json',
'Content-type' => 'application/json',
}; },
);
sub get {
my ($self, $url) = @_;
my $r = $self->u
? decode_json($r->{content}) : 1;
}
sub post {
my ($self, $url, $body) = @_;
my $post = { headers => $self->headers };
if (defined $body) {
$post->{content} = encode_json($body);