VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('Format::XML');
=head1 DESCRIPTION
Net::HTTP::Spore::Middleware::Format:
ions are available:
=over 4
=item * as => $format
Possible values: (rr|ro|objects|string|jsonobjects|jsonrows|count)
The format to request results in.
=over 8
=item * C<rr> ResultRows (default)
L<Webservice::InterMine::ResultObject>s will be returned (it is a
synonym for C<< as => "jsonobjects", json => "inflate" >>).
=item * C<objects> Instantiated L<InterMine::Model> objects.
Fully in
selected, then the results will be unparsed tab delimited rows.
=item * json[objects|rows] - raw data structures
The two json formats allow low-level access to the data-structures returned
by the we
Plugin::ExtJS::VERSION = '1.000001';
}
# ABSTRACT: Convert paginated DBIx::Class::ResultSet's to JSON-style structures
use strict;
use warnings;
require Exporter;
use Scalar::Util 'blessed';
use b
xt_paginate {
my $self = shift;
my $resultset = shift;
my $method = shift || 'TO_JSON';
return $self->ext_parcel(
[map { blessed($_) ? $_->$method : $_ } $resultset->all],
ass::ResultSet's to JSON-style structures
=head1 VERSION
version 1.000001
=head1 SYNOPSIS
use CGI::Application::Plugin::ExtJS ':all';
sub people {
# ...
my $json = $self->ext_pagina
s.
=head1 Method: build_structure($root)
Returns a Perl data structure which can be turned into JSON.
The -data_structure option to scripts/tree.pl gives you access to this feature.
=head1 Method:
Mine::Role::KnowsJSON;
use Moose::Role;
use JSON -support_by_pp;
has json => (
isa => 'JSON',
is => 'ro',
lazy_build => 1,
handles => ['decode'],
);
sub _build_json {
my $self =
shift;
# Be as generous as possible to input.
return JSON->new->relaxed->allow_singlequote->allow_barekey->allow_nonref;
}
1;
;
{
$App::Cerberus::VERSION = '0.10';
}
use strict;
use warnings;
use JSON();
use Carp;
use Plack::Request;
our $json = JSON->new->utf8;
#===================================
sub new {
#==========
nown error' );
}
return [
200,
[ 'Content-Type' => 'application/json' ],
[ $json->encode($response) ]
];
}
1;
# ABSTRACT: A pluggable Perl web service to preproc
l with just your own
code.
A query to L<App::Cerberus> is a simple HTTP GET, and the response is JSON.
=head1 PLUGINS
=head2 L<App::Cerberus::Plugin::GeoIP>
Uses L<Geo::IP> with the L<GeoLite City
ed.
When -data_structure is used, the program displays a data structure suitable for encoding in JSON.
When not used (and -copy is not used), the program pretty-prints the menu. This is the default
impractical to hold in memory.
Parameters:
=over 4
=item as => tsv|csv|arrayrefs|hashrefs|jsonobjects|jsonrows|count:
How each line should be returned.
=item size => Int:
How many results to retur
iendly/path:
Whether to add headers to the output (default: false)
=item json => inflate|instantiate|perl:
How to handle json (default: perl)
=item %parameters:
The template parameters
=back
Retur
erator_with {
my $self = shift;
my %args = @_;
my @keys = qw/as size start addheaders json/;
my @values = delete(@args{@keys});
my $clone = $self->get_adjusted_template(%args);
;
require Set::Object;
use constant {
LIST_APPEND_PATH => '/lists/append/json',
RENAME_PATH => '/lists/rename/json',
LISTABLE => 'Webservice::InterMine::Role::Listable',
LIST => 'Webs
ot . ENRICHMENT_PATH);
my $iterator = $self->service->get_results_iterator($uri, \%form, [], "json", "perl", []);
return $iterator;
}
=head2 to_query
Return a L<Webservice::InterMine::Query>
le opened for writing.
=item * as => $format
Possible values: (tsv|csv|arrayrefs|hashrefs|jsonobjects|jsonrows|count)
The format to print results in. The default is C<tsv>
=item * size => $size
T
m * json => $json_processor
Possible values: (inflate|instantiate|perl)
What to do with JSON results. The results can be returned as inflated objects,
full instantiated Moose objects, a raw json str
ost(
$service->build_uri($service->root . '/ids'),
'Content-Type' => 'application/json',
'Content' => $service->encode($self->as_submission)
);
if ( $resp->is_error ) {
hift;
return 1 if $self->completed;
$self->_backoff;
my $data = $self->service->fetch_json('/ids/' . $self->uid . '/status');
$self->_register_poll;
my $status = $data->{status};
r this job.
=cut
sub fetch_results {
my $self = shift;
my $data = $self->service->fetch_json('/ids/' . $self->uid . '/result');
return $data->{results};
}
=head2 delete()
Delete this j
N = '1.123130';
}
use strict;
use warnings;
use Moo;
use Sub::Quote;
use Method::Signatures;
use JSON::XS;
use LWP::UserAgent;
use HTTP::Request::Common;
use XML::Simple;
# ABSTRACT: Connect to the
'x'
);
print "$uri\n" if $self->debug;
my $res;
my $type = ref $content eq 'HASH' ? 'json' : 'xml';
if($method =~ /get/i){
if(ref $content eq 'HASH') {
$uri->query_form($conte
pplication/json',
Content_Type => 'application/json',
);
} else {
#$content = $self->_template($content) if $content;
if($type eq 'json') {
print "Encoding as JSON\n" if $se
terating over rows of results.
The formats that are supported by the possible values service
are jsonobjects (the default), and count formats. However, for accessing
counts, and even values, it is pr
my $format = shift || 'jsonobjects';
my $service = $self->{service};
my $uri = $service->root . $service->POSSIBLE_VALUES_PATH;
require JSON;
my $json = JSON->new;
my $params =
{
path => $self->{path},
typeConstraints => $json->encode($self->{subtypes}),
};
my $iter = $service->get_results_iterator(
$uri, $params, [], $format, 'perl', []);
Listables
ListOperable ListOfListOperables
RowParser
RowFormat
JsonFormat
RequestFormat
TSVFormat
File
NotAllLowerCase
Date
'jsonobjects', 'jsonrows', 'jsondatatable', 'count', 'json'];
enum JsonFormat, ['perl', 'inflate', 'instantiate'];
enum RequestFormat, ['tab', 'csv', 'count', 'jsonobjects', 'jsonrows', 'xml', 'jsond
atatable', 'json'];
subtype TSVFormat, as Str, where {/^tsv$/i};
class_type ResultIterator, {class => 'Webservice::InterMine::ResultIterator'};
coerce RowFormat, from NotAllLowerCase, via { lc($_) }
use Moose;
with 'Webservice::InterMine::Role::Serviced';
with 'Webservice::InterMine::Role::KnowsJSON';
use Webservice::InterMine::List;
use Webservice::InterMine::Types qw(List ListOperable File Li
=> '/lists/json',
DELETION_PATH => '/lists/json',
UNION_PATH => '/lists/union/json',
INTERSECTION_PATH => '/lists/intersect/json',
SUBTRACTION_PATH => '/lists/subtract/json',
DIFF
ERENCE_PATH => '/lists/diff/json',
LIST_TAG_PATH => '/list/tags/json',
};
=head2 get_list( $name ) -> List
Get the list with the given name, if it exists. Returns undef
if the given list is not
my $self = shift;
my $constraints = shift;
my $results_args = shift || {as => 'jsonobjects', json => 'instantiate'};
if (ref $constraints eq 'HASH') {
while (my ($path, $con) =
expressions or strings will cause exceptions to be thrown.
=head2 results([as => $format], [json => $jsonhandler])
Gets the results for this query in a variety of formats. (see
L<Webservice::InterM
item * jsonobjects
By default returns an arrayref of native perl data structures (hashrefs) which
correspond to the data format of InterMine jsonobjects
(L<http://www.intermine.org/wiki/JSONObjectF
ormat>).
Optionally it can return the jsonobjects processed as:
=over 8
=item * raw: the raw text string
=item * inflate: inflated objects using autoload
The inflated objects allow method access
se Webservice::InterMine::Path;
use Webservice::InterMine::Model;
my @JSON_FORMATS = (qw/jsonobjects jsonrows jsondatatable json/);
my @SIMPLE_FORMATS = (qw/tsv tab csv count xml/);
=head2 new( $url
'/query/upload',
QUERY_LIST_PATH => '/query/tolist/json',
QUERY_LIST_APPEND_PATH => '/query/append/tolist/json',
MODEL_PATH => '/model',
TEMPLATES_PAT
ate/upload',
TEMPLATE_LIST_PATH => '/template/tolist/json',
TEMPLATE_LIST_APPEND_PATH => '/template/append/tolist/json',
VERSION_PATH => '/version',
RELEASE_PAT
ice::InterMine::Role::KnowsJSON';
use LWP::UserAgent;
use Webservice::InterMine::Types qw/UserAgent/;
use constant REGISTRY => 'http://www.intermine.org/registry/mines.json';
has ua => (
is => '
HTML::FormHandler and JQuery Validator
=head1 VERSION
0.05
=cut
our $VERSION = '0.05';
use JSON;
use URI::Escape;
use Moose::Role;
=head1 SYNOPSIS
use HTML::FormHandler::Moose;
with HTML:
input type="hidden" id="validation_json" value="[% form.as_escaped_json %]">
<script>
var validationJSON = JSON.parse(decodeURIComponent($("#validation_json").val() ) );
$("#story_form")
tionJSON.rules,
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
messages: validationJSON.me