aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Integrations/Echo.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-06-19 14:56:07 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:29:20 +0000
commitd90e1157ee31c374248da0db42b70456c37ddd5b (patch)
tree40ca64ade09bc11fc9cae0064b46d05e6fd6ee2e /perllib/Integrations/Echo.pm
parentd7aca19faade6fb8f4aa47213d0f38b14cb9854a (diff)
[Bromley] Look for open events.
Diffstat (limited to 'perllib/Integrations/Echo.pm')
-rw-r--r--perllib/Integrations/Echo.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/perllib/Integrations/Echo.pm b/perllib/Integrations/Echo.pm
index 7dc2e6948..205e1178f 100644
--- a/perllib/Integrations/Echo.pm
+++ b/perllib/Integrations/Echo.pm
@@ -291,6 +291,46 @@ sub GetServiceTaskInstances {
return force_arrayref($res, 'ServiceTaskInstances');
}
+sub GetEventsForObject {
+ my ($self, $id, $type) = @_;
+ my $from = DateTime->now->set_time_zone(FixMyStreet->local_time_zone)->subtract(months => 3);
+ return [ {
+ # Missed collection for service 542
+ EventTypeId => 2100,
+ ServiceId => 542,
+ }, {
+ # Request for a new paper container
+ EventTypeId => 2104,
+ Data => { ExtensibleDatum => [
+ { Value => 2, DatatypeName => 'Source' },
+ {
+ ChildData => { ExtensibleDatum => [
+ { Value => 1, DatatypeName => 'Action' },
+ { Value => 12, DatatypeName => 'Container Type' },
+ ] },
+ },
+ ] },
+ ServiceId => 535,
+ } ] if $self->sample_data;
+ # uncoverable statement
+ my $res = $self->call('GetEventsForObject',
+ objectRef => ixhash(
+ Key => 'Id',
+ Type => 'PointAddress',
+ Value => { 'msArray:anyType' => $id },
+ ),
+ query => ixhash(
+ $type ? (EventTypeRef => ixhash(
+ Key => 'Id',
+ Type => 'EventType',
+ Value => { 'msArray:anyType' => $type },
+ )) : (),
+ From => dt_to_hash($from),
+ ),
+ );
+ return force_arrayref($res, 'Event');
+}
+
sub ixhash {
tie (my %data, 'Tie::IxHash', @_);
return \%data;