aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/Endpoint/Service/Request/Update.pm
diff options
context:
space:
mode:
authorHakim Cassimally <hakim@mysociety.org>2014-05-15 15:53:34 +0000
committerHakim Cassimally <hakim@mysociety.org>2014-10-16 16:56:26 +0000
commit06a69fa7a7e9fae205df36ddc68d131d91533792 (patch)
tree202a8451cc6539ff8f15652d0e15f53dedfa614c /perllib/Open311/Endpoint/Service/Request/Update.pm
parentd1fee928f02dbc30d3a38b746155ce5b12be4a1b (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/Service/Request/Update.pm')
-rw-r--r--perllib/Open311/Endpoint/Service/Request/Update.pm57
1 files changed, 57 insertions, 0 deletions
diff --git a/perllib/Open311/Endpoint/Service/Request/Update.pm b/perllib/Open311/Endpoint/Service/Request/Update.pm
new file mode 100644
index 000000000..b881af9ce
--- /dev/null
+++ b/perllib/Open311/Endpoint/Service/Request/Update.pm
@@ -0,0 +1,57 @@
+package Open311::Endpoint::Service::Request::Update;
+use Moo;
+use Types::Standard ':all';
+use namespace::clean;
+
+sub BUILDARGS {
+ my ($class, %args) = @_;
+ my $service_request = delete $args{service_request};
+
+ if (! $args{status}) {
+ $args{status} = $service_request->status;
+ }
+
+ return \%args;
+}
+
+has update_id => (
+ is => 'ro',
+ isa => Maybe[Str],
+ predicate => 1,
+);
+
+has service_request_id => (
+ is => 'ro',
+ isa => Maybe[Str],
+ predicate => 1,
+);
+
+has token => (
+ is => 'ro',
+ isa => Maybe[Str],
+ predicate => 1,
+);
+
+has status => (
+ is => 'ro',
+ isa => Enum[qw/ open closed /],
+);
+
+has description => (
+ is => 'ro',
+ isa => Maybe[Str],
+);
+
+has media_url => (
+ is => 'ro',
+ isa => Str,
+ default => sub { '' },
+);
+
+has updated_datetime => (
+ is => 'ro',
+ isa => InstanceOf['DateTime'],
+ default => sub { DateTime->now() },
+);
+
+1;