$msg = $client->res->code." ".$client->res->default_message;
my $got = $client->res->json;
if ($got && ref $got eq 'HASH' and keys %$got==1 && $got->{text}) {
$msg = $client->res->code." ".$client->res->default_message;
my $got = $client->res->json;
if ($got && ref $got eq 'HASH' and keys %$got==1 && $got->{text}) {
BIx::Class administrative library
=over
=item * JSON::Any >= 1.22
=item * Moose >= 0.98
=item * MooseX::Types >= 0.21
=item * MooseX::Types::JSON >= 0.02
=item * MooseX::Types::Path::Class >= 0.
tem * Getopt::Long::Descriptive >= 0.081
=item * JSON::Any >= 1.22
=item * Moose >= 0.98
=item * MooseX::Types >= 0.21
=item * MooseX::Types::JSON >= 0.02
=item * MooseX::Types::Path::Class >= 0.
BICConnectInfo DBICHashRef/;
use MooseX::Types::JSON qw(JSON);
use MooseX::Types::Path::Class qw(Dir File);
use Try::Tiny;
use JSON::Any qw(DWIW XS JSON);
use namespace::autoclean;
=head1 NAME
DBIx:
ash ref or json string to be used for identifying data to manipulate
=cut
has 'where' => (
is => 'rw',
isa => DBICHashRef,
coerce => 1,
);
=head2 set
a hash ref or json string to
> (
is => 'rw',
isa => DBICHashRef,
coerce => 1,
);
=head2 attrs
a hash ref or json string to be used for passing additional info to the ->search call
=cut
has 'attrs' => (
is
,
sub {
my $self = shift;
my $client = $self->client;
$client->GET( sprintf( '/videos/%s.json', $self->id ) );
my $data = $client->process_response(404 => sub {
return { is_available =>
as a proxy class for the data returned from a URL
like L<http://api.shutterstock.com/videos/12345.json>. Please look
at that data structure for a better idea of exactly what each of the attributes
in
PI -- KGB bot API documentation
=head1 VERSION 4 (JSON)
=head2 General, authentication
Version 4 uses JSON-RPC as described in
L<http://http://json-rpc.org/wiki/specification> with one extension. S
t-name
=item request-text
This is the JSON-encoded request text. The same that is sent in the HTTP body.
=back
=head2 Commit notification
Request is a JSON-RPC call to a method called B<commit_v4
tocol
=head1 DESCRIPTION
The protocol used by the KGB colaboration service is based on JSON-RPC
(L<http://json-rpc.org/>).
KGB service helps collaboration by relaying notifications about commits in
n a SHA1 hash (in
hexadecimal notation) calculated over the shared secret, the project ID and the
JSON-encoded message.
Upon receiving the HTTP request the server calculates the hash using the
suppli
and problems with the JSON data use HTTP code C<400>.
The error text is in the reason phrase of the HTTP status line (see RFC 2616,
section 6.1).
=head3 Errors reported on JSON-RPC level
After succ
c API
use strict;
use warnings;
use Moo 1;
use REST::Client;
use MIME::Base64;
use JSON qw(encode_json decode_json);
use WebService::Shutterstock::Lightbox;
use WebService::Shutterstock::Client;
use
w( error => "missing 'password' param for auth call");
}
$self->client->POST(
'/auth/customer.json',
{
username => $args{username},
password => $args{password}
}
);
my $auth_info = $se
me}: $auth_info"
);
}
}
sub categories {
my $self = shift;
$self->client->GET('/categories.json');
return $self->client->process_response;
}
sub search {
my $self = shift;
my %args = @_;
},
@args
);
# Send job, data created by encoding @args with JSON
use JSON::XS;
$client->encoder(sub { encode_json(\@_) });
my $job2 = $client->put(
{ priority => 100,
ttr
akeashorterlink makealongerlink);
our $VERSION = '0.1';
use Carp;
use JSON::RPC::Client;
our $RPC_URL = 'http://deb.li/rpc/json';
=head1 Functions
=over
=item B<makeashorterlink>(I<URL>)
The fun
akeashorterlink {
my $url = shift or croak 'No URL passed to makeashorterlink';
my $rpc = JSON::RPC::Client->new();
my $res
= $rpc->call( $RPC_URL => { method => 'add_url', params
or croak 'No key / URL passed to makealongerlink';
$key =~ s,^http://deb.li/,,;
my $rpc = JSON::RPC::Client->new();
my $res
= $rpc->call( $RPC_URL => { method => 'get_url', params
my $self = shift;
my $client = $self->client;
$client->GET( sprintf('/lightboxes/%s/extended.json', $self->id), $self->with_auth_params );
return $client->process_response;
}
);
has id => (
my $self = shift;
my $client = $self->client;
$client->GET( sprintf( '/lightboxes/%s/public_url.json', $self->id ), $self->with_auth_params );
if(my $data = $client->process_response){
return $da
e_id = shift;
my $client = $self->client;
$client->DELETE(
sprintf( '/lightboxes/%s/images/%s.json', $self->id, $image_id ),
$self->with_auth_params( username => $self->username )
);
delete $s
tion via SOAP. Dies on any error or SOAP
FAULT.
=item send_changes_json($message)
Helper method sending commit information via JSON-RPC. Dies on errors.
=back
=cut
require v5.10.0;
use base 'Clas
}
sub relay_message {
my ( $self, $client, $message, $opts ) = @_;
$self->send_changes_json( $client->repo_id,
{ method => 'relay_message', params => [$message, $opts] } );
}
sub s
);
}
}
sub send_changes_json {
my ( $self, $repo_id, $message ) = @_;
require JSON;
require JSON::RPC::Client;
my $rpc = JSON::RPC::Client->new();
$rpc->ua->timeo
ails
=head1 SUBROUTINES/METHODS
=head2 send_mails
Main function, send mail due to a F<birthday.json> file and a given
configuration file
=cut
=head2 verify_mails
It verifies configuration and in
erializer-CompressJSON
#
# This software is copyright (c) 2012 by Weborama. No
# license is granted to other entities.
#
package DBIx::Class::InflateColumn::Serializer::CompressJSON;
{
$DBIx::Class
n::Serializer::CompressJSON::VERSION = '0.004';
}
# ABSTRACT: DBIx::Class::InflateColumn::Serializer::CompressJSON - JSON compressed Inflator
use strict;
use warnings;
use JSON qw//;
use Compress::Z
press( JSON::to_json(shift) );
}
elsif ( $compress_method eq 'mysql' ) {
my $json = JSON::to_json(shift);
$b = pack( 'L', length($json) ) . compress($json);
use warnings;
use Moo;
use WebService::Shutterstock::Subscription;
use Carp qw(croak);
use JSON qw(encode_json);
with 'WebService::Shutterstock::AuthedClient';
sub account_id {
my $self = shift;
ld__info {
my $self = shift;
my $client = $self->client;
$client->GET( sprintf( '/customers/%s.json', $self->username ), $self->with_auth_params );
my $data = $client->process_response;
return $d
ild_subscriptions {
my $self = shift;
$self->client->GET( sprintf( '/customers/%s/subscriptions.json', $self->username ), $self->with_auth_params );
my $subscriptions = $self->client->process_respo
s easy REST interactions with the Shutterstock API
use strict;
use warnings;
use Moo;
use JSON qw(decode_json);
use WebService::Shutterstock::Exception;
extends 'REST::Client';
sub response {
my
} elsif($code <= 299){ # a success
return $content_type =~ m{^application/json} && $self->responseContent ? decode_json($self->responseContent) : $response->decoded_content;
} elsif($code <= 399)
ware, licensed under:
#
# The (three-clause) BSD License
#
package MyBenchmark;
use Moose;
use JSON;
use DateTime;
use MooseX::Attribute::Deflator::Moose;
use MooseX::Attribute::Deflator;
has has
flator'],
default => sub { { foo => 'bar' } }
);
package main;
use strict;
use warnings;
use JSON;
use Benchmark qw(:all);
my $obj = MyBenchmark->new;
my $attr = $obj->meta->get_attribute('hash
> sub {
$attr->deflate($obj);
},
get_value => sub {
JSON::encode_json( $attr->get_value( $obj, 'hashref' ) );
},
accessor => sub {
m
Loading L<MooseX::Attribute::Deflator::Moose>
will cause HashRefs and ArrayRefs to be encoded as JSON strings. However, you can simply overwrite
those deflators (and inflators) to deflate to somethin
C<benchmark.pl> tests three ways of deflating the value of a HashRef attribute
to a json encoded string (using L<JSON>).
my $obj = MyBenchmark->new( hashref => { foo => 'bar' } );
my $attr =
ate($obj);
Using the deflate attribute method, supplied by this module.
=item accessor
JSON::encode_json($obj->hashref);
If the attribute comes with an accessor, you can use this
method, to defl
fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").t
{try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);f
n!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"
$r{$disk}{count} = Yars::Tools->count_files($disk) if $count;
}
return $c->render_json(\%r) unless $c->param('all');
my %all = ( Yars::Tools->server_url => \%r );
for my $serve
$all{$server} = $res->json;
}
return $c->render_json(\%all);
};
=head2 POST /disk/status
Mark disks up or down. Send the disk root and state (up or down)
as JSON encoded in the body.
=c
);
}
$c->render_text($success ? "ok" : "failed" );
};
=head2 POST /check/manifest
Given JSON with 'manifest' which is a return-delimited string
of filenames and md5s (like the output of md5s
on class, which we don't have an instance of, ewwwww
# Also, naughty modules like Catalyst::View::JSON try to write to _everything_,
# so spit a warning, ignore that (and try to do the right thing any