w( HashRefRestricted Boolean );
use Type::Utils -all;
use Types::Standard -types;
use Carp;
use JSON::PP;
use Scalar::Util qw(blessed);
our $VERSION = '1.0.2'; # VERSION
my $meta = __PACKAGE__->me
stanceOf['JSON::PP::Boolean'],
constraint_generator => sub {
return $meta->get_type('Boolean') if !@_;
return sub {
return if ! ( blessed $_ and $_->isa('JSON::PP::Boo
ion;
},
);
coerce Boolean,
from Bool,
via {
my $new = $_ ? $JSON::PP::true : $JSON::PP::false;
$new;
}
;
__PACKAGE__->meta->make_immutable;
1;
__END
);
has json_rpc => ( is => 'ro', isa => Str, default => sub { '2.0' } );
state $request_id = 1;
sub _request ( $self, $method, $params = {}, $opts = {} ) {
my $rpc_data = {
jsonrpc => $
lt;
$api->_set_token( $token );
}
my %header = ( 'Content-Type' => 'application/json' );
$header{'HPLS-AUTH'} = $api->token if $api->token;
my $uri = join '/',
$api-
eader,
json => $rpc_data,
);
my $response = $tx->res;
if ( $tx->error ) {
carp $tx->error->{message};
return;
}
my $data = $response->json;
if ( $da