;
use Moose;
extends 'Net::Fluidinfo::Value::Native';
# A Perl integer is a JSON integer. Sanitize with int().
sub to_json {
my $self = shift;
no warnings; # the value may not be an integer i
strict;
use warnings;
use Config::Tiny;
use LWP::Authen::OAuth2;
use JSON qw(decode_json encode_json);
use JSON::Parse 'valid_json';
use Carp qw(croak);
use File::Basename;
use File::MimeInfo::Magic;
);
my $json = $response->decoded_content;
if (! valid_json($json) ) {
croak("Something went wrong, a JSON string wasn't returned");
}
if ($ENV{STRAVA_DEBUG}) {
say Dumper($json);
}
return decode_json($json);
}
method delete_api($api_path) {
my $response = $self->auth->delete($self->{api_base}.$api_path);
if ($ENV{STRAVA_DEBUG}) {
say Dumper($response);
}
return $r
luidinfo::Value';
use Carp;
use Net::Fluidinfo::JSON;
use MooseX::ClassAttribute;
class_has json => (is => 'ro', default => sub { Net::Fluidinfo::JSON->new });
# In the future more serialisation for
ddb.value+json';
sub mime_type {
$MIME_TYPE;
}
sub is_mime_type {
my ($class, $mime_type) = @_;
defined $mime_type && $mime_type eq $MIME_TYPE;
}
sub new_from_fin_type_and_json {
my
($class, $fin_type, $json) = @_;
my $native_class = $class->class_for_fin_type($fin_type);
$native_class->new(value => $class->json->decode($json));
}
# Fluidinfo types of native values are
package Net::Fluidinfo::Value::Null;
use Moose;
extends 'Net::Fluidinfo::Value::Native';
sub value {
undef;
}
sub to_json {
'null';
}
no Moose;
__PACKAGE__->meta->make_immutable;
1;
= 'fluiddb.fluidinfo.com';
our $SANDBOX_HOST = 'sandbox.fluidinfo.com';
our $JSON_CONTENT_TYPE = 'application/json';
has protocol => (is => 'rw', isa => 'Str', default => $DEFAULT_PROTOCOL);
has
s_for_json {
return {
'Accept' => $JSON_CONTENT_TYPE,
'Content-Type' => $JSON_CONTENT_TYPE
};
}
sub accept_header_for_json {
return {
'Accept' => $JSON_CONTE
NT_TYPE
}
}
sub content_type_header_for_json {
return {
'Content-Type' => $JSON_CONTENT_TYPE
}
}
#
# -- Convenience shortcuts ----------------------------------------------------
package WebService::Linode::Base;
use warnings;
use strict;
use Carp;
use JSON;
use LWP::UserAgent;
use Data::Dumper;
=head1 NAME
WebService::Linode::Base - Perl Interface to the Linode.com API.
if ($response->content =~ m|ERRORARRAY|i) {
my $json = from_json($response->content);
if (scalar (@{$json->{ERRORARRAY}}) == 0) {
return $json->{DATA};
} else {
# TODO this only returns t
API
my $msg = "API Error " .
$json->{ERRORARRAY}->[0]->{ERRORCODE} . ": " .
$json->{ERRORARRAY}->[0]->{ERRORMESSAGE};
$self->_error(
$json->{ERRORARRAY}->[0]->{ERRORCODE},
$
ooseX::Types::DateTime;
# ABSTRACT: Perl wrapper for talking with Bullfinch
use Data::UUID;
use JSON::XS;
use Memcached::Client;
use Net::Bullfinch::Iterator;
has '_client' => (
is => 'rw',
onal => 1 }
);
my ($rname, $json) = $self->_prepare_request($data, $queuename, $trace, $procby);
my $kes = $self->_client;
$kes->set($queue, $json, $expire);
my @items = ();
if(defined($resp)) {
$kes->get($rname.'/close');
my $decoded = decode_json($resp);
if(exists($decoded->{EOF})) {
last;
}
ault
codec for a directory or filesystem.
$directory->codec('json');
$file = $directory->file('foo.json'); # has json codec set
=head1 AUTHOR
Andy Wardley L<http://wardley.org/>
=he
},
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
$class->
h
);
}
);
}
sub update {
my $self = shift;
my $payload = $self->json->encode({policy => $self->policy, exceptions => $self->exceptions});
$self->fin->put(
path),
query => { action => $self->action },
headers => $self->fin->headers_for_json,
payload => $payload
);
}
no Moose;
no MooseX::ClassAttribute;
__PACKAGE__->meta->ma
_url => $self->url,
trace => $self->debug
);
$client->enable('Format::JSON');
$client->enable('Auth::Basic', username => $self->username, password => $self->passwor
, mail (team inbox).
item tags
List of tags to be added to the message. Can be either an array (JSON only) or a string with tags delimited with commas. User tags should start with '@'. Hashtags can
:ConfigLoader::General>
L<Catalyst::Plugin::ConfigLoader::INI>,
L<Catalyst::Plugin::ConfigLoader::JSON>,
L<Catalyst::Plugin::ConfigLoader::Perl>,
L<Catalyst::Plugin::ConfigLoader::XML>, and
L<Catalyst
> files
and Maketext classes under your application's I18N namespace.
=head2 L<Catalyst::Plugin::JSONRPC>
=head2 L<Catalyst::Plugin::Message>
=head2 L<Catalyst::Plugin::MobileAgent>
=head2 L<Catal
ering pages with L<HTML::Template>.
=head2 L<Catalyst::View::Jemplate>
=head2 L<Catalyst::View::JSON>
=head2 L<Catalyst::View::Mason>
A view component for rendering pages with L<HTML::Mason>.
=he
such as PDF documents, e-mails, spreadsheets,
or even "behind the scenes" formats such as XML and JSON.
=item * Controller
As suggested by its name, the controller takes user requests and routes
the
ally for
display in the user's web browser (but can generate other types of
output such as PDF or JSON). The code in C<lib/MyApp/View> selects the
I<type> of view to use, with the actual rendering te
my $self = shift;
my $payload = $self->json->encode({
description => $self->description,
indexed => $self->as_json_boolean($self->indexed),
name => $se
ders => $self->fin->headers_for_json,
payload => $payload,
on_success => sub {
my $response = shift;
my $h = $self->json->decode($response->content);
ts,
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $t =
rate a JSON structure suitable for loadJSON classes
=head1 SYNOPSIS
use HTML::InfoVis;
my $graph = HTML::InfoVis::Graph->new;
$graph->add_edge( 'foo' => 'bar' );
print "var json = " .
$graph->as_json . "\n";
=head1 DESCRIPTION
HTML::InfoVis::Graph is used to generate a JSON structure suitable for loading
by any InfoVis Javascript object that has the C<loadJSON> method.
This is a
raph, and a single method
for generating an anonymous JSON structure representing the graph.
=head1 METHODS
=cut
use 5.006;
use strict;
use JSON 2.16 ();
use Graph 0.85 ();
our $VERSION = '0.03';
rict;
use warnings;
use v5.10;
use FindBin '$Bin';
use lib "$Bin/../lib";
use Net::LastFMAPI;
use JSON::XS;
use YAML::Syck;
die "usage: $0 user.whatEver something=nothing nothing=Some Things etc=etc\
MooseX::ConfigFromFile";
use JSON 2.0;
sub get_config_from_file {
my($file) = @_;
open my $fh, "<", $file or confess "open: $file: $!";
local $/;
my $json = <$fh>;
close $fh or di
e "close: $file: $!";
return JSON->new->relaxed->utf8->decode($json);
}
}
use Data::Munge;
use IO::File;
use IPC::Run ();
use Term::ReadKey ();
use Term::ReadLine;
use Text::Balanced ();
use Try
;
use warnings;
our $VERSION = '0.01';
use Carp;
use Data::Dumper qw( Dumper );
use Encode;
use JSON;
use HTTP::Request;
use LWP::UserAgent;
use Params::Validate;
use URI;
sub new {
my($class,
de_utf8( $destinations ) : $destinations;
my $url = sprintf "%s://%s/maps/api/distancematrix/json",
( $self->{https} ? 'https' : 'http' ), $self->{host};
my $uri = URI->new($url);
type !~ /json/ ) {
my $ct = $res->headers->content_type;
croak "Invalid content-type '$ct' returned from webserver";
}
my $json = JSON->new->utf8;
my $data = $json->decode
astFMAPI;
use strict;
use warnings;
use v5.10;
use LWP::UserAgent;
use Digest::MD5 'md5_hex';
use JSON::XS;
use YAML::Syck;
use File::Slurp;
use File::Path 'make_path';
use File::HomeDir 'my_home';
us
y $file = shift;
my $json = encode_json(shift);
write_file($file, $json);
}
sub loadfile {
my $file = shift;
my $json = read_file($file);
decode_json($json);
}
#{{{
our $methods =
}
}
$params{method} = $method;
$params{api_key} = $api_key;
$params{format} = "json" unless $params{format} || $xml;
delete $params{format} if $params{format} && $params{format}
e only available class is
L<HTML::InfoVis::Graph>, which assists in generation InfoVis-compatible
JSON graph dumps.
=cut
use 5.006;
use strict;
use HTML::InfoVis::Graph ();
our $VERSION = '0.03';