From a890dfa744d115692d97fab7e224dcfc57ac546b Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Thu, 30 Jan 2014 13:39:21 -0500 Subject: [PATCH] Code cleanup. --- lib/geocoder/lookups/bing.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/geocoder/lookups/bing.rb b/lib/geocoder/lookups/bing.rb index ce78da80..92628283 100644 --- a/lib/geocoder/lookups/bing.rb +++ b/lib/geocoder/lookups/bing.rb @@ -23,13 +23,11 @@ module Geocoder::Lookup private # --------------------------------------------------------------- def base_url(query) - ["#{protocol}://dev.virtualearth.net/REST/v1/Locations", - query.options[:region], - sanitized_text(query)].compact.join("/") + "?" - end - - def sanitized_text(query) - URI.escape(query.sanitized_text.strip) if !query.reverse_geocode? + url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations" + if !query.reverse_geocode? and r = query.options[:region] + url << "/#{r}" + end + url + "/" + URI.escape(query.sanitized_text.strip) + "?" end def results(query) @@ -47,8 +45,7 @@ module Geocoder::Lookup def query_url_params(query) { - :key => configuration.api_key, - :query => query.reverse_geocode? ? query.sanitized_text : nil + key: configuration.api_key }.merge(super) end end -- GitLab