;
# base class for representing Deezer objects
subtype 'JSONBoolean' => (as 'Int');
coerce 'JSONBoolean' => (
from 'Ref',
via { JSON::is_bool($_) }
);
subtype 'Url' => as 'Str',
where
STRACT: Perl API Bindings to the OSI License API
use Moo;
use REST::Client;
use Const::Fast;
use JSON;
use Carp;
const my $base_url => 'https://api.opensource.org';
has _api_client => ( is => 'lazy
();
my $response = shift();
if ( $response->responseCode() == 200 ) {
return from_json( $response->responseContent );
} else {
croak 'Error: ' . $response->responseCode() .
THODS
=head2 all
Get a list of all known licenses.
The response is the perl equivalent of the json returned by the api,
documented in L<https://github.com/OpenSourceOrg/api/blob/master/doc/endpoin
package WWW::Deezer;
use strict;
use warnings;
use Carp();
use LWP::UserAgent;
use JSON;
use URI::Escape;
use WWW::Deezer::SearchResult;
use WWW::Deezer::Artist;
our $VERSION = '0.03';
our $API_VE
rl => "http://api.deezer.com/$API_VERSION/",
ua => LWP::UserAgent->new,
json => JSON->new->allow_nonref,
debug => 0,
};
$self->{ua}->agent("WWW::Deezer v".$V
_get_url ({
url => $uri.'/'.$id,
method => 'GET'
});
$res = $self->{json}->decode ($res) unless _is_hashref ($res);
$res->{deezer_obj} = $self;
return WWW::Deeze
Net::Amazon::DirectConnect;
use 5.10.0;
use strict;
use warnings FATAL => 'all';
use Carp;
use JSON;
use YAML::Tiny;
use HTTP::Request;
use LWP::UserAgent;
use Net::Amazon::Signature::V4;
my $yaml
%args);
my $response = $self->_request($method,
content => encode_json \%args
);
return decode_json $response->content if $response->is_success;
}
=head2 ua
Get or set UserAgen
Date => POSIX::strftime( '%Y%m%dT%H%M%SZ', gmtime ),
'Content-Type' => 'application/x-amz-json-1.1',
'X-Amz-Target' => $self->spec->{target_prefix} . $operation,
exists $args{h
package Swagger2::Client;
use Mojo::Base -base;
use Mojo::JSON;
use Mojo::UserAgent;
use Mojo::Util;
use Carp ();
use Swagger2;
use JSON::Validator::OpenAPI;
use constant DEBUG => $ENV{SWAGGER2_DEBU
t->_swagger->base_url) };
has ua => sub { Mojo::UserAgent->new };
has _validator => sub { JSON::Validator::OpenAPI->new; };
sub generate {
my $class = shift;
my ($swagger, $url) = _swagge
es = Mojo::Message::Response->new;
$res->headers->content_type('application/json');
$res->body(Mojo::JSON::encode_json({errors => $_[0]}));
$res->code(400)->message($res->default_message);
$re
package Swagger2::SchemaValidator;
use Mojo::Base 'JSON::Validator::OpenAPI';
warn "# Swagger2::SchemaValidator is deprecated in favor of JSON::Validator::OpenAPI";
1;
=encoding utf8
=head1 NAME
Sw
Validator - DEPRECATED
=head1 DEPRECATION WARNING
See L<Swagger2>.
=head1 DESCRIPTION
Use L<JSON::Validator::OpenAPI> instead.
=head1 SEE ALSO
L<Swagger2> and L<JSON::Validator::OpenAPI>.
=cut
agger2;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON;
use Mojo::Loader;
use Mojo::Util qw(decamelize deprecated);
use Swagger2;
use JSON::Validator::OpenAPI::Mojolicious;
use constant DEBUG
PACKAGE__, 'layouts/mojolicious_plugin_swagger.html.ep');
has url => '';
has _validator => sub { JSON::Validator::OpenAPI::Mojolicious->new; };
sub dispatch_to_swagger {
return undef unless $_[1]-
($c, $data) = @_;
my $self = $c->stash('swagger.plugin');
my $reply
= sub { $_[0]->send({json => {code => $_[2] || 200, id => $data->{id}, body => $_[1]}}) };
my $defaults = $self->{route_d
if($c->debug) {
require JSON::MaybeXS;
my $json_with_args = JSON::MaybeXS->new(utf8 => 1, allow_nonref=>1);
$find = scalar(@find) ? $json_with_args->encode(@find) : '[NEW
me =~ y/A-Z0-9//cd;
push @EXPORT_OK, $name;
constant->import($name, $_)
}
}
use JSON::MaybeXS qw/decode_json/;
use HTTP::Tiny;
use PerlX::Maybe;
use WWW::BackpackTF::Currency;
use WWW::BackpackT
die $htr->{reason} unless $htr->{success}; ## no critic (RequireCarping)
my $response = decode_json($htr->{content})->{response};
die $response->{message} unless $response->{success}; ## no critic
initializing = false;
ace.session.setMode("ace/mode/" + (ace.getValue().match(/^\s*\{/) ? "json" : "yaml"));
preview.scrollTop = scrollSave();
};
var render = function() {
scrollSa
Editor> is a WEB based Swagger2 API editor.
=head1 SYNOPSIS
$ mojo swagger2 edit /path/to/api.json --listen http://*:3000
=head1 ATTRIBUTES
=head2 specification_file
Returns path to swagger spe
render the POD if requested as C</.txt> instead.
=head2 POST /
Will L<parse|Swagger/parse> the JSON/YAML in the HTTP body and render it as POD.
=head1 METHODS
=head2 startup
Used to set up the L
$base_url = $args[$i + 1] if $_ eq '-b';
$args = Mojo::JSON::decode_json($args[0]) if /^\{/;
$args->{$1} = $2 if /^(\w+)=(.*)/;
f $base_url;
eval {
my $res = $client->$method($args);
print $OUT $res->json ? Mojo::Util::dumper($res->json) : $res->body;
1;
} or do {
my $e = $@;
$e =~ s! at .* line.*!!s;
pec.json" if $_[0] eq 'perldoc';
return "Usage: mojo swagger2 pod path/to/spec.json" if $_[0] eq 'pod';
return "Usage: mojo swagger2 validate path/to/spec.json"
use warnings;
our $VERSION = '0.003';
use parent qw( SMS::Send::Driver );
use HTTP::Tiny;
use JSON;
our $URL = "http://api.apistore.co.kr/ppurio/1";
our $AGENT = 'SMS-Send-KR-APIStore/' . $
id response for POST request';
if ( $res && $res->{success} ) {
$ret{detail} = decode_json( $res->{content} );
$ret{success} = 1 if $ret{detail}{result_code} eq '200';
$re
valid response for GET request';
if ( $res && $res->{success} ) {
my $detail = decode_json( $res->{content} );
$ret{success} = 1 if $detail->{call_status} =~ m/^(4100|6600)$/;
se Mojo::Base -base;
use Mojo::Asset::File;
use Mojo::JSON;
use Mojo::JSON::Pointer;
use Mojo::URL;
use File::Basename ();
use File::Spec;
use JSON::Validator::OpenAPI;
our $VERSION = '0.89';
# Shou
= shift;
return $self->_validator->_load_schema($self->url) if '' . $self->url;
return Mojo::JSON::Pointer->new({});
};
has base_url => sub {
my $self = shift;
my $url = Mojo::URL->new;
m
pecification => sub { shift->_validator->schema('http://swagger.io/v2/schema.json')->schema };
has _validator => sub { JSON::Validator::OpenAPI->new };
sub ua { shift->_validator->ua(@_) }
sub url
tributes are dumped as Perl instead of JSON ",
"so it's unsafe to parse",
);
} else {
require JSON::MaybeXS;
eval { $per
icmd_inline_attrs =
JSON::MaybeXS::decode_json($pericmd_inline_attrs) };
if ($@) {
push @{ $meta->{'func.notes'} },
mn' => {
'data_type' => 'VARCHAR',
'size' => 255,
'serializer_class' => 'JSON'
}
);
Then in your code...
my $struct = { 'I' => { 'am' => 'a struct' };
$obj->data_c
j->data_column;
The data structures you assign to "data_column" will be saved in the database in JSON format.
=head1 DESCRIPTION
These modules help you store and access serialized data structures i
lts in an error
Right now there are three serializers:
- Storable
- JSON
- YAML
=head1 USAGE
1. Choose your serializer: JSON, YAML or Storable
2. Add 'InflateColumn::Serializer' into the load_c
ion => $VERSION,
base => 'XAS::Singleton',
accessors => 'spooler',
codec => 'JSON',
utils => ':validation',
filesystem => 'Dir'
;
# -------------------------------------
y => $self->env->facility,
message => $message,
};
my $json = encode($data);
$self->spooler->write($json);
}
# ----------------------------------------------------------------
strings. Which means every string has a consistent EOL.
These strings may be formatted, such as JSON. This module inherits from
L<XAS::Lib::POE::Session|XAS::Lib::POE::Session>.
=head1 METHODS
=h
{route_pre} };
}
sub route_post {
my ($self) = @_;
return @{ $self->{route_post} };
}
sub TO_JSON {
my ($self) = @_;
return { %{$self} };
}
1;
__END__
=head1 NAME
Travel::Status::DE::URA::
::Result object. You should not need to
call this.
=item $departure->TO_JSON
Allows the object data to be serialized to JSON.
=back
=head1 DIAGNOSTICS
None.
=head1 DEPENDENCIES
=over
=item Cl
e => 'XAS::Lib::Net::Server',
mixin => 'XAS::Lib::Mixin::JSON::Server XAS::Lib::Mixins::Keepalive',
constants => ':jsonrpc',
vars => {
PARAMS => {
-port => { optional
ss = shift;
my $self = $class->SUPER::init(@_);
my $methods = ['echo'];
$self->init_json_server($methods);
return $self;
}
1;
__END__
=head1 NAME
XAS::xxx - A class for the XAS
es the syslog
conventions.
=item B<XAS_LOG_TYPE>
The log type. This can be "console", "file", "json" or "syslog". Defaults
to "console"
=item B<XAS_ERR_THROWS>
The default error message type. Def
lid options
are "console", "file", "json" and "syslog'.
=head2 log_facility
This method will return the log facility class to use when writting to
syslog or json.
Example
$facility = $xas->lo