t, the client may provide an C<Accept:> header specifying
either HTML (C<text/html>) or JSON (C<application/json>). For the convenience
of those using a web browser, HTML is the default.
Here are som
rces are listed at the top-level URI, either using B<curl>
$ curl -v -H 'Accept: application/json' http://demo:demo@dochazka.site/
Similarly, to display a list of sub-resources under the 'privhi
e, enter the command:
$ curl http://demo:demo@dochazka.site/employee -H 'Accept: application/json'
Oops - no resources are displayed because the 'demo' user has only passerby
privileges, but al
el::Shared qw( cud load load_multiple priv_by_eid );
use DBI;
use File::Path;
use File::Spec;
use JSON;
use Params::Validate qw{:all};
use Try::Tiny;
# we get 'spawn', 'reset', and accessors from par
ns>)
=item * L<reset> (recycles an existing object by setting it to desired state)
=item * L<TO_JSON> (returns 'unblessed' version of an Activity object)
=item * L<compare> (compare two objects)
=
mat for the link header.
=back
=head1 MODULES
=over
=item * L<Plack::Middleware::Signposting::JSON>
=item * L<Plack::Middleware::Signposting::Catmandu>
=back
=head1 AUTHOR
Vitali Peil, C<< <vi
lege NOT NULL;
effective timestamp NOT NULL,
remark text,
stamp json
);
=head3 Stored procedures
There are also two stored procedures for determining privileg
);
use App::Dochazka::REST::Model::Shared qw( cud decode_schedule_json load load_multiple select_single );
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;
# we get 'spawn
disabled boolean,
remark text
);
The value of the 'schedule' field is a JSON array which looks something like this:
[
{ low_dow:"MON", low_time:"08:00", high_dow
ow_dow:"SAT", low_time:"19:05", high_dow:"SUN", high_time:"24:00" }
]
The intervals in the JSON string must be sorted and the whitespace, etc.
must be consistent in order for the UNIQUE constra
Date::Calc qw(
Add_Delta_Days
Date_to_Days
Day_of_Week
check_date
);
use JSON qw( decode_json );
use Params::Validate qw( :all );
use Try::Tiny;
BEGIN {
no strict 'refs';
our
populate' );
# return an appropriate throw-away value
return;
};
*{ 'TO_JSON' } = sub {
my $self = shift;
my $unblessed_copy;
map { $unblessed_copy->{
WDD@! No tiid in Fillup object!" unless $self->tiid;
map {
if ( ref( $ARGS{$_} ) eq 'JSON::PP::Boolean' ) {
$ARGS{$_} = $ARGS{$_} ? 1 : 0;
}
$self->$_( $ARGS{$
instructions for reporting bugs in Web::MREST',
documentation => <<'EOH',
=pod
Returns a JSON structure containing instructions for reporting bugs.
EOH
},
# configinfo
'configinf
qeuest for one of
these subresources, including the resource name in the request
entity as a bare JSON string (i.e. in double quotes).
EOH
},
# docu/pod
'docu/pod' =>
{
paren
POST => 'handler_echo',
},
acl_profile => 'admin',
cli => 'echo [$JSON]',
description => 'Echo the request body',
documentation => <<'EOH',
=pod
This r
esc text,
remark text,
disabled boolean NOT NULL,
stamp json,
CONSTRAINT kosher_code CHECK (code ~* '^[[:alnum:]_][[:alnum:]_-]+$')
)/,
tstzrange NOT NULL,
long_desc text,
remark text,
stamp json,
EXCLUDE USING gist (eid WITH =, intvl WITH &&)
)/,
q#-- trigger function to
Employees (EID),
intvl tstzrange NOT NULL,
remark text,
stamp json,
EXCLUDE USING gist (eid WITH =, intvl WITH &&)
)/,
q/-- trigger function to
);
#
# SQL_SCHEDULES_SELECT_BY_SCHEDULE
# SQL query to retrieve entire row given a schedule (JSON string)
set( 'SQL_SCHEDULES_SELECT_BY_SCHEDULE', q/
SELECT sid, scode, schedule, remark, di
schedule = ?
/ );
#
# SQL_SCHEDULES_SELECT_SCHEDULE
# SQL query to retrieve schedule (JSON string) given a SID
set( 'SQL_SCHEDULES_SELECT_SCHEDULE', q/
SELECT schedule FROM schedules
#
# SQL_SCHEDULES_SELECT_ALL_INCLUDING_DISABLED
# SQL query to retrieve all schedule records (JSON strings), including disabled ones
set( 'SQL_SCHEDULES_SELECT_ALL_INCLUDING_DISABLED', q/
SE
ters {
return qw(
App::Codeowners::Formatter::CSV
App::Codeowners::Formatter::JSON
App::Codeowners::Formatter::String
App::Codeowners::Formatter::TSV
App::C
ter::CSV>
=item *
L<App::Codeowners::Formatter::String>
=item *
L<App::Codeowners::Formatter::JSON>
=item *
L<App::Codeowners::Formatter::TSV>
=item *
L<App::Codeowners::Formatter::Table>
=it
spawn => \&make_spawn,
filter => \&make_filter,
reset => \&make_reset,
TO_JSON => \&make_TO_JSON,
compare => \&make_compare,
compare_disabled => \&make_compare_disabled,
clo
ollowing methods:
=over
=item * C<spawn>
=item * C<filter>
=item * C<reset>
=item * C<TO_JSON>
=item * C<compare>
=item * C<compare_disabled>
=item * C<clone>
=item * C<attrs>
=item * C
, reset, TO_JSON, compare, compare_disabled, clone, attrs, get and set
map {
$fn = $module . '::' . $_;
*{ $fn } = $make{$_}->( @attrs );
} qw( filter reset TO_JSON compare com
package Net::Easypost::CustomsInfo;
$Net::Easypost::CustomsInfo::VERSION = '0.23';
use JSON::MaybeXS;
use Types::Standard qw(ArrayRef Bool Enum InstanceOf Str);
use Moo;
with qw/Net::Easypost::Resour
customs_certify' => (
is => 'rw',
isa => Bool|InstanceOf['JSON::PP::Boolean'],
coerce => sub { $_[0] ? JSON->true : JSON->false }
);
has 'non_delivery_option' => (
is => 'rw',
r @EXPORT = qw(stock_info);
my $q = Finance::Quote->new("YahooJSON");
sub stock_info {
my ($symbol) = @_;
return $q->yahoo_json($symbol);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
en from "The Definitive ANTLR 4 Reference" by Terence Parr */
// Derived from http://json.org
grammar JSON;
json
: value
;
obj
: '{' pair (',' pair)* '}'
| '{' '}'
;
pair
: STRIN
: STRING
| NUMBER
| obj
| arr
| 'true'
| 'false'
| 'null'
;
lexer grammar JSON;
STRING
: '"' (ESC | SAFECODEPOINT)* '"'
;
fragment ESC
: '\\' (["\\/bfnrt] | UNICODE
bout "where's your DTD?" and similar nonsense.
=back
=back
=head1 DEPENDENCIES
=over
=item L<JSON::Parse>
This is used to read a file of options
=back
=head1 BUILD PROCESS
This module is buil
ackage Net::Easypost::Address;
$Net::Easypost::Address::VERSION = '0.23';
use Carp qw/croak/;
use JSON::MaybeXS;
use Scalar::Util;
use overload
'""' => sub { $_[0]->as_string },
'0+' =
sidential' => (
is => 'rw',
isa => Bool|InstanceOf['JSON::PP::Boolean'],
coerce => sub { $_[0] ? JSON->true : JSON->false }
);
has 'verifications' => (
is => 'rw',
isa =>
$self->_get_data_from_csv($file, $format);
}
else {
if ($format eq 'json') {
require JSON;
my $content = do {
local $/;
open my
$fh, '<', $file or die $!;
<$fh>;
};
$rows = JSON::decode_json($content);
}
elsif ($format =~ /ya?ml/) {
require YAML::Tiny;
=item C<table:Str>
table name of database.
=item C<format:Str>
data format. "CSV", "YAML" and "JSON" are available.
=item C<update:Bool>
Using C<< ON DUPLICATE KEY UPDATE >> or not. Default value
rs/;
%EXPORT_TAGS = (
all => \@EXPORT_OK,
);
use warnings;
use strict;
use Carp;
use JSON::Parse 'read_json';
our $VERSION = '0.09';
require XSLoader;
XSLoader::load ('HTML::Valid', $VERSION);
su
my $ok_options_file = __FILE__;
$ok_options_file =~ s!Valid\.pm$!Valid/ok-options.json!;
return read_json ($ok_options_file);
}
my $ok_options;
sub set_option
{
my ($htv, $option, $valu
rlying database.
Site policy parameters are set at installation time and are stored, as a
single JSON string, in the C<Policy> table. This table is rendered
effectively immutable by a trigger.
For d
}
}
}
return [sort @options];
}
sub _completion_formats { [qw(csv json json:pretty tsv yaml)] }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Codeowners::Options