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
ute;
use MojoX::Log::Log4perl;
use Log::Log4perl qw/:easy/;
use File::Temp;
use JSON::MaybeXS qw( encode_json decode_json );
use Carp qw( carp );
use Mojo::Util qw( monkey_patch );
# ABSTRACT: Constr
$meta && $meta->get("skip_existing");
$body = encode_json $arg;
$headers = { 'Content-Type' => 'application/json' };
} elsif (ref $arg eq 'CODE') {
$cb = $s
||= 'application/json';
if($body && ref $body eq 'HASH' || ref $body eq 'ARRAY')
{
$headers->{'Content-Type'} = 'application/json';
$body = encode_json $body;
}
r
=> '无',
rule => [],
},
]);
$c->render( json => {
result => 'false',
messages => $result->errors
}) if $result
package Data::Riak::Fast;
use Mouse;
use JSON::XS qw/decode_json/;
use URI;
use Data::Riak::Fast::Result;
use Data::Riak::Fast::ResultSet;
use Data::Riak::Fast::Bucket;
use Data::Riak::Fast::MapRed
@parts
],
}
);
}
sub _buckets {
my $self = shift;
return decode_json(
$self->send_request({
method => 'GET',
uri => '/buckets',
,
uri => $request_str
});
}
sub stats {
my $self = shift;
return decode_json(
$self->send_request({
method => 'GET',
uri => '/stats',
mplates;
use Mojo::ByteStream qw/b/;
use Data::Dumper;
use Clustericious::Log;
use Mojo::URL;
use JSON::XS;
use Scalar::Util qw/weaken/;
use Mojo::Base 'Mojolicious';
use File::HomeDir ();
use Cluste
HomeDir->my_home . "/etc", "/util/etc", "/etc" );
{
no warnings 'redefine';
sub Math::BigInt::TO_JSON {
my $val = shift;
my $copy = "$val";
my $i = 0 + $copy;
return $i;
}
}
=head2 $
we can do the work associated with it!
$job->process();
The job data must be serializable to JSON, and it is recommended that you use a hash for it. See below for a list of the supported job opti
ck::App::Prack::Worker;
use strict;
use warnings;
use Time::HiRes;
use File::Temp ':POSIX';
use JSON;
use IO::Socket::UNIX;
use Plack::App::Prack::Request;
my $NACK = 'Nack::Server.run(ARGV[0], :fi
= $sock->getline;
# could be a stack trace
if ($p !~ /^\d+$/) {
my $stack = decode_json $p;
die "$stack->{name}: $stack->{message}";
}
$self->{sock} = $sock;
$self->{
package Plack::App::Prack::Request;
use strict;
use warnings;
use JSON;
use Plack::App::Prack::Response;
my @ENV_KEYS = qw/REQUEST_METHOD PATH_INFO QUERY_STRING
SERVER_NAME SERVE
ift;
return length($data).":".$data.",";
}
sub write {
my $self = shift;
my $env = encode_json($self->_filter_env($self->{env}));
my $input = "";
my $buf = "";
while ($self->{env}->{'p
alled" } = $sub };
$sub->($self);
}
package Clustericious::Config::Callback;
use JSON::MaybeXS qw( encode_json );
sub new
{
my($class, @args) = @_;
bless [@args], $class;
}
sub args { @{ sh
sub execute { '' }
sub to_yaml
{
my($self) = @_;
"!!perl/array:@{[ ref $self ]} @{[ encode_json [@$self] ]}";
}
package Clustericious::Config::Callback::Password;
use base qw( Clustericious::
=head1 DESCRIPTION
Clustericious::Config reads configuration files which are Mojo::Template's
of JSON or YAML files. There should generally be an entry for
'url', which may be used by either a clien
cation/json" },
qq[{ "app": "<%= $class %>", "version" : "$<%= $class %>::VERSION" }])
->status_is(200, "posted version");
$t->get_ok('/clustericious/<%= $class %>')
->json_conten
package Net::WURFL::ScientiaMobile::Cache::Cookie;
use Moo;
use JSON qw(decode_json encode_json);
use Plack::Request;
with 'Net::WURFL::ScientiaMobile::Cache';
has 'cookie_name' => (is => 'rw
return 0 unless $request->cookies->{$self->cookie_name};
my $cookiedata = eval { decode_json($request->cookies->{$self->cookie_name}) };
return 0 unless ref $cookiedata eq 'HASH';
re
abilities => $capabilities,
};
$self->cookies({
$self->cookie_name => encode_json($data),
});
}
sub setDeviceFromID { 1 }
sub getMtime { 0 }
sub setMtime { 1 }
helper called 'parse_autodata' that handles incoming data by
Content-Type.
Supports application/json, text/x-yaml and
application/x-www-form-urlencoded (in-bound only).
When parse_autodata is calle
Accept header, the Content-Type header, or the default. (By
default, the default is application/json, but you can override that
too).
=head1 TODO
more documentation
handle XML with schemas
handl
';
use JSON::XS;
use YAML::XS qw/Dump Load/;
use Clustericious::Log;
my $default_decode = 'application/x-www-form-urlencoded';
my $default_encode = 'application/json';
my $json_encoder = JSON::XS->
s : given the plural of a table, look up the name of the class
The route that is created turns a JSON structure which is POSTed into
parameters for Rose::DB::Object::Manager::get_objects.
Additional
turns that
resultset to the client.
=cut
package Clustericious::RouteBuilder::Search;
use Mojo::JSON;
use Clustericious::Log;
use List::MoreUtils qw/uniq/;
use Data::Dumper;
use strict;
use Sub::Ex
PTION
This app will fork a ruby process that can handle rack requests.
Requests are converted to JSON and sent over a unix socket as a
netstring, a response is then read and used as the psgi response
ers + hosts to buckets for yars.
our $VERSION = '1.33'; # VERSION
use strict;
use warnings;
use JSON::MaybeXS ();
use Getopt::Long qw( GetOptions );
use Pod::Usage qw( pod2usage );
use feature 'say'
$_, buckets => $servers{$host}{$_} }, keys %{ $servers{$host} }
]};
}
my $out = JSON::MaybeXS->new->space_after->encode({ servers => \@conf });
$out =~ s/{/\n{/g;
$out =~ s/\
get($bucket_map_url);
if(my $res = $tx->success)
{
my %server_bucket_map = %{ $res->json };
my %my_bucket_map = %{ $yars->tools->bucket_map };
foreach my $key (keys %m
# cope with invalid (missing required q parameter) header like:
# application/json; charset="utf-8"
# http://tools.ietf.org/html/rfc2616#section-14.1
unless
ing it REST methods and attributes.
=head1 SYNOPSIS
if ( $c->request->accepts('application/json') ) {
...
}
my $types = $c->request->accepted_content_types();
=head1 DESCRI
package Catalyst::Action::Serialize::JSONP;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Action::Serialize::JSON';
our $VERSION = '1.06';
$VERSION = eval $VERSION;
after 'execute' => sub
.$c->res->output().');');
} else {
warn 'Callback: '.$callback_value.' will not generate valid Javascript. Falling back to JSON output';
}
}
};
__PACKAGE__->meta->make_immutable;
1;
EST-y subclass of Catalyst::Request
=head1 SYNOPSIS
if ( $c->request->accepts('application/json') ) {
...
}
my $types = $c->request->accepted_content_types();
=head1 DESCRI
ia Type" error. What gives?!
A: Most likely, you haven't set Content-type equal to "application/json", or
one of the accepted return formats. You can do this by setting it in your query
accepted re
mats. You can do this by setting it in your query string
thusly: C<< ?content-type=application%2Fjson (where %2F == / uri escaped). >>
B<NOTE> Apache will refuse %2F unless configured otherwise.
Mak