Group
Extension

Matches 2

Sensu-API-Client ( M/MR/MRUIZ/Sensu-API-Client-0.02.tar.gz, MRUIZ, 2014; MetaCPAN )
Sensu-API-Client/lib/Sensu/API/Client.pm ( view source; MetaCPAN )
;
# ABSTRACT: Perl client for the Sensu API
$Sensu::API::Client::VERSION = '0.02';
use 5.010;
use JSON;
use Carp;
use Try::Tiny;

use Moo;
use namespace::clean;

with 'Sensu::API::Client::APICaller';
Sensu-API-Client ( M/MR/MRUIZ/Sensu-API-Client-0.02.tar.gz, MRUIZ, 2014; MetaCPAN )
Sensu-API-Client/lib/Sensu/API/Client/APICaller.pm ( view source; MetaCPAN )
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);

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.