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};
}
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=
::Dumper;
use Net::SSL (); # From Crypt-SSLeay
use LWP::UserAgent;
use HTTP::Cookies;
use JSON qw( decode_json );
use DeathByCaptcha::SocketClient;
$Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # For
password;
my $post_data = {'user' => $username,
'passwd' => $password,
'api_type' => 'json',
'op' => 'login'
};
$self->browser->default_header('Referer' => "http://www.reddit.
ult_header('Connection' => 'keep-alive');
$self->browser->default_header('Accept' => 'application/json, text/javascript, */*; q=0.01');
$self->browser->default_header('X-Requested-With' => 'XMLHttpReq
se 'Role';
use JSON;
# ABSTRACT: Any::Moose role for encoding Sque structures
#
# =attr encoder
#
# JSON encoder by default.
#
# =cut
has encoder => ( is => 'ro', default => sub { JSON->new->utf8 } )
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
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
ef
push @INC, '/', @base;
};
use parent qw { Chef Chef::Header };
use LWP::UserAgent;
use Mojo::JSON;
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
bless $self, $class;
return $response;
}
sub post
{
my $self = shift;
my $param = {@_};
my $mojo_json = new Mojo::JSON();
my $response = $self->add_headers(
$self->header(
'Path' => $param->{'api_end_point'},
'Content' => $mojo_json->encode($param->{'data'})
)->hash
)
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
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
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(
: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
r->{'Accept'} = $method if defined $accept;
$self->header->{'Accept'} = 'application/json' unless
defined $self->header->{'Accept'};
return $self->header->{'Accept'
use warnings;
package WebService::Freebox;
# ABSTRACT: Freebox API wrappers.
use Mouse;
use JSON;
use REST::Client;
our $VERSION = '0.001'; # VERSION
has app_id => ( is => 'ro', isa => 'Str',
ttp://mafreebox.freebox.fr');
$c->addHeader('Accept', 'application/json');
$c->addHeader('Content-Type', 'application/json');
return $c;
}
# Wrapper around REST::Client request() checkin
die qq{$errmsg ("$request $url" failed with HTTP error $errcode).\n}
}
return decode_json $c->responseContent()
}
# Helper for making normal API requests, i.e. all except for the initial
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;
ry::Tiny;
use JSON;
# extends ...
extends 'Monitoring::Spooler::Web';
# has ...
has 'json' => (
'is' => 'ro',
'isa' => 'JSON',
'lazy' => 1,
'builder' => '_init_json',
);
# with
...
# initializers ...
sub _init_json {
my $self = shift;
my $JSON = JSON::->new()->utf8();
return $JSON;
}
sub _init_fields {
return [qw(mode group_id queue message)];
}
# your co
_ref = $self->json()->decode($queue);
} catch {
$self->logger()->log( message => 'Failed to decode JSON: '.$_, level => 'warning', );
};
$queue = undef;
# if json decoding abo
=head1 ACKNOWLEDGEMENTS
YAML dumping code stolen from L<YAML::Tiny> (1.51).
=head1 SEE ALSO
L<JSON::Color>
At the time of this writing, none of syntax highlighting libraries on CPAN
support YAML.
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
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 (
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