diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-22 17:20:10 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-07-06 12:23:14 +0100 |
commit | c7dbb65e2d01e37f276af3db0372123366b3a1a1 (patch) | |
tree | cb4874cb87ea4c6a02a9004b29a86e21a7ef2382 /bin | |
parent | 64335826ec42217e1a9a98c0dbc1f13ec034ddb4 (diff) |
Rewrite open311-update-reports to share code.
Make GetUpdates and GetServiceRequestUpdates share a common base;
spot all visible states.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/open311-update-reports | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/bin/open311-update-reports b/bin/open311-update-reports index 2d384b813..b9b4d594d 100755 --- a/bin/open311-update-reports +++ b/bin/open311-update-reports @@ -8,6 +8,7 @@ use strict; use warnings; +use v5.14; BEGIN { use File::Basename qw(dirname); @@ -16,21 +17,21 @@ BEGIN { require "$d/../setenv.pl"; } +use Getopt::Long::Descriptive; use Open311::GetUpdates; -use FixMyStreet; -use FixMyStreet::DB; -# FIXME - make this configurable and/or better -my $system_user = FixMyStreet::DB->resultset('User')->find_or_create( - { - email => FixMyStreet->config('CONTACT_EMAIL'), - name => 'System User', - } +my ($opts, $usage) = describe_options( + '%c %o', + ['body|b:s', 'body name to only fetch this body' ], + ['verbose|v', 'more verbose output'], + ['help|h', "print usage message and exit" ], ); +$usage->die if $opts->help; -my $body_list = FixMyStreet::DB->resultset('Body'); +my %params = ( + verbose => $opts->verbose, + body => $opts->body, +); -my $update = Open311::GetUpdates->new( - body_list => $body_list, - system_user => $system_user -)->get_updates; +my $updates = Open311::GetUpdates->new(%params); +$updates->fetch; |