diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-01 10:47:11 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-04 17:50:55 +0100 |
commit | 98e61f99be442523fdfb38e95d9a8c2132ea0405 (patch) | |
tree | 4640cacbaf8392cb7c4df332a3a7bc6b19fb7b47 /perllib/FixMyStreet/MapIt.pm | |
parent | 8ca5583e62b1c24128b8d691a8b5f5236ce99eef (diff) |
Factor to common FixMyStreet::MapIt call.
Diffstat (limited to 'perllib/FixMyStreet/MapIt.pm')
-rw-r--r-- | perllib/FixMyStreet/MapIt.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/MapIt.pm b/perllib/FixMyStreet/MapIt.pm new file mode 100644 index 000000000..d0a5f4760 --- /dev/null +++ b/perllib/FixMyStreet/MapIt.pm @@ -0,0 +1,18 @@ +package FixMyStreet::MapIt; + +use FixMyStreet; +use mySociety::MaPit; + +sub call { + my ($url, $params, %opts) = @_; + + # 'area' always returns the ID you provide, no matter its generation, so no + # point in specifying it for that. 'areas' similarly if given IDs, but we + # might be looking up types or names, so might as well specify it then. + $opts{generation} = FixMyStreet->config('MAPIT_GENERATION') + if $url ne 'area' && FixMyStreet->config('MAPIT_GENERATION'); + + return mySociety::MaPit::call($url, $params, %opts); +} + +1; |