package Blitz::API;
use strict;
use warnings;
use LWP;
use Blitz;
use JSON;
use MIME::Base64;
=head1 NAME
Blitz::API - Perl module for API access to Blitz
=cut
=head1 SUBROUTINES/METHODS
=head2
-API-Client' => 'Perl',
);
return $response;
}
=head2 _decode_response
Decodes the JSON result object from Blitz
Decodes base64 response in content areas of request and response
=cut
'server';
$return->{cause} = $response->code();
}
else {
$return = decode_json($response->{_content});
for my $key ('request', 'response') {
if ($return->{r
use strict;
use warnings;
use Blitz;
use Blitz::API;
use Blitz::Validate;
use MIME::Base64;
use JSON::XS;
use LWP;
use Storable qw(dclone);
=head1 NAME
Blitz::Exercise - Superclass for Sprint and
::Deferred> options, but the
gist is:
my $json = $stack->freeze({ format => 'JSON' });
...
my $stack = Message::Stack->thaw($json, { format => 'JSON' });
=head1 ATTRIBUTES
=head2 messages
Re
package RPC::Any::Server::JSONRPC::PSGI;
use strict;
use warnings;
use Moose;
extends 'RPC::Any::Server::JSONRPC::HTTP';
with 'RPC::Any::Interface::PSGI';
__PACKAGE__->meta->make_immutable;
1;
__E
ND__
=head1 NAME
RPC::Any::Server::JSONRPC::PSGI - JSON-RPC server for a PSGI environment
=head1 SYNOPSIS
# in app.psgi
use RPC::Any::Server::JSONRPC::PSGI;
# Create a server where calling
Foo.bar will call My::Module->bar.
my $server = RPC::Any::Server::JSONRPC::PSGI->new(
dispatch => { 'Foo' => 'My::Module' },
allow_get => 0,
);
my $handler = sub{ $server->handle_i
v perl
use Mojolicious::Lite;
use Mojolicious::Plugin::Geo;
plugin 'geo';
get '/google_is_where' => sub {
my $self = shift;
$self->render({ json => $self->geo('8.8.8.8') });
};
app->start;
use strict;
use warnings;
use Blitz;
use Blitz::API;
use Blitz::Validate;
use MIME::Base64;
use JSON::XS;
use LWP;
use Storable qw(dclone);
=head1 NAME
Blitz::Exercise - Superclass for Sprint and
package Blitz::API;
use strict;
use warnings;
use LWP;
use Blitz;
use JSON;
use MIME::Base64;
=head1 NAME
Blitz::API - Perl module for API access to Blitz
=cut
=head1 SUBROUTINES/METHODS
=head2
-API-Client' => 'Perl',
);
return $response;
}
=head2 _decode_response
Decodes the JSON result object from Blitz
Decodes base64 response in content areas of request and response
=cut
'server';
$return->{cause} = $response->code();
}
else {
$return = decode_json($response->{_content});
for my $key ('request', 'response') {
if ($return->{r
be reinitialized
* to zero.
*
* Finally, the output buffer is usually just a pointer into the jsonText,
* however in cases where the entity being lexed spans multiple chunks,
* the lexer will bu
performance.
*/
yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText,
size_t jsonTextLen, size_t * offset,
const unsigned char ** outBuf,
xer forward */
yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText,
size_t jsonTextLen, size_t offset);
typedef enum {
yajl_lex_e_ok = 0,
yajl_lex_
:
=over 4
=item * JSON
=item * XML
=item * YAML
=item * HTML
=back
=cut
sub format {
my $self = shift;
if (@_) {
my $new = shift;
if ( $new !~ /^JSON|XML|YAML|HTML$/ )
rp "Invalid format. Must be one of JSON, XML, YAML, or HTML.";
return;
}
$self->{format} = $new;
}
return $self->{format} || "JSON";
}
=item mime_type
This return
carp "format() needs to be set";
return;
}
return "application/json" if $self->format eq "JSON";
return "text/xml" if $self->format eq "XML";
return "application/
h
*
* Parses JSON data and returns the data in tree form.
*
* \author Florian Forster
* \date August 2010
*
* This interface makes quick parsing and extraction of
* smallish JSON docs trivial:
x02
/** A pointer to a node in the parse tree */
typedef struct yajl_val_s * yajl_val;
/**
* A JSON value representation capable of holding one of the seven
* types above. For "string", "number",
} array;
} u;
};
/**
* Parse a string.
*
* Parses an null-terminated string containing JSON data and returns a pointer
* to the top-level value (root of the parse tree).
*
* \param input
TH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* \file yajl_parse.h
* Interface to YAJL's JSON stream parsing facilities.
*/
#include <yajl_common.h>
#ifndef __YAJL_PARSE_H__
#define __YAJL
pedef struct yajl_handle_t * yajl_handle;
/** yajl is an event driven parser. this means as json elements are
* parsed, you are called back to do something with the data. The
* func
size_t numberLen);
/** strings are returned as pointers into the JSON text when,
* possible, as a result, they are _not_ null padded */
int (* yajl_st
ts (as a hash ref) of:
=over 4
=item * format => $format
The valid format of the mssage, eithe JSON, YAML, XML, or HTML.
=item * content => $content
The decoded content from the HTTP response.
=
d $args{request_time};
if ( $args{format} eq "JSON" ) {
require JSON;
JSON->import('decode_json');
my $hash = decode_json( $args{content} );
$self->job_id( $hash->
package Crashplan::Client::User;
use strict;
use warnings;
use JSON;
our $VERSION = '0.003_0';
=head1 NAME
Crashplan::Client::User - Object representation of Crashplan PROe server's entity
=head1
rent object
my @attributes = grep {!/^rest|rest_header$/} keys %$self;
my $body = encode_json( { map {$_ => $self->{$_}} @attributes} );
$self->{rest}->PUT($self->url."/".$self->id,$body
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* \file yajl_gen.h
* Interface to YAJL's JSON generation facilities.
*/
#include <yajl_common.h>
#ifndef __YAJL_GEN_H__
#define __YAJL_GEN_H
ed while in an error
* state */
yajl_gen_in_error_state,
/** A complete JSON document has been generated */
yajl_gen_generation_complete,
/**
* Set a function and context argument that should be used to
* output generated json. the function should conform to the
* yajl_print_t prototype while the context argument
package FeedHandler;
use parent qw(Tatsumaki::Handler);
__PACKAGE__->asynchronous(1);
use JSON;
sub get {
my($self, $query) = @_;
my $client = Tatsumaki::HTTPClient->new;
Tatsumaki::Error::HTTP->throw(500);
}
my $json = JSON::decode_json($res->content);
$self->write("Fetched " . scalar(@{$json->{entries}}) . " entries from API");
$self->finis
def,
);
has output_format => (
is => 'ro',
isa => Str,
default => 'json',
init_arg => undef,
);
has output_info => (
is => 'ro',
isa => Arr
# RFC 2045, RFC 2046
'js' => 'text/javascript', # RFC 4329
'json' => 'application/json', # RFC 4627
'pdf' => 'application/pdf', # RFC 3778
'png
he following classes inherit directly from L<GX::Serializer>:
=over 4
=item * L<GX::Serializer::JSON>
=item * L<GX::Serializer::Storable>
=back
=head1 AUTHOR
JE<ouml>rg A. Uzarek E<lt>uzarek@run
r;
use strict;
use AnyEvent;
use Carp ();
use Encode ();
use Any::Moose;
use MIME::Base64 ();
use JSON;
use Tatsumaki::Error;
has application => (is => 'rw', isa => 'Tatsumaki::Application');
has con
=> (is => 'rw', isa => 'Str', lazy => 1, lazy_build => 1);
has json => (is => 'rw', isa => 'JSON', lazy => 1, default => sub { JSON->new->utf8 });
has binary => (is => 'rw', isa => 'Bool');
ha
$_[0]) {
if ($self->mxhr) {
my $json = $self->json->encode($_[0]);
return "Content-Type: application/json\n\n$json\n--" . $self->mxhr_boundary. "\n";
} else {
aFastCGI;
my $loop = IO::Async::Loop->new;
my $model = EntityModel->new->load_from(JSON => { file => 'model.json' });
my $tmpl = EntityModel::Template->new;
$tmpl->process_template(\'[% PROCESS T