}
}) ];
}
sub search_tiny {
args_pos my $self, my $title;
my $titles = $self->api->json({
req => 'TitleSearch',
search => $title,
limit => 15,
})->{Title
k::App::DAIA;
use Scalar::Util qw(reftype blessed);
use HTTP::Request::Common;
use Test::JSON::Entails;
use JSON;
sub test_daia {
my $app = daia_app(shift) || do {
__PACKAGE__->builder->o
=');
$app = sub {
my $id = shift;
my $url = $baseurl.$id."&format=json";
my @daia = eval { DAIA->parse($url) };
if (!@daia) {
$@
al $Test::Builder::Level = $Test::Builder::Level + 2;
my $json = decode_json( $daia->json );
entails $json, $expected, $test_name;
}
return $daia;
}
}
1;
Test::More;
use Plack::App::DAIA::Test;
use Scalar::Util qw(reftype blessed);
use Test::JSON::Entails;
use JSON;
use Carp;
sub provedaia {
my ($suite, %args) = @_;
my $test = __PACKAGE__->
my $json = undef;
my %vars = ( server => $args{server} );
my @ids;
@ids = @{$args{ids}} if $args{ids};
my $run = sub {
my $server = $vars{server} or return;
$json ||=
my $test_json = $json;
$vars{id} = $id;
$test_json =~ s/\$([a-z]+)/defined $vars{$1} ? $vars{$1} : "\$$1"/emg;
$test_json = decode_json($test_json);
es via filename.
If C<$filename> ends in C<.json> or C<.js>, the file is assumed to be in JSON
format, and will be parsed with a freshly C<require>d C<JSON> module.
Otherwise, it is assumed to be an
lename (Storable / JSON / eval?)
if ($filename =~ m{ \. (json|js) $ }xms) {
require JSON; # should use JSON::XS if available
require File::Slurp;
my $json = File::Slurp::re
ad_file($filename);
return JSON->new->utf8->allow_nonref->decode($json);
} else {
# Storable
require Storable;
my $dom = Storable::retrieve($filename);
retu
'; #VERSION
use v5.10.1;
use parent 'Plack::Component';
use LWP::Simple qw(get);
use Encode;
use JSON;
use DAIA;
use Scalar::Util qw(blessed);
use Try::Tiny;
use Plack::Util::Accessor qw(xslt root wa
is
returned in. By default the formats C<xml> (DAIA/XML, the default), C<json>
(DAIA/JSON), and C<rdfjson> (DAIA/RDF in RDF/JSON) are supported. Additional
RDF serializations (C<rdfxml>, C<turtle>, an
MATS->{html} = 'DAIA/HTML';
$FORMATS->{json} = 'DAIA/JSON';
$FORMATS->{xml} = 'DAIA/XML';
$FORMATS->{rdfjson} = 'DAIA/RDF (JSON)';
$FORMATS->{turtle} = 'DAIA/RDF (Turtl
fieldset(label('Input: ',
popup_menu('in',['','json','xml'],'',
{''=>'Guess','json'=>'DAIA/JSON','xml'=>'DAIA/XML'})
)).
fieldset('either', label('
b} } keys %$FORMATS ],
$outformat, $FORMATS )
), ' ',
label('JSONP Callback: ', textfield(-name=>'callback',-value=>$callback))
).
fieldset('<input typ
return undef unless -f -r -s $passworddb;
require Haineko::JSON;
try {
$credential = Haineko::JSON->loadfile( $passworddb );
} catch {
$exceptions =
psgi.
=head1 SYNOPSIS
use Haineko::HTTPD::Auth;
use Haineko::JSON;
$Haineko::HTTPD::Auth::PasswordDB = Haineko::JSON->loadfile('/path/to/password');
builder {
enable 'Auth::B
my $self, my $args => { optional => 1, default => {} } ;
my ($result) = values %{ $self->api->json({
req => 'ProgramByPID',
PID => $self->result->{PID},
%$args,
})->{Pr
my $self, my $args => { optional => 1, default => {} } ;
my ($result) = values %{ $self->api->json({
req => 'TitleFull',
TID => $self->result->{TID},
%$args,
})->{Title
s into a hash and multi-hash
=head2 L<Mojolicious::Plugin::AdvancedMod::Configurator>
Load YAML/JSON config, encapsulation, change 'templates_path' && 'static_path' by MOJO_MODE/config.
=head2 L<M
s into a hash and multi-hash
=head2 L<Mojolicious::Plugin::AdvancedMod::Configurator>
Load YAML/JSON config, encapsulation, change 'templates_path' && 'static_path' by MOJO_MODE/config.
=head2 L<M
=%s", $e, $v );
}
} catch {
# It was not JSON
require Haineko::E;
my $v = $htresponse->body || q();
package WWW::GoodData::Agent;
=head1 NAME
WWW::GoodData::Agent - HTTP client for GoodData JSON-based API
=head1 SYNOPSIS
use WWW::GoodData::Agent;
my $ua = new WWW::GoodData::Agent;
my $meta
sy for follow
specifics of the GoodData service API, transparently handles conversion
to and from JSON content type and recognizes and handles various kinds
of exceptions and error states.
It is a su
s unless
documented otherwise.
=cut
use strict;
use warnings;
use base qw/LWP::UserAgent/;
use JSON;
our $VERSION = '1.0';
=head1 PROPERTIES
=over 4
=item root
L<URI> object pointing to root o
e} ) {
foreach my $param ( keys %{$conf} ) {
next if $conf->{$param} !~ /\.(yml|json)$/;
$conf->{$param} = _load_file( $conf->{$param}, $mode );
}
}
if
faults( switch_config => $conf );
$self->app->log->debug( "** Configurator config: " . Mojo::JSON->new->encode( $conf ) );
if ( $conf->{_err} ) {
$self->app->log->error( "** Configurat
my $ext = shift;
my %lst = (
yml => [qw( YAML::XS YAML YAML::Tiny )],
json => [qw( JSON::XS JSON Mojo::JSON )]
);
foreach my $pkg ( @{ $lst{$ext} } ) {
eval "use $pkg";
if ( !
::SMTPD::Relay';
use strict;
use warnings;
use Furl;
use Try::Tiny;
use Time::Piece;
use Haineko::JSON;
use Haineko::SMTPD::Response;
use Email::MIME;
use Encode;
use Class::Accessor::Lite;
use const
/1.0/SOME-METHOD.OUTPUT_FORMAT
my $mandrillep = sprintf( "https://%s/api/%s/messages/send-raw.json", MANDRILL_ENDPOINT, MANDRILL_APIVERSION );
my $timestamp1 = Time::Piece->new;
my $header
=> 0 }
};
my $httpclient = Furl->new( %$methodargv );
my $htrequest1 = Haineko::JSON->dumpjson( $parameters );
my $htresponse = undef;
my $retryuntil = $self->{'retry'} || 0;
{
my $class = shift;
my $ctype = shift || 'plain';
my $types = {
'json' => 'application/json',
'html' => 'text/html; charset=utf-8',
'plain' => 'text/plain; char
);
}
sub json {
my $self = shift;
my $code = shift || 200;
my $data = shift; # (Ref->[HASH|ARRAY]) or JSON as a string
my $json = q();
require Haineko::JSON;
$json = ref $d
o::JSON->dumpjson( $data ) : $data;
$self->code( $code );
return $self->_res( $json, 'json' );
}
sub _res {
my $self = shift;
my $text = shift || q();
my $type = shift || 'json';
codes is 521 in this method.
=head4 C<B<HELO_HOST>>
Value defined in C<ehlo> field in HTTP POST JSON data, which should be the domain
name of the sending host or IP address enclosed square brackets.
5.1.8
in this method.
=head4 C<B<ENVELOPE_SENDER>>
Value defined in C<mail> field in HTTP POST JSON data, which should be the valid
email address.
=head2 C<B<rcpt( I<Haineko::SMTPD::Response>, I<
1
in this method.
=head4 C<B<ENVELOPE_RECIPIENTS>>
Values defined in C<rcpt> field in HTTP POST JSON data, which should be the
valid email address.
=head2 C<B<head( I<Haineko::SMTPD::Response>, I
::SMTPD::Relay';
use strict;
use warnings;
use Furl;
use Try::Tiny;
use Time::Piece;
use Haineko::JSON;
use Haineko::SMTPD::Response;
use Encode;
use constant 'SENDGRID_ENDPOINT' => 'sendgrid.com';
u
se->new( %$r ) );
return 0
}
my $sendgridep = sprintf( "https://%s/api/mail.send.json", SENDGRID_ENDPOINT );
my $parameters = {
'to' => $self->{'rcpt'},
'fr
,
'x-smtpapi' => q(),
};
my $usedheader = [ 'Date', 'Subject', 'From' ];
my $jsonheader = {};
my $identifier = [ split( '@', $self->{'head'}->{'Message-Id'} ) ]->[0];
for
::SMTPD::Relay';
use strict;
use warnings;
use Furl;
use Try::Tiny;
use Time::Piece;
use Haineko::JSON;
use Haineko::SMTPD::Response;
sub new {
my $class = shift;
my $argvs = { @_ };
$ar
rameters->{'header'}->{'replyto'} = $self->{'head'}->{'Reply-To'};
}
my $jsonstring = Haineko::JSON->dumpjson( $parameters );
my $httpheader = [];
my $httpobject = undef;
my $htre
;
my $sendmailto = sub {
$htresponse = $httpobject->post( $hainekourl, $httpheader, $jsonstring );
return 0 unless defined $htresponse;
return 0 unless $htresponse->is_su
es is 521 in this method.
=head4 C<B<HELO_HOST>>
Value defined in C<ehlo> field in C<HTTP POST> JSON data, which should be the
domain name of the sending host or IP address enclosed square brackets
n is 5.1.8
in this method.
=head4 B<ENVELOPE_SENDER>
Value defined in "mail" field in HTTP POST JSON data, which should be the
valid email address.
=head2 C<B<rcpt( I<Haineko::SMTPD::Response>, I<
.7.1
in this method.
=head4 B<ENVELOPE_RECIPIENTS>
Values defined in C<rcpt> field in HTTP POST JSON data, which should be the
valid email address.
=head2 B<head( I<Haineko::SMTPD::Response>, I<
t supported' ],
},
'malformed-json' => {
'dsn' => undef,
'code' => 421,
'message' => [ 'Malformed JSON string' ],
},
'not-found' =>