Y = 'cpan:KONOBI'; # AUTHORITY
use Moose qw( has );
use LWP::UserAgent;
use URI;
use JSON::MaybeXS qw( decode_json );
use Net::API::RPX::Exception::Usage;
use Net::API::RPX::Exception::Network;
use N
= $self->ua->post(
$uri => {
%{$opts},
apiKey => $self->api_key,
format => 'json',
},
);
if ( !$res->is_success ) {
Net::API::RPX::Exception::Network->throw(
i
ua_result => $res,
status_line => $res->status_line,
);
}
my $result = decode_json( $res->content );
if ( $result->{'stat'} ne 'ok' ) {
my $err = $result->{'err'};
Net::A
C<git>
=begin MetaPOD::JSON v1.1.0
{
"namespace":"Git::Wrapper::Plus::Ref::Tag",
"interface":"class",
"inherits":"Git::Wrapper::Plus::Ref"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fr
package Catmandu::Store::Resolver::Bag;
use Moo;
use JSON;
use Catmandu::Sane;
use Catmandu::Store::Resolver::API;
with 'Catmandu::Bag';
has api => (is => 'lazy');
has pid => (is => 'rw');
sub _
rd as stored in the resolver), created, updated and deleted
from Catmandu.
Data is returned as JSON.
{
"data": {
"documents": [],
"domain": "",
"id"
package Catmandu::Store::Resolver::API;
use Moo;
use JSON;
use LWP::UserAgent;
use Catmandu::Sane;
has url => (is => 'ro', required => 1);
has username => (is => 'ro', required => 1);
has pass
elf->ua->get($req_url);
if ($response->is_success) {
# New API
return decode_json($response->decoded_content);
} else {
# If it is 404, it could be that the "new" api
I returns the application/json content-type
# while the old doesn't.
if ($response->code == 404) {
if ($response->content_type eq 'application/json') {
retu
package Net::CheckHost;
use strict;
use warnings;
our $VERSION = 0.05;
use JSON;
use LWP::UserAgent;
use URI;
sub new {
my ($class, @args) = @_;
bless {
gateway => 'https://chec
gin::CheckHost v' . $VERSION,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
]
);
}
sub request {
my $self = shift;
my $http_
($http_response->status_line)
unless $http_response->is_success;
my $response = decode_json($http_response->decoded_content);
if ($response->{error}) {
my $error = $response->{
package Catmandu::Store::Resolver::Bag;
use Moo;
use JSON;
use Catmandu::Sane;
use Catmandu::Store::Resolver::API;
with 'Catmandu::Bag';
has api => (is => 'lazy');
has pid => (is => 'rw');
sub _
package Catmandu::Store::Resolver::API;
use Moo;
use JSON;
use LWP::UserAgent;
use Catmandu::Sane;
has url => (is => 'ro', required => 1);
has username => (is => 'ro', required => 1);
has pass
elf->ua->get($req_url);
if ($response->is_success) {
# New API
return decode_json($response->decoded_content);
} else {
# If it is 404, it could be that the "new" api
I returns the application/json content-type
# while the old doesn't.
if ($response->code == 404) {
if ($response->content_type eq 'application/json') {
retu
17-02-20
#
package LibreDTE::SDK;
use 5.024001;
use strict;
use warnings;
use REST::Client;
use JSON;
use MIME::Base64;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers n
$data_json;
if (ref($data) eq 'HASH') {
$data_json = encode_json($data);
} else {
$data_json = $data;
}
$self->{rest}->POST($self->{host}.'/api'.$api, $data_json);
>id;
my $path = $self->path . '/sessions';
my $json = $session->_freeze( { id => $session_id } );
$self->connection->POST($path, $json );
}
# downloaded from https://xx-csa.bbcollab.com/d
;
use Graph::Directed;
use List::AllUtils qw/ uniq first_value /;
use JSON;
my %tasks = map { $_->{uuid} => $_ } @{ from_json `task +PENDING export` };
my $graph = Graph::Directed->new;
$graph->a
use Path::Tiny;
use Hash::Merge qw/merge /;
use List::AllUtils qw/ reduce pairmap pairmap /;
use JSON;
use experimental 'postderef';
with 'Taskwarrior::Kusarigama::Core';
has raw_args => (
is
hod = join '_', 'run', $event;
my @plugins = $self->plugins->@*;
my @tasks = map { from_json($_) } <STDIN>;
try {
$self->$method(\@plugins,@tasks);
}
catch {
say
on_add($task) for grep { $_->DOES('Taskwarrior::Kusarigama::Hook::OnAdd') } @$plugins;
say to_json($task);
say for $self->feedback->@*;
}
# TODO document the $old, $new, $diff
sub run_modif
F (esteban[at]sasco.cl)
# @version 2017-02-20
#
use strict;
use warnings;
use LibreDTE::SDK;
use JSON;
# datos a utilizar en el cliente
my $url = 'https://libredte.cl';
my $hash = '';
# documento q
: '.$generar->{body}) if $generar->{code} != 200;
# obtener el PDF del DTE
my $dte_real = decode_json($generar->{body});
my $generar_pdf = $LibreDTE->get('/dte/dte_emitidos/pdf/'.$dte_real->{dte}.'/'
te::Ultra::DAO;
use warnings; use strict;
use Mouse;
use parent qw{Class::Data::Inheritable};
use JSON;
use Bb::Collaborate::Ultra::Util;
use Mouse::Util::TypeConstraints;
use Data::Compare;
use Clone
);
my %opt = @_;
my $json = $class->_freeze($data);
my $path = $opt{path} || $class->path
or die "no POST path";
my $msg = $connection->POST($path, $json, @_);
$class->construct(
= ref($self) || $self;
my $path = $self->path;
my $json = $class->_freeze($update_data);
my $msg = $connection->PATCH($path, $json);
my $obj = $self->construct($msg, connection => $con
d2 Data Mapping
Some conversion is needed between JSON and Perl:
=over 4
=item - Boolean `true` and `false` are converted to 0 and 1
=item - JSON date strings are converted to Unix numeric timesta
orate::Ultra::Connection;
use warnings; use strict;
use Crypt::JWT qw(encode_jwt decode_jwt);
use JSON;
use Mouse;
use REST::Client;
use Try::Tiny;
use Bb::Collaborate::Ultra::Connection::Token;
=hea
elf->debug;
my $response_data;
if ($response_content) {
try {
$response_data = from_json( $response_content);
}
catch {
die "[$response_code] $response_content";
};
die "[$resp
;
$auth->_leased( time() );
$self->auth( $auth );
}
=head2 POST
Low level method. Posts JSON data formatted data, along with
appropriate authorization headers.
my $response = $connectio
package Bb::Collaborate::Ultra::Session::Occurrence;
use warnings; use strict;
use Mouse;
use JSON;
extends 'Bb::Collaborate::Ultra::DAO';
use Mouse::Util::TypeConstraints;
=head1 NAME
Bb::Collabora
package Bb::Collaborate::Ultra::Session::RecurrenceRule;
use warnings; use strict;
use Mouse;
use JSON;
extends 'Bb::Collaborate::Ultra::DAO';
use Mouse::Util::TypeConstraints;
coerce __PACKAGE__, fro
package Bb::Collaborate::Ultra::Session::Log;
use warnings; use strict;
use Mouse;
use JSON;
extends 'Bb::Collaborate::Ultra::DAO';
use Mouse::Util::TypeConstraints;
use Bb::Collaborate::Ultra::Sessio
strict;
use warnings;
use Path::Tiny;
use Moo::Role;
use MooseX::MungeHas;
use IPC::Run3;
use JSON;
use Module::Runtime qw/ use_module /;
use List::AllUtils qw/ uniq /;
use experimental 'postdere
f export /, @query], undef, \my $out;
return @{ from_json $out };
}
sub import_task {
my( $self, $task ) = @_;
my $in = to_json $task;
run3 [qw/ task rc.recurrence=no import /], \
he tasks.
=head2 import_task
$tw->import_task( \%task )
Equivalent to
$ task import <json representation of %task>
=head2 calc
$result = $tw->calc( qw/ today + 3d / );
Equivalent t