VERSION
version 0.01
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('Format::Text');
=head1 DESCRIPTION
Net::HTTP::Spore::Middleware::Format
_payload:
# Parameters: none
# Returns : self as JSON formatted for BSC REST call
#
sub get_payload {
my $self = shift;
my $json = new JSON->canonical->allow_blessed->convert_blessed;
m
y $payload = '{"vyatta-interfaces-dataplane:dataplane":'
. $json->encode($self)
. '}';
$payload =~ s/firewall/vyatta-security-firewall:firewall/g;
$payload =~ s/inlist/in/g;
ode::NC);
use HTTP::Status qw(:constants :is status_message);
use URI::Escape qw(uri_escape);
use JSON -convert_blessed_universally;
use Brocade::BSC;
use Brocade::BSC::Status qw(:constants);
=head1
ense;
use Carp;
use YAML::Any ();
=encoding utf8
=head1 NAME
Lim - Framework for RESTful JSON/XML, JSON-RPC, XML-RPC and SOAP
=head1 VERSION
Version 0.20
=cut
our $VERSION = '0.20';
our $CONFI
verify_require_client_cert => 1,
ca_path => '/etc/lim/ssl/certs'
},
json => {
pretty => 0
}
},
agent => {
config_file => '',
u
over multiple protocols.
It uses AnyEvent for async operations and SOAP::Lite, XMLRPC::Lite and JSON::XS
for processing protocol messages.
There are 3 parts in Lim that can work independenly, a Ser
strict;
use warnings;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(Firewall);
use JSON -convert_blessed_universally;
#-----------------------------------------------------------------
====
#
=item B<as_json>
# Returns : pretty-printed JSON string representing Firewall object.
=cut ===================================================================
sub as_json {
my $self =
shift;
my $json = new JSON->canonical->allow_blessed->convert_blessed;
return $json->pretty->encode($self);
}
# Method ===============================================================
#
# Pa
use Carp;
use Search::OpenSearch;
use Search::OpenSearch::Result;
use Data::Dump qw( dump );
use JSON;
use Time::HiRes qw( time );
use Scalar::Util qw( blessed );
use Try::Tiny;
our $VERSION = '0.30
},
);
}
# no-op for back-compat
sub setup_engine { }
my %formats = (
'XML' => 1,
'JSON' => 1,
'ExtJS' => 1,
'Tiny' => 1,
);
sub log {
my $self = shift;
warn(@_);
}
||= $params->{format} || 'JSON';
if ( !exists $formats{ $args{t} } ) {
$self->log("bad format $args{t} -- using JSON");
$args{format} = 'JSON';
}
if (
="screenshot">
=end html
=head2 Protocol
The data transmitted over the websocket connection is JSON in each frame:
=over 4
=item * Startup
{"program":$str,"program_args":...}
Same as L</progr
h::OpenSearch;
use Search::OpenSearch::Result;
use Plack::Request;
use Data::Dump qw( dump );
use JSON;
use Scalar::Util qw( weaken );
use Time::HiRes qw( time );
our $VERSION = '0.301';
sub log {
quest;
use LWP::Protocol::https;
use Business::OnlinePayment::BitPay::KeyUtils;
use JSON;
use JSON::Parse 'parse_json';
require IO::Socket::SSL;
use Net::SSLeay;
use Data::Dumper;
sub new {
my $c
$token;
$response = post($self, path => "invoices", params => $content);
my $data = parse_json($response->content)->{'data'};
return %{$data};
}
sub get_invoice{
my $self = shift;
{'public'};
my $response = get($self, path => $path, public => $public);
my $data = parse_json($response->content)->{'data'};
return %{$data};
}
sub get{
my $self = shift;
my %opt
package WWW::SuperMan;
use Slurp;
use JSON;
use LWP::UserAgent;
our $VERSION = 0.01;
sub new {
my($class, %cnf) = @_;
my $self = bless {
user => $cnf{ user },
pass => $cnf{ pass },
u
},
password => $self->{ pass }
}
);
return {} unless $res->is_success;
return _deJson( $res );
}
sub getCode {
my ( $self, $img_file ) = @_;
my $url = 'http://api2.sz789.net:88/R
uccess;
return _deJson( $res );
}
sub _deJson {
my $res = shift;
my $json = $res->content;
eval {
$json = from_json( $json );
};
return {} if $@;
return $json;
}
1;
__END__
=he
package Search::OpenSearch::Result;
use Moose;
use JSON;
use overload
'""' => sub { $_[0]->stringify; },
'bool' => sub {1},
fallback => 1;
use namespace::autoclean;
our $VERSION =
{
my $self = shift;
#Data::Dump::dump($self);
my $json = encode_json( {%$self} );
#warn "json=$json";
return $json;
}
1;
__END__
=head1 NAME
Search::OpenSearch::Result - RES
item doc
=item success
=item msg
=item total
=back
=head2 stringify
Returns the object as a JSON-encoded string.
=head1 AUTHOR
Peter Karman, C<< <karman at cpan.org> >>
=head1 BUGS
Please re
->all_mason_args} ,%$args};
return $self->html($as,$file);
}
use Switch;
use Data::Dumper;
use JSON::Any;
use XML::Simple;
use Text::CSV::Slurp;
sub printct {
print $_[0]->sprintct($_[1], $_[2])
# coerentemente con il tipo di content-type di uscita
# supportato per ora, text, html, xml, json
#
my $ct = shift || $self->container->_mason->apache_req->content_type;
my $pl2html = sub
my $pl2text = sub { return Data::Dumper::Dumper($_[0]) };
my $pl2json = sub { my $obj = JSON::Any->new; return $obj->objToJson($_[0]) };
my $pl2xml = sub { return XMLout($_[0]) };
my $pl2csv
"LWP::UserAgent";
use Carp ( );
use Readonly;
use String::CamelCase qw( camelize );
use URI;
use JSON;
use Mouse;
use Smart::Args;
use Class::Load qw( try_load_class );
use WebService::ChatWorkApi::R
GENT => sprintf "%s/%s", __PACKAGE__, $VERSION;
Readonly my $CODEC => JSON->new;
Readonly my $BASE_URL => "https://api.chatwork.com/v1/";
Readonly my $BASE_RESPO
package StreamRoot::Manifest;
use strict;
use warnings;
use WWW::Curl::Easy;
use JSON;
our $VERSION = '0.03';
sub new {
my $class = shift;
my $self = {};
$self->{token} = shift||undef;
^2/) {
decode_json($content) if $content !~ /^$/;
}else{
if ($self->{curl}->getinfo(CURLINFO_HTTP_CODE) =~ /^4/) {
decode_json($content) if $content !~
="screenshot">
=end html
=head2 Protocol
The data transmitted over the websocket connection is JSON in each frame:
=over 4
=item * Startup
{"program":$str,"program_args":...}
Same as L</progr
ed data structures - exports clone()
use Readonly; # for truly constant constants
use JSON; # for dealing with JSON strings
use List::MoreUtils qw( uniq ); # for array deduplication
use Type::Tiny; #
in use.
# config - a config hashref.
# config_json - a config as a JSON string (requires that the JSON
# module be installed)
# rng - an object
on is called in an invalid way, called with
# invalid args, or called with a JSON string when JSON is not
# installed.
# Notes : The order of preference for word sources
rnings;
package WebService::ChatWorkApi::Response;
use parent "HTTP::Response";
use Carp ( );
use JSON;
use HTTP::Status qw( HTTP_NO_CONTENT );
sub _gen_accessor {
my $class = shift;
my $key
hift;
no strict "refs";
*{ "$class\::$key" } = sub { shift->get( $key ) };
}
sub codec { JSON->new }
sub limit { shift->header( "X-RateLimit-Limit" ) }
sub remaining { shift->header( "X-Rat
ontent;
=head1 DESCRIPTION
This module provides a few methods to represent ChatWork REST API spec.
Two most things are:
1. response is a JSON
2. 204 No Content at response list is empty (Not []).
b "$Bin/../lib";
use File::Tail; # libfile-tail-perl
use HTTP::Tiny; # libhttp-tiny-perl
use JSON; # libjson-perl
# PODNAME: station-devmon
# ABSTRACT: station-devmon - Monitor Syslog for device eve
d";
my $json = to_json($device);
my %post_data = (
content => $json,
'content-type' => 'application/json',
'content-length' => length($json),
);
ERSION
my $files = File::ShareDir::Tarball::dist_dir( 'App-EventStreamr' );
set serializer => 'JSON';
# logging
set logpath => "$ENV{HOME}/.eventstreamr"; # need collect this somehow..
set logger
matches
post '/settings/:mac' => sub {
my $data->{mac} = params->{mac};
$data->{body} = from_json(request->body);
if ($data->{mac} eq "$self->{config}{macaddress}") {
my $manager = $self->{
-------------
# Post JSON content to restart an individual device eg: {"id":"dvswitch"}
post '/command/:command' => sub {
my $command = params->{command};
my $data = from_json(request->body);
in
package Marathon;
use 5.006;
use strict;
use warnings;
use LWP::UserAgent;
use JSON::XS;
use Marathon::App;
use Marathon::Group;
use Marathon::Events;
use Marathon::Deployment;
=head1 NAME
Marathon
tp://mesosphere.github.io/marathon/docs/rest-api.html), so it can be used without having to write JSON by hand.
For the most common tasks, there is a helper method in the main module. Some additional
( $status ) {
$status = '?status='.$status;
}
my $task_obj = $self->_get_obj_from_json('/v2/tasks'.$status);
my $task_arrayref = ( defined $task_obj && exists $task_obj->{tasks} &&
package Marathon::Group;
use strict;
use warnings;
use parent 'Marathon::Remote';
use JSON::XS;
sub new {
my ($class, $conf, $parent) = @_;
my $self = bless {};
$conf = {} unless $conf &
/v2/groups', $self->get_updateable_values);
if ( $response ) {
$self->version( decode_json($response)->{version} );
return $self;
}
return undef;
}
sub update {
my ($
f->id . $self->_uri_args($args), $payload);
if ( $response ) {
$self->version( decode_json($response)->{version} );
return $self;
}
return undef;
}
sub delete {
my ($