base; #REST
pop @base; #Chef
push @INC, '/', @base;
};
use parent qw { Chef::REST };
use Mojo::JSON;
use Module::Load;
use vars qw { $AUTOLOAD };
sub new {
my $class = shift;
my $param = {@_};
lf = shift;
my $end_point = $self->api_end_point;
my $mojo_json = new Mojo::JSON();
my $list_of_roles =
$mojo_json->decode(
$self->ua( 'client_name' => $self->name
r->{'Accept'} = $method if defined $accept;
$self->header->{'Accept'} = 'application/json' unless
defined $self->header->{'Accept'};
return $self->header->{'Accept'
ist all the cookbooks available.
$obj->cookbook()->list;
=cut
# this module will be passed tha json parsed hash
# under ___data__() or variable.
# process it depending on the content expected.
su
Client::attributes;
$Chef::REST::Client::roles::VERSION = 1.0;
# this module will be passed tha json parsed hash
# under ___data__() or variable.
# process it depending on the content expected.
su
irname(__FILE__) ) ) );
pop @base; #REST
pop @base; #Chef
push @INC, '/', @base;
};
use Mojo::JSON;
sub new {
my $class = shift;
my $param = {@_};
my $self = {};
bless $self, $class;
b ___data___
{
my $self = shift;
my $result = shift;
my $mojo_json = new Mojo::JSON();
$self->{'___data___'} =
$mojo_json->decode( $result )
if defined $result;
:attributes;
$Chef::REST::Client::environments::VERSION = 1.0;
# this module will be passed tha json parsed hash
# under ___data__() or variable.
# process it depending on the content expected.
su
n/x-www-form-urlencoded; charset=UTF-8");
$self->browser->default_header('Accept' => 'application/json, text/javascript, */*; q=0.01');
$self->browser->default_header('X-PHX' => 'true');
$self->browse
icity_token = $self->authenticity_token;
$self->browser->default_header('Accept' => "application/json, text/javascript, */*; q=0.01");
$self->browser->default_header('Accept-Language' => 'en-us,en;q=
icity_token = $self->authenticity_token;
$self->browser->default_header('Accept' => "application/json, text/javascript, */*; q=0.01");
$self->browser->default_header('Accept-Language' => 'en-us,en;q=
se Moose;
use Net::SSL (); # From Crypt-SSLeay
use LWP::UserAgent;
use HTTP::Cookies;
use JSON qw( decode_json );
use URI;
use Data::Dumper;
our $VERSION = '1.3';
###### default values #####
use co
ontent;
my $response_json = decode_json($response->content);
#print Dumper $response_json;
my $post_count = $response_json->{'post_count'};
my $subscribers_count = $response_json->{'subscribers_count
a);
#print "\n \n".$response->content;
my $response_json = decode_json($response->content);
my $id = $response_json->{'ID'};
my $URL = $response_json->{'URL'};
return {id => $id, URL => $URL};
}
package WebService::OANDA::ExchangeRates;
use JSON::XS;
use LWP::UserAgent;
use Moo;
use Types::Standard qw{ ArrayRef Int Str StrMatch };
use Type::Utils qw{ declare as where coerce from via enum};
u
if $type->has_coercion;
if ( ! $type->check($val) ) {
$val = JSON::XS::encode_json($val) if ref $val;
die "invalid value: $key = ($val)";
}
return $ua;
}
# GET /currencies.json
sub get_currencies {
my $self = shift;
my %params = @_;
my $response = $self->_get_request('currencies.json', \%params);
# convert arrayref
}
);
post '/cvterms' => [ format => [qw/json/] ] => sub {
my $self = shift;
my $params = $self->req->json;
for my $p (qw/namespace id name/) {
}
);
$self->res->headers->location( "/cvterms/" . $params->{id} . ".json" );
$self->rendered(201);
};
$app->start;
During the unit testing, the B<schema
Test::Mojo->new;
$t->app->schema($schema);
my $post = $t->post_ok(
'/cvterms.json' => json => {
namespace => 'test-chado-mojoapp',
id => 'TC:000001',
:JSON 'std_parse';
# Optionally specify a single json_corpus file to test.
# If no argument, then all inline & corpus tests run.
my $file = shift;
# Inline tests.
my @cfg = $file ? () : (
[json_
space => ' '],
[json_escape_seq => '\\"'],
[json_null_literal => 'null'],
[json_bool_literal => 'true'],
[json_bool_literal => 'false'],
[json_string_char => 'chars'],
[json_string => qq|"This. Is\na string?\r\f"|],
[json_member_list => '"nada":null'],
[json_element_list => 'true, false, null, 1, 2'],
[json_array => '[1, 2]'],
[json_m
nfig_dir } );
my @all_configs = map { basename $_}
File::Find::Rule->file->name(qr/\.json$/)->in($config_dir);
for my $config_file (@all_configs) {
my $fixture_dir = catdir(
se JSON;
use feature qw/say/;
extends qw/Test::Chado::DBManager::Pg/;
sub _build_dbh {
my ($self) = @_;
my $ua = HTTP::Tiny->new(
default_headers => { 'Accept' => 'application/json' }
e "status: $response->{status}\treason: $response->{reason}\n";
}
my $resp_hash = decode_json $response->{content};
my $dsn
= "dbi:Pg:dbname=$resp_hash->{dbname};host=$resp_hash->
package WebService::OANDA::ExchangeRates::Response;
use Moo;
use HTTP::Response;
use JSON::XS qw{decode_json};
use Try::Tiny;
has http_response => (
is => 'rw',
handles => {
is_suc
s => 'rw' );
sub BUILD {
my $self = shift;
my $data;
try {
$data = JSON::XS::decode_json( $self->raw_data );
}
catch {
$data = {
code => undef,
ent(%s): $%s', $self->raw_data, $_
)
};
# if we failed to decode the json on a successful query, we'll consider
# this an outlier and force a 500
if ($self
re>.
The JBD namespace also contains lexing, parsing and grammar tools.
For JSON tokenizing and parsing, see L<JBD::JSON>.
For general parsing tools, see L<JBD::Parser>.
=head1 AUTHOR
Joel Dalley
rializing / unserializing
use Data::Compare;
use Data::Dumper;
use JSON;
# serialize hashes with the same key order:
my $json = JSON->new->allow_nonref->canonical->utf8;
use Data::UUID;
use File::Pa
hashref into string (to be passed to Gearman)
#
# Parameters:
# * hashref that is serializable by JSON module (may be undef)
#
# Returns:
# * a string (string is empty if the hashref is undef)
#
# Di
def;
eval {
$hashref_serialized = $json->encode( $hashref );
# Try to deserialize, see if we get the same hashref
my $hashref_deserialized = $json->decode($hashref_serialized);
unless (
package API::ParallelsWPB::Response;
use strict;
use warnings;
use JSON::XS qw/decode_json/;
# ABSTRACT: processing of API responses
our $VERSION = '0.03'; # VERSION
our $AUTHORITY = 'cpan:IMAGO'; #
line;
my ( $json_content, $response, $error );
if ( $success ) {
$json_content = $res->content;
$response = decode_json( $json_content )->{response} if $json_content;
}
else {
my $error_json = $res->content;
eval { $error = decode_json( $error_json )->{error}->{message}; 1; }
or do { $error = $error_json };
}
return bless(
my_variable>) will be discarded after
each run.
Returns result on success (serializable by the L<JSON> module). The result
will be discarded if the job is ordered on Gearman as a background process.
) C<$args> (hashref), arguments required for running the
Gearman function (serializable by the L<JSON> module)
=item * (optional) instance of Gearman::JobScheduler::Configuration to be used by the w
nal) C<$args> (hashref), arguments needed for running the Gearman
function (serializable by the L<JSON> module)
=item * (optional) Instance of Gearman::JobScheduler::Configuration to be used by the c
octurne::Demons::FusionChart::VERSION = '0.02';
use strict;
use warnings;
use JSON::PP;
my %FUSION_DATA = %{ decode_json(do { local $/; <DATA> }) };
my %TYPES = %{ $FUSION_DATA{normal_fusions} };
my
oad '""' => 'to_string', fallback => 1;
# ABSTRACT: an individual demon
use JSON::PP;
my %DEMONS_BY_NAME = %{ decode_json(do { local $/; <DATA> }) };
for my $name (keys %DEMONS_BY_NAME) {
$DEMO