Skip to content
Snippets Groups Projects
Commit 7342234f authored by Alex Reisner's avatar Alex Reisner
Browse files

Force all SmartyStreets requests to use HTTPS.

parent 6c27706f
No related branches found
No related tags found
No related merge requests found
...@@ -580,7 +580,7 @@ Data Science Toolkit provides an API whose reponse format is like Google's but w ...@@ -580,7 +580,7 @@ Data Science Toolkit provides an API whose reponse format is like Google's but w
* **API key**: requires auth_id and auth_token (set `Geocoder.configure(:api_key => [id, token])`) * **API key**: requires auth_id and auth_token (set `Geocoder.configure(:api_key => [id, token])`)
* **Quota**: 10,000 free, 250/month then purchase at sliding scale. * **Quota**: 10,000 free, 250/month then purchase at sliding scale.
* **Region**: US * **Region**: US
* **SSL support**: yes * **SSL support**: yes (required)
* **Languages**: en * **Languages**: en
* **Documentation**: http://smartystreets.com/kb/liveaddress-api/rest-endpoint * **Documentation**: http://smartystreets.com/kb/liveaddress-api/rest-endpoint
* **Terms of Service**: http://smartystreets.com/legal/terms-of-service * **Terms of Service**: http://smartystreets.com/legal/terms-of-service
......
...@@ -18,6 +18,10 @@ module Geocoder::Lookup ...@@ -18,6 +18,10 @@ module Geocoder::Lookup
private # --------------------------------------------------------------- private # ---------------------------------------------------------------
def protocol
"https" # required by API as of 26 March 2015
end
def zipcode_only?(query) def zipcode_only?(query)
!query.text.is_a?(Array) and query.to_s.strip =~ /\A\d{5}(-\d{4})?\Z/ !query.text.is_a?(Array) and query.to_s.strip =~ /\A\d{5}(-\d{4})?\Z/
end end
......
...@@ -11,7 +11,7 @@ class SmartyStreetsTest < GeocoderTestCase ...@@ -11,7 +11,7 @@ class SmartyStreetsTest < GeocoderTestCase
def test_url_contains_api_key def test_url_contains_api_key
Geocoder.configure(:smarty_streets => {:api_key => 'blah'}) Geocoder.configure(:smarty_streets => {:api_key => 'blah'})
query = Geocoder::Query.new("Bluffton, SC") query = Geocoder::Query.new("Bluffton, SC")
assert_equal "http://api.smartystreets.com/street-address?auth-token=blah&street=Bluffton%2C+SC", query.url assert_equal "https://api.smartystreets.com/street-address?auth-token=blah&street=Bluffton%2C+SC", query.url
end end
def test_query_for_address_geocode def test_query_for_address_geocode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment