diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-10-08 22:29:01 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-10-09 11:55:38 +0100 |
commit | 097b57c516231b5c500ab521af5d52cf403ea88e (patch) | |
tree | 77574a4c1f359ab796796854046343e72e9d9284 /perllib/Open311/GetServiceRequestUpdates.pm | |
parent | 2827f68c5ca7cf98d89dc7ae28277aa27e87fb06 (diff) |
[Open311] More testing of GetServiceRequestUpdates
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index bef1aca67..c6da37790 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -18,7 +18,7 @@ Readonly::Scalar my $AREA_ID_BROMLEY => 2482; Readonly::Scalar my $AREA_ID_OXFORDSHIRE => 2237; sub fetch { - my $self = shift; + my ($self, $open311) = @_; my $bodies = $self->schema->resultset('Body')->search( { @@ -31,25 +31,23 @@ sub fetch { while ( my $body = $bodies->next ) { - my $o = Open311->new( - endpoint => $body->endpoint, - api_key => $body->api_key, - jurisdiction => $body->jurisdiction, + my %open311_conf = ( + endpoint => $body->endpoint, + api_key => $body->api_key, + jurisdiction => $body->jurisdiction, extended_statuses => $body->send_extended_statuses, ); - # custom endpoint URLs because these councils have non-standard paths - if ( $body->areas->{$AREA_ID_BROMLEY} ) { - my $endpoints = $o->endpoints; - $endpoints->{update} = 'update.xml'; - $endpoints->{service_request_updates} = 'update.xml'; - $o->endpoints( $endpoints ); - } + my $cobrand = $body->get_cobrand_handler; + $cobrand->call_hook(open311_config_updates => \%open311_conf) + if $cobrand; + + $open311 //= Open311->new(%open311_conf); $self->suppress_alerts( $body->suppress_alerts ); $self->blank_updates_permitted( $body->blank_updates_permitted ); $self->system_user( $body->comment_user ); - $self->update_comments( $o, $body ); + $self->update_comments( $open311, $body ); } } |