package Catmandu::Store::REST::Bag;
use Moo;
use JSON;
use Catmandu::Sane;
use Catmandu::Store::REST::API;
with 'Catmandu::Bag';
has api => (is => 'lazy');
sub _build_api {
my $self = shift;
dowsocks rfc1928 Great Firewall Internet censorship in China
#
# Modify the config.json sample, save it to config.json. Run ssserver.pl on
# server, run ssclient.pl on localhost. Config your browser t
through the great firewall of
# china.
use 5.006;
use strict;
use warnings;
use Getopt::Std;
use JSON;
use Net::Shadowsocks::Client;
my $version = "0.9.3.2";
sub main::HELP_MESSAGE()
{
print("U
ctr rc6-256-ofb\n");
print("\tspritz\n");
printf("\t-c CONFIG\t\tFull path of your config.json file\n");
print("\t-h, --help\t\tDisplay this help screen\n");
print("\t-v, --version\t\t
dowsocks rfc1928 Great Firewall Internet censorship in China
#
# Modify the config.json sample, save it to config.json. Run ssserver.pl on
# server, run ssclient.pl on localhost. Configure your browse
through the great firewall
# of china.
use 5.006;
use strict;
use warnings;
use Getopt::Std;
use JSON;
use Net::Shadowsocks::Server;
my $version = "0.9.3.2";
sub main::HELP_MESSAGE()
{
print("U
c6-256-ctr rc6-256-ofb\n");
print("\tspritz\n");
printf("\t-c CONFIG\tName of your config.json file with full path\n");
print("\t-h, --help\tDisplay help information\n");
print("\t-v,
ndler = $args->{handler};
my $index = $args->{dir_index};
my $enable_json = $args->{enable_json};
my $auto_index = $args->{auto_index} // 1;
my $css = $args->{css}
$c->stash(css => $css),
render_indexes( $c, $path, $render_opts, $enable_json )
unless ( $c->tx->res->code );
}
}
}
);
$c->reply->asset($asset);
}
sub render_indexes {
my ( $c, $dir, $render_opts, $enable_json ) = @_;
my @files =
( $c->req->url eq '/' )
? ()
: ( { url => '../',
>{aesKeyString}) }
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->{hmacK
strict;
use warnings;
use Try::Tiny;
use Path::Class;
use JSON;
eval { require JSON::XS; };
our $json = JSON->new->pretty;
sub json { $json }
use DBIx::NoSQL::Model;
has database => qw/ is ro /;
h
package Catmandu::Store::REST::API;
use Catmandu::Sane;
use Moo;
use JSON;
use LWP::UserAgent;
has base_url => (is => 'ro', required => 1);
has query_string => (is => 'ro');
has client => (is
my $response = $self->client->get($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return {};
} else
$url = $self->mk_url();
my $json_data = encode_json($data);
my $response = $self->client->post($url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_su
Keyczar::Util qw(json_true json_false);
use Carp;
sub new {
my $class = shift;
my ($version, $status, $exportable) = @_;
my $self = bless {
exportable => json_false(),
my $json_string = shift;
my $obj = from_json($json_string);
return bless $obj, $class;
}
sub exportable {
my $self = shift;
$self->{exportable} = $_[0] ? json_true() : json_false
() if @_;
return $self->{exportable} eq json_true() ? 1 : undef;
}
sub status {
my $self = shift;
if (@_) {
if (uc $_[0] eq 'ACTIVE') {
$self->{status} = uc $_[0];
return $expose;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->{publi
self->store->json->decode( $value );
return $data;
}
sub serialize {
my $self = shift;
my $data = shift;
return $data if ! ref $data;
my $value = $self->store->json->encode( $da
on
1;
__END__
=encoding utf-8
=head1 NAME
Catmandu::Store::REST - Store/retrieve items from a JSON REST-API endpoint
=head1 SYNOPSIS
# From the command line
$ catmandu export REST --id 1234
tore|http://librecat.org/Catmandu/#stores>.
The module allows you to use a RESTful API that uses JSON as data format and uses the URL format
C<[base_url]/[id][query_string]> as a I<Store> for I<Catma
and deleting (C<DELETE>) single items is
supported. Data must be provided as JSON by the API, and the API must accept JSON for C<PUT>/C<POST>
requests. The URL must be of the format C<[base_url]/[id]
package Catmandu::Adlib::API;
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
use JSON;
use Catmandu::Adlib::API::Login;
use Catmandu::Adlib::API::QueryBuilder;
has username => (is => 'ro',
my $json = decode_json($response->decoded_content);
# If there are multiple results for the same object_id, I'm gonna turn violent.
return $self->get_by_priref($self->get_priref($json->{'ad
;
my $response = $self->ua->get($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return [];
} else
;
use AC::Yenta::Conf;
use AC::DC::Protocol;
use AC::Import;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Digest::SHA 'sha1';
use Socket;
use strict;
require 'AC/protobuf/yenta_check.pl';
require '
me->{server_file});
local $/ = "\n";
while(<$f>){
chop;
my $data = decode_json( $_ );
next unless grep { $_ eq $map } @{ $data->{map} };
if( $data->{is_local} )
caffold::Schema::VERSION = '0.0021';
use Moose;
extends qw/ DBIx::Class::Schema /;
use JSON; our $json = JSON->new->pretty;
use Digest::SHA qw/ sha1_hex /;
has store => qw/ is rw weak_ref 1 /;
has
ings;
use utf8;
package Amon2::Auth::Site::Facebook;
use Mouse;
use LWP::UserAgent;
use URI;
use JSON;
use Amon2::Auth;
sub moniker { 'facebook' }
for (qw(client_id scope client_secret)) {
has $_
ecoded_content;
return $callback->{on_error}->($res->decoded_content);
};
my $dat = decode_json($res->decoded_content);
if (my $err = $dat->{error}) {
return $callback->{on_error}->($err);
$res->is_success or return $callback->{on_error}->($res->status_line);
my $dat = decode_json($res->decoded_content);
push @args, $dat;
}
return $callback->{on_finished}->(@args)
->new('config' => 'ironmq.json');
my $queue = $client->create_and_get_queue( 'name' => $queue_name );
run_me( { 'backend' => 'IronMQ', 'options' => { 'config' => 'ironmq.json' } } );
run_me( {
'backend' => 'IronMQ',
'options' => {
'config' => 'ironmq.json',
'queue' => $queue_name,
},
} );
$client->delete_queue( 'name' => $queue_name );
done_tes
);
use Data::Dumper;
use Convert::Base64;
use HTTP::Request::Common;
use LWP::UserAgent;
use JSON;
require Exporter;
$NB_API_VERSION = '3.1';
our $VERSION = '0.07';
our @ISA = qw(Ex
t($req);
if($result->is_success && $result->{_content} ne '') {
my $response=decode_json($result->{_content});
if(defined($response->{error}) || (defined($response->{success}) &
t($req);
if($result->is_success && $result->{_content} ne '') {
my $response=decode_json($result->{_content});
if(defined($response->{error}) || (defined($response->{success}) &
VERSION = '0.002'; # VERSION:
#pod =pod
#pod
#pod =encoding utf8
#pod
#pod =for stopwords IronMQ JSON config
#pod
#pod =cut
# Dependencies
use Moose;
use IO::Iron::IronMQ::Client 0.12;
use IO::Iron
#pod =attr config
#pod
#pod IronMQ uses a JSON config file to hold the project_id and token,
#pod and other config items if necessary. By default F<iron.json>.
#pod These config items can also be wri
pplied.
#pod
#pod =cut
has config => (
is => 'ro',
isa => 'Str',
default => 'iron.json',
);
#pod =attr queue
#pod
#pod Name of the queue. Must be supplied.
#pod
#pod =cut
has queue =
n $old;
}
sub TO_JSON {
my ($self) = @_;
my $json = {};
if ( defined $self->blocked() ) {
$json->{blocked} = $self->blocked() + 0;
}
else {
$json->{blocked} = _DOE
$self->dns() ) {
$json->{dns} = $self->dns() + 0;
}
else {
$json->{dns} = _DOES_NOT_APPLY();
}
if ( defined $self->connect() ) {
$json->{connect} = $self->conne
else {
$json->{connect} = _DOES_NOT_APPLY();
}
$json->{send} = ( $self->send() || 0 ) + 0;
$json->{wait} = ( $self->wait() || 0 ) + 0;
$json->{receive} = ( $sel
b TO_JSON {
my ($self) = @_;
my $json = {};
$json->{method} = $self->method();
$json->{url} = $self->url();
$json->{httpVersion} = $self->http_version();
$json->{c
$self->cookies() ];
$json->{headers} = [ $self->headers() ];
$json->{queryString} = [ $self->query_string() ];
if ( defined $self->post_data() ) {
$json->{postData} = $self->po
_size() ) {
$json->{bodySize} = $self->body_size();
if ( $self->body_size() == 0 ) {
delete $json->{postData};
}
}
else {
$json->{bodySize} = _DOES_