diff --git a/lib/geocoder/lookups/google.rb b/lib/geocoder/lookups/google.rb index 337e31349432694fa17a342812552b8d34dd0f9a..d87f79bf506eaacd8d9bef4d65cefc5d1acd4051 100644 --- a/lib/geocoder/lookups/google.rb +++ b/lib/geocoder/lookups/google.rb @@ -16,13 +16,13 @@ module Geocoder::Lookup "#{protocol}://maps.googleapis.com/maps/api/geocode/json?" + url_query_string(query) end + private # --------------------------------------------------------------- + def valid_response?(response) status = parse_json(response.body)["status"] super(response) and ['OK', 'ZERO_RESULTS'].include?(status) end - private # --------------------------------------------------------------- - def results(query) return [] unless doc = fetch_data(query) case doc['status']; when "OK" # OK status implies >0 results