diff options
author | Hakim Cassimally <hakim@mysociety.org> | 2014-05-15 15:53:34 +0000 |
---|---|---|
committer | Hakim Cassimally <hakim@mysociety.org> | 2014-10-16 16:56:26 +0000 |
commit | 06a69fa7a7e9fae205df36ddc68d131d91533792 (patch) | |
tree | 202a8451cc6539ff8f15652d0e15f53dedfa614c /perllib/Open311/Endpoint.pm | |
parent | d1fee928f02dbc30d3a38b746155ce5b12be4a1b (diff) |
Open311 Endpoint mySociety extensions role
* Get Service Request Updates
This requires a new object ::Service::Request::Update, which of course
is not part of standard spec. So, in order to make the core not too
contaminated by :
* the endpoint should instantiate ::Service::Request::mySociety objects
which know about updates
* have added a learn_additional_types callback from Schema to Endpoint,
so that core doesn't need to know about /open311/service_request_update
* (but ::Spark knows about the exception for updates... meh, but is 1-line)
Diffstat (limited to 'perllib/Open311/Endpoint.pm')
-rw-r--r-- | perllib/Open311/Endpoint.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/perllib/Open311/Endpoint.pm b/perllib/Open311/Endpoint.pm index 8a440e4ae..0abb52aab 100644 --- a/perllib/Open311/Endpoint.pm +++ b/perllib/Open311/Endpoint.pm @@ -38,7 +38,11 @@ and provide the necessary methods. =head1 SUBCLASSING -See also t/open311/endpoint/Endpoint1.pm as an example. + package My::Open311::Endpoint; + use Web::Simple; + extends 'Open311::Endpoint'; + +See also t/open311/endpoint/Endpoint1.pm and Endpoint2.pm as examples. =head2 methods to override @@ -202,6 +206,11 @@ has schema => ( }, ); +sub learn_additional_types { + # my ($self, $rx) = @_; + ## no-op, but override in ::Role or implementation! +} + has spark => ( is => 'lazy', default => sub { @@ -232,6 +241,12 @@ has w3_dt => ( default => sub { DateTime::Format::W3CDTF->new }, ); +sub maybe_inflate_datetime { + my ($self, $dt) = @_; + return unless $dt; + return $self->w3_dt->parse_datetime($dt); +} + =head2 Dispatching The method dispatch_request returns a list of all the dispatcher routines |