ry
throw_error
throw_immediate
formats
/]
);
use Clone qw(clone);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Reference;
use JSV::Context;
use Module::Pluggable::Ob
current_schema_pointer => "",
schema_pointer_history => [],
json => JSON->new->allow_nonref,
loose_type => $opts->{loose_type},
);
alidator;
}
1;
__END__
=encoding utf-8
=head1 NAME
JSV::Validator - A perl implementation of JSON Schema (draft-04) validator
=head1 SYNOPSIS
use feature qw(say);
use JSV::Validator;
JSV
ow_immediate
enable_history
enable_format
formats
history
json
loose_type
/],
ro => [qw/
errors
current_type
current_ke
current_schema_pointer
schema_pointer_history
/],
);
use Carp qw(croak);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(detect_instance_type detect_instance_typ
ance {
my $self = shift;
my $instance;
if ( JSON::is_bool($self->current_instance) ) {
if ( $self->current_instance == JSON::true ) {
$instance = "true";
}
our $VERSION = "0.08";
1;
__END__
=encoding utf-8
=head1 NAME
JSV - A perl implementation of JSON Schema (draft-04) validator
=head1 SYNOPSIS
=head1 DESCRIPTION
See e.g. L<JSV::Validator>
=he
ackage JSV::Keyword::Draft4::Maximum;
use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSON;
use JSV::Keyword qw(:constants);
sub instance_type() { INSTANCE_TYPE_NUMERIC(); }
sub keyword(
value($schema);
my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false;
if ($exclusive_maximum) {
if ($instance >= $maximum) {
$context-
rver} . '/' . $call . '.json' => $header => json => $payload );
} elsif ( $mode eq 'delete' ) {
$tx = $ua->delete( $config->{server} . '/' . $call . '.json' => $header );
l . '.json' => $header => json => $payload );
} else {
my $combined_payload = { %$payload, %$params };
$tx = $ua->get( $config->{server} . '/' . $call . '.json' =>
bined_payload );
}
if ( my $res = $tx->success ) {
$response = $res->json;
} else {
warn 'fail';
p $tx->body;
my $err = $tx->er
Suite;
use strict;
use warnings;
use Carp;
use File::Basename;
use File::Spec;
use FindBin;
use JSON;
use Test::More;
sub run {
my ($class, %opts) = @_;
%opts = (
base_dir => $opt
n} ? ( $self->{base_dir}, $self->{version} ) : ( $self->{base_dir} ),
$self->{suite} . ".json"
);
note $test_suite_file;
unless (-f $test_suite_file) {
croak sprintf("No
@$self{qw/base_dir version suite/});
}
open(my $fh, "<", $test_suite_file) or croak $!;
my $test_suite = decode_json(do { local $/; <$fh> });
close $fh;
return $test_suite;
}
1;
um;
use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSV::Keyword qw(:constants);
use JSON;
use List::MoreUtils qw(firstidx);
sub instance_type() { INSTANCE_TYPE_ANY(); }
sub keyword() {
>keyword_value($schema);
my $instance_as_json = $context->json->encode($instance);
my $matched_idx = firstidx { $instance_as_json eq $context->json->encode($_); } @$enum;
if ($matched_idx
e Scalar::Util qw(blessed looks_like_number);
use JSON;
our @EXPORT_OK = (qw/
detect_instance_type
detect_instance_type_loose
escape_json_pointer
/);
our %REF_TYPE_MAP = (
HASH => "
if (!blessed $instance) {
return $REF_TYPE_MAP{$ref_type};
}
elsif (JSON::is_bool($instance)) {
return "boolean";
}
else {
croak(s
$/;
return "number_or_string";
}
}
return $type_strict;
}
sub escape_json_pointer {
my $property = shift;
return unless defined $property;
# according to http
=> sub {
return '';
},
);
=head2 prepare_raygun
Prepare the data for conversion to JSON.
=cut
sub prepare_raygun {
my $self = shift;
return {
lineNumber => $self->line
aygun> method may be called to retreive the structure in a form
that can be converted directly to JSON.
=head1 INTERFACE
=cut
use Filesys::DfPortable;
use Sys::Info;
use Sys::Info::OS;
use POSIX (
vice::Pinterest::Pager;
use HTTP::Request;
use HTTP::Request::Common ();
use LWP::UserAgent;
use JSON::XS;
use Carp qw(croak);
use namespace::autoclean;
has app_id => (
is => 'ro',
p
}
# Decode JSON content
my $r;
if ( $res && $res->content_type eq 'application/json' ) {
my $json = $res->decoded_content;
$r = eval { decode_json($json) };
if (
my $err = $@ ) {
$r = { _error => 'bad_json', _message => $err, json => $json };
}
}
$r //= { _error => 'not_json', _content_type => $res->content_type };
$r->{_http_s
t;
use warnings;
use Carp qw/croak/;
use URI::Escape qw/uri_escape/;
use HTTP::Tiny;
use JSON::PP qw/decode_json/;
use Class::Accessor::Lite (
rw => [qw/
cd
type
endpoint
es->{status} $res->{reason}" unless $res->{success};
my $json = $res->{content};
return $json if $raw;
return decode_json($json);
}
sub data {
my ($self, $domain, $delimi) = @_;
n::Format::LDAP::make_ldif($self);
}
elsif ($opts->{as} eq "json") {
require JSON;
$dump = JSON::encode_json(\%struct);
}
elsif ($opts->{as} eq "perl") {
$dump
$dump = $dumper->Dump;
}
# add a newline if output is missing one (typically for JSON)
$dump .= "\n" unless $dump =~ /\n$/;
return print $dump
}
else {
s set,
otherwise returns the result.
B<Arguments>
=over
=item *
C<as> - specify the format: C<json>, C<perl>, C<yaml>
=back
=head2 task_info
Print information about the RackObject
=head2 tas
8
This is Perl module B<Test::JSON::More>.
=begin html
<a href="http://travis-ci.org/bayashi/Test-JSON-More"><img src="https://secure.travis-ci.org/bayashi/Test-JSON-More.png?_t=1461806674"/></a>
s.io/r/bayashi/Test-JSON-More"><img src="https://coveralls.io/repos/bayashi/Test-JSON-More/badge.png?_t=1461806674&branch=master"/></a>
=end html
=head1 INSTALLATION
Test::JSON::More installation
Test::JSON::More
Download it, unpack it, then build it as per the usual:
% perl Makefile.PL
% make && make test
Then install it:
% make install
=head1 DOCUMENTATION
Test::JSON::More
aygun> method may be called to retreive the structure in a form
that can be converted directly to JSON.
=head1 INTERFACE
=cut
use Data::GUID 'guid_string';
use Mouse::Util::TypeConstraints;
subt
return [];
},
);
=head2 prepare_raygun
Prepare the error structure to be converted to JSON and sent to raygun.io.
=cut
sub prepare_raygun {
my $self = shift;
return {
inn
ID::PayPal::LIPP;
use strict;
use 5.008_005;
use warnings;
our $VERSION = '0.02';
use Carp;
use JSON;
use URI;
use URI::QueryParam;
use HTTP::Request::Common;
use Convert::Base64;
use LWP::UserAgent
data_json = $self->_post(
$self->paypal_auth_token_service_endpoint,
$post_data,
{ Authorization => "Basic $encoded_header" }
);
my $data_hash = decode_json($data_json);
data_json = $self->_post(
$self->paypal_auth_token_service_endpoint,
$post_data,
{ Authorization => "Basic $encoded_header" }
);
my $data_hash = decode_json($data_json);
=head3 L<File::Slurper>
=head3 L<File::Type>
=head3 L<Hash::Merge>
=head3 L<JSON>
=head3 L<JSON::Syck>
=head3 L<JSON::XS>
=head3 L<List::AllUtils>
=head3 L<List::MoreUtils>
=head3 L<Log::Log4p
age eq $match; #otherwise, brain-dead comparison
}
if($ref_message eq 'JSON::PP::Boolean' and $ref_match eq 'JSON::PP::Boolean') {
return "$message" eq "$match";
}
if($ref_mess
le scripts in the distribution.
=cut
use Moose;
use Method::Signatures;
use LWP::UserAgent;
use JSON;
use YAML;
=head1 ATTRIBUTES
=over
=item debug
If debug is set, lots of stuff will get dumped
$self->debug) {
print STDERR Dump($self->response);
}
my $json = decode_json($self->response->content);
return $json->{versions};
}
=item login
Logs in.
=cut
method login {
$self
int STDERR Dump($self->response);
}
my $json = decode_json($self->response->content);
my $userId = $json->{data}{userId};
my $authToken = $json->{data}{authToken};
$self->userId($userId