Group
Extension

Matches 16

App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/config/sql/dbinit_Config.pm ( view source; MetaCPAN )
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
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Schedhistory.pm ( view source; MetaCPAN )
sid) NOT NULL,
        effective  timestamp NOT NULL,
        remark     text,
        stamp      json
      );

=head3 Stored procedures

This table also includes two stored procedures -- C<sid_at_ti
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Guide.pm ( view source; MetaCPAN )
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
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Fillup.pm ( view source; MetaCPAN )
 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{$
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Auth.pm ( view source; MetaCPAN )
uth_status->payload;
            $self->push_onto_context( { 
                current => $emp->TO_JSON,
                current_obj => $emp,
                current_priv => $emp->priv( $dbix_conn ),
 
::Dochazka::REST::Model::Employee" );
    $self->push_onto_context( {
        current => $emp->TO_JSON,
        current_obj => $emp,
        current_priv => $emp->priv( $dbix_conn ),
        dbix_conn
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Test.pm ( view source; MetaCPAN )
se Data::Dumper;
use HTTP::Request::Common qw( GET PUT POST DELETE );
use JSON;
use Params::Validate qw( :all );
use Test::JSON;
use Test::More;
use Try::Tiny;
use Web::MREST;



=head1 NAME

App::Doc
ad2 status_from_json

L<App::Dochazka::REST> is designed to return status objects in the HTTP
response body. These, of course, are sent in JSON format. This simple routine
takes a JSON string and bles


FIXME: There may be some encoding issues here!

=cut

sub status_from_json {
    my ( $json ) = @_;
    bless from_json( $json ), 'App::CELL::Status';
}


=head2 req

Assemble and process a HTTP req
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Dispatch.pm ( view source; MetaCPAN )
    }

Note that it should be possible to set a property to null:

    { "fullname" : null }

The JSON will be converted into a Perl hashref, of course, and that will
be handed off to the DBI for inse
und some employee objects
    foreach my $emp ( @{ $status->payload } ) {
        $emp = $emp->TO_JSON;
    }
    return $status;
}


=head2 Genreport handlers

=head3 handler_genreport

Handler for t
ntervals converted" );

    #
    # spawn Schedule object
    my @ARGS = ( 'schedule' => $intvls->json );
    if ( my $scode = $context->{'request_entity'}->{'scode'} ) {
        push @ARGS, ( 'scode'
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/ResourceDefs.pm ( view source; MetaCPAN )
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
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Docs/Resources.pm ( view source; MetaCPAN )
o this
activity.

=back


=back

=head2 C<< bugreport >>


=over

Allowed methods: GET

Returns a JSON structure containing instructions for reporting bugs.


=back

=head2 C<< component >>


=over

A
qeuest for one of
these subresources, including the resource name in the request
entity as a bare JSON string (i.e. in double quotes).


=back

=head2 C<< docu/html >>


=over

Allowed methods: POST

a new schedule from those intervals or verify that an equivalent
schedule already exists.

Sample JSON:

    { "schedule" : [
        "[2014-09-22 08:00, 2014-09-22 12:00)",
        "[2014-09-22 12:30
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Schedintvls.pm ( view source; MetaCPAN )
a::REST::ConnBank qw( $dbix_conn );
use App::Dochazka::REST::Model::Shared;
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;

# we get 'spawn', 'reset', and accessors from p
;
    return $status;
}


=head2 json

Instance method. Returns a JSON string representation of the schedule.

=cut

sub json {
    my ( $self ) = @_;

    return JSON->new->utf8->canonical(1)->encode
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Shared.pm ( view source; MetaCPAN )
012;
use strict;
use warnings;

use App::CELL qw( $CELL $log $meta $site );
use Data::Dumper;
use JSON;
use Params::Validate qw( :all );
use Try::Tiny;




=head1 NAME

App::Dochazka::REST::Model::Sha
ze_date
    canonicalize_ts
    canonicalize_tsrange
    cud 
    cud_generic
    decode_schedule_json 
    get_history
    load 
    load_multiple 
    noof 
    priv_by_eid 
    schedule_by_eid 
   
ule_json

Given JSON string representation of the schedule, return corresponding HASHREF.

=cut

sub decode_schedule_json {
    my ( $json_str ) = @_;

    return unless $json_str;
    return JSON->ne
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Activity.pm ( view source; MetaCPAN )
rk>)

=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)

=
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Component.pm ( view source; MetaCPAN )
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)

=
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Schedule.pm ( view source; MetaCPAN )
 );
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
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/lib/App/Dochazka/REST/Model/Privhistory.pm ( view source; MetaCPAN )
lege NOT NULL;
        effective  timestamp NOT NULL,
        remark     text,
        stamp      json
    );



=head3 Stored procedures

There are also two stored procedures for determining privileg
App-Dochazka-REST ( S/SM/SMITHFARM/App-Dochazka-REST-0.559.tar.gz, SMITHFARM, 2022; MetaCPAN )
App-Dochazka-REST/config/sql/schedule_Config.pm ( view source; MetaCPAN )
);

#
# 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

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.