The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Dochazka::REST - Dochazka REST server

VERSION

Version 0.544

Development status

Alpha.

SYNOPSIS

Start the server with default settings:

    $ dochazka-rest

Point browser to:

    http://localhost:5000/

Use App::Dochazka::CLI command-line interface to access full functionality:

    $ dochazka-cli

DESCRIPTION

This distribution, App::Dochazka::REST, including all the modules in lib/, the scripts in bin/, and the configuration files in config/, constitutes the REST server (API) component of Dochazka, the open-source Attendance/Time Tracking (ATT) system.

Dochazka as a whole aims to be a convenient, open-source ATT solution.

ARCHITECTURE

Dochazka consists of four main components:

  • Dochazka clients

  • REST server (this module)

  • PostgreSQL database

  • Data model

In a nutshell, clients attempt to translate user intent into REST API calls, which are transmitted over a network (using the HTTP protocol) to the server. The server processes incoming HTTP requests. Requests for valid REST resources are passed to the API for processing and errors are generated for invalid requests. The result is returned to the client in an HTTP response. The REST API uses the PostgreSQL server to save state. The clients and the REST API use the data model to represent and manipulate objects.

DOCUMENTATION

EXPORTS

FUNCTIONS

run_sql

Takes a DBIx::Connector object and an array of SQL statements. Runs them one by one until an exception is thrown or the last statement completes successfully. Returns a status object which will be either OK or ERR. If NOT_OK, the error text will be in $status->text.

create_audit_triggers

Create the audit triggers. Wrapper for _do_audit_triggers

delete_audit_triggers

Delete the audit triggers. Wrapper for _do_audit_triggers

reset_mason_dir

Wipe out and re-create the Mason state directory. Returns status object. Upon success, level will be 'OK' and payload will contain the full path to the Mason component root.

initialize_activities_table

Create the activities defined in the site parameter DOCHAZKA_ACTIVITY_DEFINITIONS

reset_db

Drop and re-create a Dochazka database. Takes superuser credentials as arguments.

Be very, _very_, _VERY_ careful with this function.

get_eid_of

Obtain the EIDs of a list of employee nicks. Returns a reference to a hash where the keys are the nicks and the values are the corresponding EIDs.

NOTE 1: This routine expects to receive a DBIx::Connector object as its first argument. It does not use the $dbix_conn singleton.

NOTE 2: The nicks are expected to exist and no provision (other than logging a DOCHAZKA_DBI_ERR) is made for their non-existence.

version

Accessor method (to be called like a constructor) providing access to $VERSION variable

init_arbitrary_script

For scripts that need to manipulate the database directly (i.e. via the data model).

GLOSSARY OF TERMS

In Dochazka, some commonly-used terms have special meanings:

  • employee -- Regardless of whether they are employees in reality, for the purposes of Dochazka employees are the folks whose attendance/time is being tracked. Employees are expected to interact with Dochazka using the following functions and commands.

  • administrator -- In Dochazka, administrators are employees with special powers. Certain REST/CLI functions are available only to administrators.

  • CLI client -- CLI stands for Command-Line Interface. The CLI client is the Perl script that is run when an employee types dochazka at the bash prompt.

  • REST server -- REST stands for ... . The REST server is a collection of Perl modules running on a server at the site.

  • site -- In a general sense, the "site" is the company, organization, or place that has implemented (installed, configured) Dochazka for attendance/time tracking. In a technical sense, a site is a specific instance of the Dochazka REST server that CLI clients connect to.

AUTHOR

Nathan Cutler, <ncutler@suse.cz>

BUGS

To report bugs or request features, use the GitHub issue tracker at https://github.com/smithfarm/dochazka-rest/issues.

SUPPORT

The full documentation comes with the distro, and can be comfortable perused at metacpan.org:

    https://metacpan.org/pod/App::Dochazka::REST

You can also read the documentation for individual modules using the perldoc command, e.g.:

    perldoc App::Dochazka::REST
    perldoc App::Dochazka::REST::Model::Activity

Other resources:

LICENSE AND COPYRIGHT

Copyright (c) 2014-2015, SUSE LLC All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of SUSE LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 158:

You forgot a '=back' before '=head1'

You forgot a '=back' before '=head1'