App-Dochazka-REST

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

        'File::ShareDir' => 1.0,
        'JSON'           => 0,
        'Mason'          => 0,
        'Params::Validate' => 1.06,
        'Path::Router'   => 0.12,
        'Plack::Middleware::Session' => 0,
        'Plack::Middleware::StackTrace' => 0,
        'Plack::Runner'  => 0,
        'Pod::Simple::HTML' => 0,
        'Test::Deep::NoTest' => 0,
        'Try::Tiny'      => 0,
        'Web::Machine'   => 0.15,
        'Web::MREST'     => 0.287,
        'Web::MREST::CLI'     => 0.276,
    },
    add_to_cleanup     => [ 'App-Dochazka-REST-*' ],
    recursive_test_files => 1,
);

$builder->create_build_script();

Changes  view on Meta::CPAN

- t/001-init.t: make diagnostic messages more useful
- config/sql/interval_Config.pm: new SQL for use in Interval.pm
- Interval.pm: start developing the stub into something useful
- dochazka_Config.pm: add DOCHAZKA_ADVANCE_INTERVALS_MAX_DAYS
- dbinit_Config.pm: rename intervals.int_id to intervals.iid (Interval ID)
- REST.pm: revamp 'try' code block in 'create_tables'
- Activity.pm, Employee.pm: use new best practice for 'cud' calls
- Privhistory.pm, Schedhistory.pm: rewrite insert and delete methods to use 'cud'
- Schedule.pm: rewrite insert method to use 'cud'
- Shared.pm: add 'open_transaction' and 'close_transaction', revamp 'cud' to use
  Try::Tiny

0.062  2014-07-15 13:17 CEST
- make adjustments so test suite succeeds even if PostgreSQL server not
  present

0.063  2014-07-15 16:56 CEST
- dbinit_Config.pm, REST.pm: get rid of DBINIT_AUTOCOMMIT
- dbinit_Config.pm, Dochazka_Config.pm, REST.pm: use DOCHAZKA_DBNAME
  instead of DBINIT_DBNAME
- REST.pm: reset_db now drops/re-creates 'dochazka' user and grants all

Changes  view on Meta::CPAN

- ConnBank.pm: refactor the entire module
- REST.pm: adapt to the new ConnBank.pm code; make 'init' routine return a
  status object with the Plack application in the payload
- Dispatch/, Model/, Test.pm, t/: adapt to the new ConnBank.pm code

0.344  2014-12-10 18:01 CET
- bin/dochazka-rest: adapt to recent modifications to REST.pm->init
- REST_Message_en.conf: add DOCHAZKA_NO_DBIX_CONNECTOR
- dbinit_Config.pm: sum(numbackends) is not working for some reason; work
  around the problem
- REST/Dispatch.pm: add missing 'use Try::Tiny'; add some debugging messages to
  '_get_dbstatus'; numify number of connections
- Test.pm: add some error checking; 
- t/dispatch/top.t: add subtest for 'dbstatus' resource

0.345  2014-12-11 11:35 CET
- REST.pm: add verbiage to POD
- Resource.pm, Dispatch/Employee.pm: prepare for Blowfish

0.346  2014-12-11 18:36 CET
- hash passwords using Authen::Passphrase::SaltedDigest

META.json  view on Meta::CPAN

            "File::ShareDir" : "1",
            "JSON" : "0",
            "Mason" : "0",
            "Params::Validate" : "1.06",
            "Path::Router" : "0.12",
            "Plack::Middleware::Session" : "0",
            "Plack::Middleware::StackTrace" : "0",
            "Plack::Runner" : "0",
            "Pod::Simple::HTML" : "0",
            "Test::Deep::NoTest" : "0",
            "Try::Tiny" : "0",
            "Web::MREST" : "0.287",
            "Web::MREST::CLI" : "0.276",
            "Web::Machine" : "0.15",
            "perl" : "5.012"
         }
      }
   },
   "provides" : {
      "App::Dochazka::REST" : {
         "file" : "lib/App/Dochazka/REST.pm",

META.yml  view on Meta::CPAN

  File::ShareDir: '1'
  JSON: '0'
  Mason: '0'
  Params::Validate: '1.06'
  Path::Router: '0.12'
  Plack::Middleware::Session: '0'
  Plack::Middleware::StackTrace: '0'
  Plack::Runner: '0'
  Pod::Simple::HTML: '0'
  Test::Deep::NoTest: '0'
  Try::Tiny: '0'
  Web::MREST: '0.287'
  Web::MREST::CLI: '0.276'
  Web::Machine: '0.15'
  perl: '5.012'
resources:
  bugtracker: https://github.com/smithfarm/dochazka-rest/issues
  license: http://opensource.org/licenses/bsd-license.php
  repository: https://github.com/smithfarm/dochazka-rest
version: '0.559'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

bin/dochazka-dbinit  view on Meta::CPAN

#
# - initialize a pristine Dochazka database

use 5.012;
use strict;
use warnings;

#use App::CELL::Test::LogToFile;
use App::CELL qw( $CELL $site $log );
use App::Dochazka::REST;
use Try::Tiny;
use Web::MREST;
use Web::MREST::CLI qw( normalize_filespec );

my $app_distro = 'App-Dochazka-REST';
my $sitedir = '/etc/dochazka-rest';
print "Loading configuration parameters from $sitedir\n";
my $status = Web::MREST::init(
    distro => $app_distro,
    sitedir => $sitedir,
);

lib/App/Dochazka/REST.pm  view on Meta::CPAN

use warnings;

use App::CELL qw( $CELL $log $meta $core $site );
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_status );
use Data::Dumper;
use File::Path;
use File::ShareDir;
use File::Spec;
use Log::Any::Adapter;
use Params::Validate qw( :all );
use Try::Tiny;
use Web::Machine;
use Web::MREST;
use Web::MREST::CLI qw( normalize_filespec );



=head1 NAME

App::Dochazka::REST - Dochazka REST server

lib/App/Dochazka/REST/Auth.pm  view on Meta::CPAN


use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST;
use App::Dochazka::REST::ConnBank qw( $dbix_conn conn_status );
use App::Dochazka::REST::ACL qw( check_acl );
use App::Dochazka::REST::LDAP qw( ldap_exists ldap_search ldap_auth );
use App::Dochazka::REST::Model::Employee qw( autocreate_employee nick_exists );
use Authen::Passphrase::SaltedDigest;
use Data::Dumper;
use Params::Validate qw(:all);
use Try::Tiny;
use Web::Machine::Util qw( create_header );
use Web::MREST::InitRouter qw( $resources );

# methods/attributes not defined in this module will be inherited from:
use parent 'Web::MREST::Entity';




=head1 NAME

lib/App/Dochazka/REST/ConnBank.pm  view on Meta::CPAN

# ------------------------

package App::Dochazka::REST::ConnBank;

use strict;
use warnings;
use feature "state";

use App::CELL qw( $log $site );
use DBIx::Connector;
use Try::Tiny;



=head1 NAME

App::Dochazka::REST::ConnBank - Provide DBIx::Connector objects



=head1 SYNOPSIS

lib/App/Dochazka/REST/Dispatch.pm  view on Meta::CPAN

use App::Dochazka::REST::ResourceDefs;
use App::Dochazka::REST::Shared qw( :ALL );  # all the shared_* functions
use App::Dochazka::REST::Holiday qw(
    holidays_and_weekends
    holidays_in_daterange
);
use Data::Dumper;
use File::Path qw( mkpath rmtree );
use Module::Runtime qw( use_module );
use Params::Validate qw( :all );
use Try::Tiny;
use Web::MREST::InitRouter qw( $router $resources );
use Web::MREST::Util qw( pod_to_html pod_to_text );

use parent 'App::Dochazka::REST::Auth';




=head1 NAME

lib/App/Dochazka/REST/Fillup.pm  view on Meta::CPAN

);
use Data::Dumper;
use 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 %attr= (
        act_obj => { 
            type => HASHREF,
            isa => 'App::Dochazka::REST::Model::Activity', 
            optional => 1
        },
        clobber => { type => BOOLEAN, optional => 1 },

lib/App/Dochazka/REST/Mason.pm  view on Meta::CPAN

# ------------------------

package App::Dochazka::REST::Mason;

use strict;
use warnings;

use App::CELL qw( $CELL $log $site );
use Mason;
use Params::Validate qw( :all );
use Try::Tiny;



=head1 NAME

App::Dochazka::REST::Mason - Mason interpreter singleton



=head1 SYNOPSIS

lib/App/Dochazka/REST/Model/Activity.pm  view on Meta::CPAN


package App::Dochazka::REST::Model::Activity;

use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud load load_multiple priv_by_eid );
use DBI;
use Params::Validate qw{:all};
use Try::Tiny;

# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Activity';




=head1 NAME

App::Dochazka::REST::Model::Activity - activity data model

lib/App/Dochazka/REST/Model/Component.pm  view on Meta::CPAN

use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Mason qw( $comp_root $interp );
use App::Dochazka::REST::Model::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 parent
use parent 'App::Dochazka::Common::Model::Component';




=head1 NAME

App::Dochazka::REST::Model::Component - component class

lib/App/Dochazka/REST/Model/Employee.pm  view on Meta::CPAN

    noof 
    priv_by_eid 
    schedule_by_eid 
    select_single 
    select_set_of_single_scalar_rows
);
use Carp;
use Data::Dumper;
use DBI qw(:sql_types);
use Params::Validate qw( :all );
use Try::Tiny;

# send DBI warnings to the log
$SIG{__WARN__} = sub {
    $log->notice( $_[0] );
};

# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Employee';


lib/App/Dochazka/REST/Model/Privhistory.pm  view on Meta::CPAN


package App::Dochazka::REST::Model::Privhistory;

use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::REST::Model::Shared qw( cud get_history load );
use Data::Dumper;
use Params::Validate qw( :all );
use Try::Tiny;

# we get 'spawn', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Privhistory';




=head1 NAME

App::Dochazka::REST::Model::Privhistory - privilege history functions

lib/App/Dochazka/REST/Model/Schedintvls.pm  view on Meta::CPAN


use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::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 parent
use parent 'App::Dochazka::Common::Model::Schedintvls';




=head1 NAME

App::Dochazka::REST::Model::Schedintvls - object class for "scratch schedules"

lib/App/Dochazka/REST/Model/Schedule.pm  view on Meta::CPAN

package App::Dochazka::REST::Model::Schedule;

use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
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', 'reset', and accessors from parent
use parent 'App::Dochazka::Common::Model::Schedule';




=head1 NAME

App::Dochazka::REST::Model::Schedule - schedule functions

lib/App/Dochazka/REST/Model/Shared.pm  view on Meta::CPAN

package App::Dochazka::REST::Model::Shared;

use 5.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::Shared - functions shared by several modules within
the data model


lib/App/Dochazka/REST/Model/Shared.pm  view on Meta::CPAN


=cut

sub make_test_exists {

    my ( $t ) = validate_pos( @_, { type => SCALAR } );
    my $pkg = (caller)[0];

    return sub {
        my ( $conn, $s_key ) = @_;
        require Try::Tiny;
        my $routine = "load_by_$t";
        my ( $status, $txt );
        $log->debug( "Entered $t" . "_exists with search key $s_key" );
        try {
            no strict 'refs';
            $status = $pkg->$routine( $conn, $s_key );
        } catch {
            $txt = "Function " . $pkg . "::test_exists was generated with argument $t, " .
                "so it tried to call $routine, resulting in exception $_";
            $status = $CELL->status_crit( $txt );

lib/App/Dochazka/REST/Shared.pm  view on Meta::CPAN

use App::Dochazka::REST::Model::Employee;
use App::Dochazka::REST::Model::Interval;
use App::Dochazka::REST::Model::Lock;
use App::Dochazka::REST::Model::Privhistory;
use App::Dochazka::REST::Model::Schedhistory;
use App::Dochazka::REST::Model::Schedule;
use App::Dochazka::REST::Model::Shared qw( priv_by_eid schedule_by_eid );
use App::Dochazka::REST::Util qw( hash_the_password pre_update_comparison );
use Data::Dumper;
use Params::Validate qw( :all );
use Try::Tiny;

my $fail = $CELL->status_not_ok;


=head1 NAME

App::Dochazka::REST::Dispatch::Shared - Shared dispatch functions



lib/App/Dochazka/REST/Test.pm  view on Meta::CPAN

use App::Dochazka::REST::Model::Privhistory qw( get_privhistory );
use App::Dochazka::REST::Model::Schedhistory qw( get_schedhistory );
use App::Dochazka::REST::Model::Shared qw( cud_generic noof select_single );
use Authen::Passphrase::SaltedDigest;
use 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::Dochazka::REST::Test - Test helper functions





( run in 0.555 second using v1.01-cache-2.11-cpan-05444aca049 )