From 4899fb7052a3e6f3bd10716a74ebdf3e03508227 Mon Sep 17 00:00:00 2001 From: Dave Krupinski <dave@davekrupinski.com> Date: Sun, 6 May 2012 21:04:06 -0700 Subject: [PATCH] Enable the :showpostal option for GeocoderCA lookups. --- lib/geocoder/lookups/geocoder_ca.rb | 1 + test/lookup_test.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/geocoder/lookups/geocoder_ca.rb b/lib/geocoder/lookups/geocoder_ca.rb index afaf147c..32ea293a 100644 --- a/lib/geocoder/lookups/geocoder_ca.rb +++ b/lib/geocoder/lookups/geocoder_ca.rb @@ -33,6 +33,7 @@ module Geocoder::Lookup params[:reverse] = 1 else params[:locate] = query + params[:showpostal] = 1 end "http://geocoder.ca/?" + hash_to_query(params) end diff --git a/test/lookup_test.rb b/test/lookup_test.rb index 3c72d05b..0b627c71 100644 --- a/test/lookup_test.rb +++ b/test/lookup_test.rb @@ -27,4 +27,11 @@ class LookupTest < Test::Unit::TestCase g = Geocoder::Lookup::Yahoo.new assert_match "appid=MY_KEY", g.send(:query_url, "Madison Square Garden, New York, NY 10001, United States") end + + def test_geocoder_ca_showpostal + Geocoder::Configuration.api_key = "MY_KEY" + g = Geocoder::Lookup::GeocoderCa.new + assert_match "showpostal=1", g.send(:query_url, "Madison Square Garden, New York, NY 10001, United States") + end + end -- GitLab