diff --git a/lib/geocoder/lookups/smarty_streets.rb b/lib/geocoder/lookups/smarty_streets.rb index 92065d61196a8c8bb5de88c5f47c947842cf2938..fa72318c9f7fdb9a8c439588f8ea6c23ab635f1e 100644 --- a/lib/geocoder/lookups/smarty_streets.rb +++ b/lib/geocoder/lookups/smarty_streets.rb @@ -12,8 +12,11 @@ module Geocoder::Lookup end def query_url(query) - path = zipcode_only?(query) ? "zipcode" : "street-address" - "#{protocol}://api.smartystreets.com/#{path}?#{url_query_string(query)}" + if zipcode_only?(query) + "#{protocol}://us-zipcode.api.smartystreets.com/lookup?#{url_query_string(query)}" + else + "#{protocol}://api.smartystreets.com/street-address?#{url_query_string(query)}" + end end # required by API as of 26 March 2015 diff --git a/test/unit/lookups/smarty_streets_test.rb b/test/unit/lookups/smarty_streets_test.rb index 04e19c43516587b09469b92e2a617e24c6c3717b..710efc4613812fa08d5d0e3e099c3dc8c4ea2487 100644 --- a/test/unit/lookups/smarty_streets_test.rb +++ b/test/unit/lookups/smarty_streets_test.rb @@ -21,12 +21,12 @@ class SmartyStreetsTest < GeocoderTestCase def test_query_for_zipcode_geocode query = Geocoder::Query.new("22204") - assert_match(/api\.smartystreets\.com\/zipcode\?/, query.url) + assert_match(/us-zipcode\.api\.smartystreets\.com\/lookup\?/, query.url) end def test_query_for_zipfour_geocode query = Geocoder::Query.new("22204-1603") - assert_match(/api\.smartystreets\.com\/zipcode\?/, query.url) + assert_match(/us-zipcode\.api\.smartystreets\.com\/lookup\?/, query.url) end def test_smarty_streets_result_components