App::Dochazka::REST::Dispatch - Implementation of top-level resources
This module contains the init_router method as well as all the resource handlers referred to in the resource definitions.
init_router
This module uses some package variables, which are essentially constants, to do its work.
The "router" (i.e., Path::Router instance) is initialized when the first request comes in, as a first step before any processing of the request takes place.
This happens when Web::MREST::Resource calls the init_router method.
App::Dochazka::REST implements its own init_router method, overriding the default one in Web::MREST::InitRouter.
These are largely (but not entirely) copy-pasted from Web::MREST::Dispatch.
Handler for the bugreport resource.
bugreport
Handler for the configinfo resource.
configinfo
Handler for the dbstatus resource.
dbstatus
The definition of resource $docu_resource lacks a 'documentation' property EOH # if they want POD, give them POD; if they want HTML, give them HTML, etc. if ( $resource_name eq 'docu/pod' ) { $pl->{'format'} = 'POD'; $pl->{'documentation'} = $docs; } elsif ( $resource_name eq 'docu/html' ) { $pl->{'format'} = 'HTML'; $pl->{'documentation'} = pod_to_html( $docs ); } else { # fall back to plain text $pl->{'format'} = 'text'; $pl->{'documentation'} = pod_to_text( $docs ); } return $CELL->status_ok( 'DISPATCH_ONLINE_DOCUMENTATION', payload => $pl ); }
Echo request body back in the response
Handler for 'forbidden' resource.
Handler for 'param/:type/:param' resource.
Generalized handler for resources that don't do anything.
Handler for the session resource.
session
Handler for the version resource.
version
Handler for 'GET activity/all'
Handler for 'GET activity/all/disabled'
Handler for 'POST activity/aid' resource.
Handler for 'POST activity/code' resource. This is a little more complicated because it can be either create or modify.
Handler for the 'activity/aid/:aid' resource.
Handler for the 'GET activity/code/:code' resource.
Handler for the 'DELETE activity/code/:code' resource.
Handler for the 'PUT activity/code/:code' resource.
Handler for 'GET employee/count/?:priv' resource.
Handler for 'GET employee/list/?:priv' resource.
Handler for 'GET employee/team' resource.
Handler for GET requests on the 'whoami', 'employee/current', and 'employee/self' resources (which are all synonyms).
Handler for GET requests on 'employee/self/priv' and 'employee/current/priv', which are synonymous resources.
Handler for 'PUT employee/eid/:eid' - can only be update.
Handler for 'POST employee/eid' - can only be update.
Handler for 'PUT employee/nick/:nick' - a little complicated because it can be insert or update, depending on whether or not the employee exists.
Handler for 'POST employee/nick' - a little complicated because it can be insert or update, depending on whether or not the employee exists.
Handler for 'POST employee/{current,self}' resources. The request entity is supposed to contain a list of key:value pairs where the keys are properties of the employee object and the values are new values for those properties, e.g.:
{ "fullname" : "Bubba Jones", "nick" : "bubba" }
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 insertion into placeholders in an UPDATE statement.
Handler for 'DELETE employee/eid/:eid' resource.
Handler for 'GET employee/eid/:eid'
Handler for 'GET employee/nick/:nick/ldap' resource.
Handler for 'PUT employee/nick/:nick/ldap' resource.
Handler for 'GET employee/eid/:eid/minimal' resource. Handler for 'GET employee/nick/:nick/minimal' resource. Handler for 'GET employee/sec_id/:sec_id/minimal' resource.
Handler for 'GET employee/eid/:eid/team'
Handler for 'GET employee/nick/:nick/team'
Handler for 'DELETE employee/nick/:nick'
Handler for 'GET employee/nick/:nick'
Handler for 'GET employee/sec_id/:sec_id'
Handler for 'GET employee/search/nick/:key'
Handler method for the '{priv,schedule}/history/self/?:tsrange' resource.
Handler method for GET requests on the '/{priv,schedule}/history/eid/..' and '/{priv,schedule}/history/nick/..' resources.
Handler method for POST requests on the '/{priv,schedule}/history/eid/..' and '/{priv,schedule}/history/nick/..' resources.
Handler for 'GET priv/history/phid/:phid'
Handler for 'POST priv/history/phid/:phid'
Handler for 'GET schedule/history/shid/:shid'
Handler for 'POST priv/history/shid/:shid'
Handler for 'GET interval/eid/:eid/:tsrange'
#FIXME: implement a configurable limit on the tsrange
Handler for 'GET lock/eid/:eid/:tsrange'
Handler for 'GET interval/nick/:nick/:tsrange'
Handler for 'GET lock/nick/:nick/:tsrange'
Handler for 'GET interval/self/:tsrange'
Handler for 'GET lock/self/:tsrange'
Handler for 'POST interval/new'
Handler for 'POST interval/iid'.
Handler for 'GET interval/iid/:iid' resource.
Handler for 'interval/iid/:iid' resource.
Handler for "GET interval/summary/?:qualifiers"
Handler for 'POST lock/new'
Handler for 'POST lock/lid'.
Handler for 'GET lock/lid/:lid' resource.
Handler for 'lock/lid/:lid' resource.
Works for both 'GET schedule/all' and 'GET schedule/all/disabled'
Handler for the 'schedule/new' resource.
Handler for '/schedule/sid/:sid'
Handler for 'PUT schedule/sid/:sid'
Handler for '/schedule/scode/:scode'
Handler for 'PUT schedule/scode/:scode'
To install App::Dochazka::REST, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Dochazka::REST
CPAN shell
perl -MCPAN -e shell install App::Dochazka::REST
For more information on module installation, please visit the detailed CPAN module installation guide.