diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2014-03-13 16:56:02 +0000 |
---|---|---|
committer | Hakim Cassimally <hakim@mysociety.org> | 2014-10-16 16:56:26 +0000 |
commit | d1fee928f02dbc30d3a38b746155ce5b12be4a1b (patch) | |
tree | 5e8bdccbd69863e69098b9aa900c1e71745f8eb5 /perllib/Open311/Endpoint/Service/Request.pm | |
parent | 592f4c0ba0f822b55bb242cb12768ce771599d09 (diff) |
Open311 Endpoint
Subsystems include
* ::Spark encoding conventions for xml/json
* ::Schema using Rx to validate form of inputs and outputs,
including validation for, e.g., dates and CSV as part of Open311
Handles following paths:
* Open311 attributes for Service Definition
http://wiki.open311.org/GeoReport_v2#GET_Service_Definition
* POST service request
* GET Service Requests
* GET Service Request
Objects:
* ::Service
* ::Service::Request
Diffstat (limited to 'perllib/Open311/Endpoint/Service/Request.pm')
-rw-r--r-- | perllib/Open311/Endpoint/Service/Request.pm | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/perllib/Open311/Endpoint/Service/Request.pm b/perllib/Open311/Endpoint/Service/Request.pm new file mode 100644 index 000000000..b56cee393 --- /dev/null +++ b/perllib/Open311/Endpoint/Service/Request.pm @@ -0,0 +1,107 @@ +package Open311::Endpoint::Service::Request; +use Moo; +use Types::Standard ':all'; +use namespace::clean; + +has service => ( + is => 'ro', + isa => InstanceOf['Open311::Endpoint::Service'], + handles => [ + qw/ service_code service_name / + ], +); + +has service_request_id => ( + is => 'ro', + isa => Maybe[Str], + predicate => 1, +); + +has token => ( + is => 'ro', + isa => Maybe[Str], + predicate => 1, +); + +has service_notice => ( + is => 'ro', + isa => Maybe[Str], + predicate => 1, +); + +has account_id => ( + is => 'ro', + isa => Maybe[Str], + predicate => 1, +); + +has status => ( + is => 'rw', + isa => Enum[qw/ open closed /], + default => sub { 'open' }, +); + +has description => ( + is => 'ro', + isa => Maybe[Str], +); + +has agency_responsible => ( + is => 'ro', + isa => Maybe[Str], +); + +has requested_datetime => ( + is => 'ro', + isa => Maybe[ InstanceOf['DateTime'] ], +); + +has updated_datetime => ( + is => 'ro', + isa => Maybe[ InstanceOf['DateTime'] ], +); + +has expected_datetime => ( + is => 'ro', + isa => Maybe[ InstanceOf['DateTime'] ], +); + +has address => ( + is => 'ro', + isa => Str, + default => sub { '' }, +); + +has address_id => ( + is => 'ro', + isa => Str, + default => sub { '' }, +); + +has zipcode => ( + is => 'ro', + isa => Str, + default => sub { '' }, +); + +has latlong => ( + is => 'ro', + isa => Tuple[ Num, Num ], + default => sub { [0,0] }, + handles_via => 'Array', + handles => { + #lat => [ get => 0 ], + #long => [ get => 1 ], + } +); + +sub lat { shift->latlong->[0] } +sub long { shift->latlong->[1] } + +has media_url => ( + is => 'ro', + isa => Str, + default => sub { '' }, +); + +1; |