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

Extract part of raw_response into query_url.

parent a1edf0f9
No related branches found
No related tags found
No related merge requests found
......@@ -58,15 +58,7 @@ module Geocoder
#
def raw_response(query, reverse = false)
return nil if query.blank?
# name parameter based on forward/reverse geocoding
param = reverse ? :latlng : :address
# build URL
params = { param => query, :sensor => "false" }
url = "http://maps.google.com/maps/api/geocode/json?" + params.to_query
# query geocoder and make sure it responds quickly
url = query_url(query, reverse)
begin
resp = nil
timeout(3) do
......@@ -76,5 +68,13 @@ module Geocoder
return nil
end
end
def query_url(query, reverse = false)
params = {
(reverse ? :latlng : :address) => query,
:sensor => "false"
}
"http://maps.google.com/maps/api/geocode/json?" + params.to_query
end
end
end
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