From 35aa3f7f85a8a06867e69659e554848b19d3e9d4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 22 Sep 2021 12:49:43 -0500 Subject: [PATCH] Bandwidth is very picky about city and state/province names So transform reasonable things into what we know Bandwidth expects. --- lib/tel_selections.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/tel_selections.rb b/lib/tel_selections.rb index 85a0a798503c31362214d65a20a508c88277a8ac..a587350bfb5d30c9e814e302d92fcd9e01fe64d2 100644 --- a/lib/tel_selections.rb +++ b/lib/tel_selections.rb @@ -188,9 +188,19 @@ class TelSelections class CityState Q.register(/\A([^,]+)\s*,\s*([A-Z]{2})\Z/, &method(:new)) + + CITY_MAP = { + "kitchener" => "Kitchener-Waterloo", + "waterloo" => "Kitchener-Waterloo" + }.freeze + + STATE_MAP = { + "QC" => "PQ" + }.freeze + def initialize(city, state) - @city = city - @state = state + @city = CITY_MAP.fetch(city.downcase, city) + @state = STATE_MAP.fetch(state, state) end def iris_query