(optional) - the payload for POST updates as XML
RETURNS
The response is requested in JSON format which is then processed into a Perl structure that
is returned to the caller.
=head
::WebMaster::VERSION = '0.400115';
use strict;
use v5.10;
use Moo::Role;
use LWP::UserAgent;
use JSON;
use Data::Dumper;
use File::Path qw(make_path remove_tree);
use BalanceOfPower::Utils qw(prev_t
onse->decoded_content;
}
else
{
my $json = JSON->new->allow_nonref;
return $json->decode( $response->decoded_content );
}
}
else {
PI;
use 5.010001;
use strict;
use warnings;
use Moo;
use Types::Standard qw/Str Object Int/;
use JSON::MaybeXS;
use URI;
use LWP::UserAgent;
=head1 NAME
WWW::Piwik::API - Tracking module for Piwik
my $json = JSON::MaybeXS->new(ascii => 1);
foreach my $k (keys %data) {
my $v = $data{$k};
if (defined $v) {
if (ref($v)) {
$params{$k} ||= $json->enc
(optional) - the payload for POST updates as XML
RETURNS
The response is requested in JSON format which is then processed into a Perl structure that
is returned to the caller.
=cut
r' => '/folder/full/of/json/files',
'extend_with' => ['Store::Dir', 'Value::InfDef'],
'inflate' => sub { JSON::Util->decode($_[0]) },
'deflate' => sub { JSON::Util->encode($_[0]) },
);
my %data = %{$dk->get('abcd.json')};
$dk->set('abcd.json', \%data);
=head1 DESCRIPTION
Uses callback to automatically inflate and deflate.
=cut
use warnings;
use strict;
our $VERSION = '0.0
Builder::WebApi::Object::SqlQuery;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
arget/swagger-codegen-cli.jar generate \
-i [URL or file path to JSON swagger API spec] \
-l perl \
-c /path/to/config/file.json \
-o /path/to/output/folder
Bang, all done. Run the C<autodoc>
se;
use HTTP::Request::Common qw(DELETE POST GET HEAD PUT);
use HTTP::Status;
use URI::Query;
use JSON;
use URI::Escape;
use Scalar::Util;
use Log::Any qw($log);
use Carp;
use Module::Runtime qw(use_m
});
}
# body data
$body_data = to_json($body_data->to_hash) if defined $body_data && $body_data->can('to_hash'); # model to json string
my $_body_data = %$post_params ? $post_pa
return $value->datetime();
}
else {
return $value;
}
}
# Deserialize a JSON string into an object
#
# @param string $class class name is passed as a string
# @param string
uilder::WebApi::Object::Condition;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
_limit_remaining;
=head1 DESCRIPTION
Often, the result of a Twitter API call, inflated from the JSON body of the
HTTP response does not contain all the information you need. Twitter includes
meta da
yBuilder::WebApi::Object::Sorting;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
brary for Twitter's API v1
=head1 VERSION
version 0.12008
=cut
use Carp;
use URI::Escape;
use JSON;
use HTTP::Request::Common;
use Net::Twitter::Lite::Error;
use Encode qw/encode_utf8/;
use Net::T
r.com/1' }
sub _default_lists_api_url () { 'http://api.twitter.com/1' }
my $json_handler = JSON->new->utf8;
sub new {
my ($class, %args) = @_;
$class->can('verify_credentials'
my $uri = URI->new($self->{$options{base_url_method}}
. "/$local_path.json");
return $self->_parse_result(
$self->_authenticated_reques
nputs
my $_resource_path = '/getQueryColumns';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'POST';
my $query_params = {};
my $header_params = {};
tent-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'text/html');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'text/xml');
my $_body_data;
# body params
if ( exists $args{'query'}) {
$
::WebApi::Object::TransformResult;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
ilder::WebApi::Object::Pagination;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
r::WebApi::Object::ConditionGroup;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
ryBuilder::WebApi::Object::Totals;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Date::
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
f
deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^array\[/i) { # array
',
%args,
ua_args => [
$self->_url,
{Accept => 'application/json'},
json => $message,
($args{callback} ? $args{callback} : ()),
],
);
} ## end
se JSON::PP ();
our $VERSION = '0.16';
sub opt_c { shift->_elem('opt_c', @_) }
sub live_cpan_url {
my $self = shift;
my $module = shift;
if ($self->opt_c) {
my $module_json =
ibution");
if (!$module_json) {
die "Unable to fetch changes for $module";
}
my $module_details = JSON::PP::decode_json($module_json);
my $dist = $module_de
e);
my $content = $self->fetch_url($url);
if ($self->opt_c) {
$content = JSON::PP::decode_json($content)->{content};
$content = "=pod\n\n$content";
}
return $content;
DNS 0.06 qw( ERR_NO_HOST ERR_NO_ADDRESS ); # Future return with failure details
use JSON qw( encode_json decode_json );
use URI;
use Socket qw( getnameinfo NI_NUMERICHOST SOCK_RAW );
use constant DE
ef $params{content} ) {
$req->content( encode_json( delete $params{content} ) );
$req->header( Content_type => "application/json" );
}
else {
$req->content( dele
);
}
=head2 request_json
( $body, $response ) = $client->request_json( ... )
A small wrapper around C<request> that decodes the returned body as JSON.
=cut
sub request_json
{
my $self = shi