$Net::HTTP::Spore::VERSION = '0.05';
}
# ABSTRACT: SPORE client
use Moose;
use IO::All;
use JSON;
use Carp;
use Try::Tiny;
use Scalar::Util;
use Net::HTTP::Spore::Core;
# XXX should we let the
bject ) = @_;
my $spec;
try {
$spec = JSON::decode_json($string);
}
catch {
Carp::confess( "unable to parse JSON spec: " . $_ );
};
try {
$opts->{base
m_spec('twitter.json');
# for identica
my $client = Net::HTTP::Spore->new_from_spec('twitter.json', base_url => 'http://identi.ca/com/api');
$client->enable('Format::JSON');
my $tim
Digest::MD5 'md5_hex';
use Moose;
use MooseX::Method::Signatures;
use MooseX::ClassAttribute;
use JSON;
use URI::Encode qw(uri_encode);
use LWP::UserAgent;
use Date::Parse;
use YAML qw(LoadFile DumpFi
$res->code != 200
and $self->log->logdie( "Unable to contact Toodledo\n");
my $ref = decode_json( $res->content )
or $self->log->logdie( "Content invalid\n");
$self->log->logdie( $ref->{e
trict;
use warnings;
our $VERSION = '1.00';
use base qw(Exporter);
use File::HomeDir qw();
use JSON;
our @EXPORT_OK = qw(debug toodledo_encode toodledo_decode toodledo_time
arg_encode home
PP_TOODLEDO_DEBUG};
}
sub arg_encode
{
local $_ = shift;
s/\n/\\n/g;
ref $_
? encode_json( $_ )
: $_;
}
sub toodledo_encode
{
local $_ = shift;
s/&/%26/g;
s/;/%3B/g;
$_;
}
1;
__END__
=head1 NAME
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 METHODS
=head2 arg_encode
JSON encoding for parameters submitted to the API.
=head2 home
User's home directory. Broken out so
WOW_ARENA_TEAM_2 WOW_ARENA_TEAM_3 WOW_ARENA_TEAM_5
);
use URI::Escape;
use LWP::UserAgent;
use JSON::XS;
use constant WOW_REGIONS =>
{
us => { api_host => 'us.battle.net' , locales => [
= $self->{ua}->get($url);
#return undef if !$res->is_success;
my $data = eval { decode_json $res->decoded_content };
return $@ ? undef : $data;
}
__PACKAGE__->_init_package;
1;
=hea
}
# ABSTRACT: Interface for a Google Storage Object
# https://developers.google.com/storage/docs/json_api/v1/objects#resource
use Moose;
use Net::Google::Storage::Types;
has id => (
is => 'ro',
toring the data of an object, slightly cut down from
L<https://developers.google.com/storage/docs/json_api/v1/objects#resource>.
Generally Net::Google::Storage::Object objects are acquired from a
C<g
formation about the file itself - check out the
L<docs|https://developers.google.com/storage/docs/json_api/v1/objects#resource>.
=head2 contentEncoding
The content encoding of the object's data.
=h
=> 'ro',
isa => 'HashRef',
auto_deref => 1,
default => sub { { wt => 'json' } }
);
has 'last_response' => (
is => 'rw',
isa => 'Maybe[WebService::Solr::Response]'
{
$options->{ default_params }
= { %{ $options->{ default_params } }, wt => 'json', };
}
return $options;
}
sub add {
my ( $self, $doc, $params ) = @_;
my @docs
VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('DoNotTrack');
=head1 DESCRIPTION
Add a header B<x-do-not-track> to your
ore->new_from_spec('twitter.json');
$client->enable('Format::JSON');
my $res = $client->public_timeline();
# $res->body contains an hashref build from the JSON returned by the API
=head1
he appropriate format (eg: if payload contains an hashref, and the format is json, the hashref B<MUST> be serialized to JSON).
=head1 METHODS
=over 4
=item serializer_key
name of the extension ser
hotspots
immutabilize
immutabilizes
immutabilized
inline
inlines
invocant
invocant's
irc
IRC
isa
JSON
login
namespace
namespaced
namespaces
namespacing
OO
OOP
ORM
overridable
parameterizable
paramete
CT: Access the Google Storage JSON API (currently experimental).
# https://developers.google.com/storage/docs/json_api/
use Moose::Role;
use LWP::UserAgent 6.04;
use JSON;
use URI::Escape 3.29;
has
});
die 'Failed to refresh the access token' unless $res->is_success;
my $response = decode_json($res->decoded_content);
$self->access_token($response->{access_token});
$self->access_token_exp
>post(@_);
return $res;
}
sub _json_post
{
my $self = shift;
my $args = pop;
return $self->_post(@_, 'Content-Type' => 'application/json', Content => encode_json($args));
}
sub _delete
{
my $
VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('UserAgent', useragent => 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b4) Gecko
);
# Content-Type: application/json
use JSON::XS;
$client->header('Content-Type', 'application/json')
->post(
encode_json({ foo => 1 }),
sub {
= @_;
# ...
}
);
$client->header('Accept', 'application/json')
->query({ key => 'value' })
->query('key', 'value')
->get(
esponse;
use Any::Moose;
use WebService::Solr::Document;
use Data::Page;
use Data::Pageset;
use JSON::XS ();
has 'raw_response' => (
is => 'ro',
isa => 'Object',
handles => {
>raw_response->content;
return {} unless $content;
my $rv = eval { JSON::XS::decode_json( $content ) };
### JSON::XS throw an exception, but kills most of the content
### in the diagn
m * raw_response - the raw L<HTTP::Response> object.
=item * content - a hashref of deserialized JSON data from the response.
=item * docs - an array of L<WebService::Solr::Document> objects.
=item
;
my $response = Net::HTTP::Spore::Response->new(
200, ['Content-Type', 'application/json'], '{"foo":1}';
);
$response->request($request);
=head1 DESCRIPTION
Net::HTTP::Spore::R
hen the body is sets for the first time.
=item content_type
$res->content_type('application/json');
my $ct = $res->content_type;
Gets or sets the content type of the response body
=item co
ype' => 'application/json']);
Gets or sets HTTP response headers.
=item header
my $cl = $res->header('Content-Length');
$res->header('Content-Type' => 'application/json');
Shortcut for C<<
}
# ABSTRACT: Interface for a Google Storage Bucket
# https://developers.google.com/storage/docs/json_api/v1/buckets#resource
use Moose;
use Net::Google::Storage::Types;
has id => (
is => 'ro',
storing the data of a bucket, slightly cut down from
L<https://developers.google.com/storage/docs/json_api/v1/buckets#resource>.
Generally Net::Google::Storage::Bucket objects are acquired from a
C<g
f of the owner details for the bucket - see
L<the docs|https://developers.google.com/storage/docs/json_api/v1/buckets#resource>.
=head2 location
Physical location of the servers containing this buck
package Net::DiffBot;
use 5.006;
use strict;
use warnings;
use LWP::UserAgent;
use JSON::XS;
use URI::Escape qw(uri_escape);
use HTTP::Request;
my $endpoint_url = 'http://www.diffbot.com/api/article
my $data;
eval {
$data = decode_json($response->content);
};
if ($@) {
warn "ERROR decoding JSON response";
return undef;
}
my $data;
eval {
$data = decode_json($response->content);
};
if ($@) {
warn "ERROR decoding JSON response";
return undef;
}
ad1 VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('api.json');
$client->enable(
'Auth::Header',
header_name => 'X-API-Auth',
hea
t::TLS;
require bytes;
use Carp qw(croak);
use Encode;
use Scalar::Util 'looks_like_number';
use JSON::Any;
our $VERSION = '0.10';
has certificate => (
is => 'rw',
isa => 'Str |
clearer => 'clear_handler',
);
has json_driver => (
is => 'rw',
isa => 'Object',
lazy => 1,
default => sub {
JSON::Any->new( utf8 => 1 );
},
);
has on_
sub send {
my $self = shift;
my ($token, $payload, $expiry) = @_;
my $json = encode_utf8( $self->json_driver->encode($payload) );
# http://developer.apple.com/library/ios/#DOCUMENT
TP::Request->new( 'POST', $server);
my $ua = new LWP::UserAgent;
my $cheader = 'application/xdi+json';
if ($context) {
$cheader .= ';contexts=1';
}
$request->header('accept' => $cheader);
$req
", $response->status_line;
return undef;
}
}
sub _xdi_response {
my ($json) = @_;
my $struct = XDI::_decode($json);
if (defined $struct) {
my $tuple = XDI::pick_xdi_tuple($struct,['$false$
is a JSON encoded representation of the nodes requested in the $get operation. Other
operations will return an empty hash {} upon success. Default behavior is to automatically convert
the JSON to a
dumper => sub { Convert::Bencode_XS::bencode($_[0]) }
# or maybe
use JSON::PC;
dumper => sub { JSON::PC::convert($_[0]) }
=item B<connect>
This option is only useful if you want