Moose;
use JSON;
use UUID::Tiny ':std';
has 'json' => (is => 'rw', isa => 'JSON');
has 'json_data' => (is => 'rw', isa => 'HashRef[Ref]');
sub BUILD {
my $self = shift;
$self->json(JSON->new->utf
8);
$self->json->convert_blessed(1);
$self->json->allow_blessed(1);
$self->json_data({});
my $v1_mc_UUID = create_uuid();
$self->json_data->{format} = {
id => "b744635a-9d6b-11e3-8ec0-da765d6aa
4db",
multiple => JSON::false,
};
$self->json_data->{result} = {
data => {
network_interfaces => [],
#firewall => {},
#bridges => {},
routes => [],
nameservers => [],
openports
=item C<json>
a JSON encoder object.
=back
=head1 METHODS
=head2 B<init()>
=cut
sub init {
my ($self, %arg_hash) = @_;
my $arg_hash = Eve::Support::arguments(\%arg_hash, my $json);
$self->{'_json'} = $json;
$self->{'_id'} = undef;
$self->SUPER::init(%{$arg_hash});
return;
}
=head2 B<_read()>
This method is called when the graph node or connection is requested
wi
ntent-Type', value => 'text/javascript');
$self->_response->set_body(
text => $self->_json->encode(reference => $reference));
return;
}
=head1 SEE ALSO
=over 4
=item L<Eve::HttpRes
st::Psgi;
use parent qw(Eve::HttpRequest);
use strict;
use warnings;
use Hash::MultiValue;
use JSON::XS;
use Plack::Request;
=head1 NAME
B<Eve::HttpRequest::Psgi> - an HTTP request adapter for th
t_type() eq 'application/json') {
$self->_body_parameters = Hash::MultiValue->new(
%{$self->cgi->query_parameters()->as_hashref_mixed()},
%{JSON::XS->new()->utf8()->dec
croak);
use URI::Escape;
use Digest::MD5 qw(md5_hex);
use Socket;
use WWW::Curl::Easy;
use JSON qw(decode_json);
our $VERSION = '0.02';
sub new {
my $class = shift;
my $self = bless({}, $cla
. uri_escape($value));
}
}
# add default params
push(@request_params, "f=json");
my ($http_code, $buffer) = $self->_query_api(join("&", @request_params));
#
my $decoded_json = decode_json($buffer);
if(not defined $decoded_json->{'success'}) {
warn "unable to read json";
return 1;
} elsif($decoded_json->{'success'} == 0) {
ZMQ::Declare::ZDCF::Validator;
use ZMQ::Declare::ZDCF::Encoder;
use ZMQ::Declare::ZDCF::Encoder::JSON;
use ZeroMQ qw(:all);
use ZMQ::Declare::Constants qw(:all);
use ZMQ::Declare::Types;
use Carp (
s => 'rw',
isa => 'ZMQ::Declare::ZDCF::Encoder',
default => sub {ZMQ::Declare::ZDCF::Encoder::JSON->new},
);
has 'tree' => (
is => 'rw',
required => 1,
);
sub BUILD {
my $self = shift;
m
ion (File)
=head1 SYNOPSIS
use ZMQ::Declare;
my $zdcf = ZMQ::Declare::ZDCF->new(tree => $json_zdcf_filename);
# Alternatively
my $zdcf = ZMQ::Declare::ZDCF->new(
encoder => ZMQ::Decla
ict;
use warnings;
our $VERSION = '0.07';
use Moose;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
has 'authen_url' => (
is => 'ro',
isa => 'Str',
required => '1',
default => sub
new;
my $uri = $self->authen_url."?username=$username";
my $json_hash = { value => $password };
my $json = to_json( $json_hash );
my $req = HTTP::Request->new( 'POST', $uri );
$re
sword}
);
$req->header('Accept' => 'application/json');
$req->header('Content-Type' => 'application/json');
$req->content( $json );
my $response = $ua->request( $req );
return
se;
use JSON::Any;
use Method::Signatures;
use Carp;
use Moose::Util::TypeConstraints;
# ABSTRACT: Raw, low-level access to Exobrain packets
our $VERSION = '1.08'; # VERSION
my $json = JSON::Any->
s[0];
my (undef, $namespace, $source) = split(/_/, $frames->[0]);
my $metadata = $json->decode( $frames->[1] );
return $class->$orig(
namespace => $namespace,
es},
summary => $frames->[2],
data => $json->decode( $frames->[3] ),
raw => $json->decode( $frames->[4] ),
nosend => 1,
);
}
%full_args );
# Make our call, and decode the resulting JSON.
$self->mech->get("$base/$path?$arguments");
return $self->json->decode( $self->mech->content );
}
1;
__END__
=pod
=hea
package Exobrain::Foursquare;
use Moose;
use Exobrain::Config;
use JSON::Any;
use Try::Tiny;
use feature qw(say);
# ABSTRACT: Foursquare components for Exobrain
our $VERSION = '0.01'; # VERSION
with
ize->new( autocheck => 1 );
my $json = JSON::Any->new;
$mech->get("$FOURSQUARE_API/checkins/recent?oauth_token=$token&v=20130425");
my $status = $json->decode($mech->content);
if ($
N
Inherits from
L<ZMQ::Declare::ZDCF::Encoder>.
Implements a Storable encoder/decoder. Use the JSON encoder instead unless
you absolutely require Storable.
=head1 SEE ALSO
The ZDCF RFC L<http://r
rg/spec:5>
L<ZMQ::Declare::ZDCF>
L<ZMQ::Declare::ZDCF::Encoder>,
L<ZMQ::Declare::ZDCF::Encoder::JSON>
L<ZeroMQ>
=head1 AUTHOR
Steffen Mueller E<lt>smueller@cpan.orgE<gt>
=head1 COPYRIGHT AND LIC
::Declare::ZDCF::Encoder>.
Implements an encoder/decoder using Data::Dumper and eval.
Prefer the JSON encoder unless you have no choice -- this one can execute
arbitrary input code thanks to the eval
nings;
use JSON::Any;
# ABSTRACT: Type system for Exobrain
our $VERSION = '1.08'; # VERSION
my $json = JSON::Any->new( allow_blessed => 1 );
use MooseX::Types -declare => [qw(
JSON
POI
HashRef
Ref
Str
Num
Int
);
subtype JSON,
as Str,
where { $json->decode($_) }
;
coerce JSON,
from Ref,
via { $json->encode($_) }
;
subtype SmsStr,
as Str,
wh
ersion numbers so we'll
see how that pans out.
=head1 METHODS
=cut
use Carp;
use DateTime;
use JSON 2.0;
use LWP::UserAgent;
use URI::Escape;
use WWW::Jawbone::Up::Feed;
use WWW::Jawbone::Up::Scor
{ua}->request($request);
croak $response->status_line if $response->is_error;
return decode_json($response->decoded_content);
}
sub __encode {
my ($hash) = @_;
return join '&',
map spr
my $json = $self->_post(
URI_BASE . '/user/signin/login', {
service => 'nudge',
email => $email,
pwd => $password,
});
if ($json->{error}) {
carp $json->{erro
rd::VERSION = '0.02';
use Moose;
# ABSTRACT: https://pinboard.in/ API client
use HTTP::Tiny;
use JSON::PP;
use URI;
has token => (
is => 'ro',
isa => 'Str',
required => 1,
)
n, format => 'json');
return $uri;
},
);
has ua => (
is => 'ro',
isa => 'HTTP::Tiny',
lazy => 1,
default => sub { HTTP::Tiny->new },
);
has json => (
is
=> 'ro',
isa => 'JSON::PP',
lazy => 1,
default => sub { JSON::PP->new },
);
for my $method (qw(update add delete get recent dates all suggest)) {
__PACKAGE__->meta->add_me
WW::JSONAPI;
use 5.006;
use strict;
use warnings FATAL => 'all';
use LWP;
use HTTP::Request;
use JSON;
use Carp;
=head1 NAME
WWW::JSONAPI - Very thin and inadequate wrapper for JSON API
;
=head1 SYNOPSIS
This module contains utterly minimal functionality for interacting with JSON-based REST services with or without SSL.
It resulted from my development of L<WWW::KeePassRest>,
and has the purpose of providing a very thin but convenient
abstraction layer on top of LWP and JSON for that API. Other than those, it has no dependencies.
Version 0.01 contains only those methods
package WWW::KeePassRest;
use 5.006;
use strict;
use warnings FATAL => 'all';
use WWW::JSONAPI;
use File::ShareDir;
use Carp;
=head1 NAME
WWW::KeePassRest - use KeePass for secure local
rest>
KeePassRest exposes a minimal API on localhost:12984, secured by SSL and accessed with a JSON API.
You can't do everything with it (you can't generate passwords, work with groups of entries,
$cert_file" unless -e $key_file;
my $port = $opts{port} || 12984;
$self->{json} = WWW::JSONAPI->new(cert_file => $cert_file,
key_file => $key_f
ckage WWW::Jawbone::Up::Score;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_subclass(move => 'WWW::Jawbone::Up::Score::Move');
__PACKAGE__->add_subclass
ackage WWW::Jawbone::Up::Tick;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_accessors(
qw(distance active_time aerobic calories steps time speed));
1;
JSON
HTTP::Request
);
my $json = JSON();
my $ua = UserAgent();
my $req = Request( GET => 'http://www.example.com/foo.json' );
my $data = $json->decode
object instantiation in Perl. The example in
the SYNOPSIS creates three functions C<UserAgent>, C<JSON> and <Request> each
of which just pass through their arguments to the real object constructors.
WW::Jawbone::Up::Score::Sleep;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_accessors(qw(awakenings light awake time_to_sleep));
sub bedtime {
my $sel