diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-23 17:22:39 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-07-06 12:23:14 +0100 |
commit | da40423aa4877ddc130074cf1834da6d4c7dc38f (patch) | |
tree | 22a867049fbd25c635c5eb18e6794361823ec19c /perllib/FixMyStreet/App/Controller/Open311/Updates.pm | |
parent | c7dbb65e2d01e37f276af3db0372123366b3a1a1 (diff) |
Factor out/default Open311 construction object.
This simplifies the code wherever used.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Open311/Updates.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311/Updates.pm | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311/Updates.pm b/perllib/FixMyStreet/App/Controller/Open311/Updates.pm index 105400a8a..d5754bab7 100644 --- a/perllib/FixMyStreet/App/Controller/Open311/Updates.pm +++ b/perllib/FixMyStreet/App/Controller/Open311/Updates.pm @@ -3,7 +3,6 @@ package FixMyStreet::App::Controller::Open311::Updates; use utf8; use Moose; use namespace::autoclean; -use Open311; use Open311::GetServiceRequestUpdates; BEGIN { extends 'Catalyst::Controller'; } @@ -31,7 +30,6 @@ sub receive : Regex('^open311/v2/servicerequestupdates.(xml|json)$') : Args(0) { $body = $c->model('DB::Body')->find({ id => $c->get_param('jurisdiction_id') }); } $c->detach('bad_request', ['jurisdiction_id']) unless $body; - my $user = $body->comment_user; my $key = $c->get_param('api_key') || ''; my $token = $c->cobrand->feature('open311_token') || ''; @@ -45,21 +43,8 @@ sub receive : Regex('^open311/v2/servicerequestupdates.(xml|json)$') : Args(0) { $request->{$_} = $c->get_param($_) || $c->detach('bad_request', [ $_ ]); } - my %open311_conf = ( - endpoint => $body->endpoint, - api_key => $body->api_key, - jurisdiction => $body->jurisdiction, - extended_statuses => $body->send_extended_statuses, - ); - - my $cobrand = $body->get_cobrand_handler; - $cobrand->call_hook(open311_config_updates => \%open311_conf) - if $cobrand; - - my $open311 = Open311->new(%open311_conf); my $updates = Open311::GetServiceRequestUpdates->new( - system_user => $user, - current_open311 => $open311, + system_user => $body->comment_user, current_body => $body, ); |