diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-11-12 17:04:22 +0000 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-11-12 17:24:56 +0000 |
commit | 92386ae67d6d5f7af92234136a7cde5d02650ae4 (patch) | |
tree | d0d820424fc65233f64c5a976c1226c52499cf7c /bin | |
parent | 4a10007c445be830d2cfc9d06652d379d72f82db (diff) |
[Bromley] Factor parallel calling to external script.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fixmystreet.com/bromley-echo | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/fixmystreet.com/bromley-echo b/bin/fixmystreet.com/bromley-echo new file mode 100755 index 000000000..01fdec110 --- /dev/null +++ b/bin/fixmystreet.com/bromley-echo @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +# bromley-echo +# Call the Echo API in parallel + +use v5.14; +use warnings; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../../setenv.pl"; +} + +use Getopt::Long::Descriptive; +use JSON::MaybeXS; +use Storable; +use FixMyStreet::Cobrand::Bromley; + +my ($opts, $usage) = describe_options( + '%c %o', + ['out=s', 'where to output CSV data'], + ['calls=s', 'JSON of what API calls to make'], + ['help|h', "print usage message and exit" ], +); +$usage->die if $opts->help; + +my $cobrand = FixMyStreet::Cobrand::Bromley->new; + +my $calls = decode_json($opts->calls); +$calls = $cobrand->_parallel_api_calls(@$calls); +Storable::store($calls, $opts->out); |