Bandwidth is very picky about city and state/province names

Stephen Paul Weber created

So transform reasonable things into what we know Bandwidth expects.

Change summary

lib/tel_selections.rb | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Detailed changes

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