lib/geokit/geocoders/bing.rb in geokit-1.8.0 vs lib/geokit/geocoders/bing.rb in geokit-1.8.1

- old
+ new

@@ -1,10 +1,11 @@ module Geokit module Geocoders # Bing geocoder implementation. Requires the Geokit::Geocoders::bing variable to # contain a Bing Maps API key. Conforms to the interface set by the Geocoder class. class BingGeocoder < Geocoder + config :key, :options private # Template method which does the geocode lookup. def self.do_geocode(address) @@ -15,14 +16,13 @@ logger.debug "Bing geocoding. Address: #{address}. Result: #{xml}" parse :xml, xml end def self.submit_url(address) - options = Geokit::Geocoders::bing_options culture = options && options[:culture] culture_string = culture ? "&c=#{culture}" : '' address_str = address.is_a?(GeoLoc) ? address.to_geocodeable_s : address - "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address_str)}?key=#{Geokit::Geocoders::bing}#{culture_string}&o=xml" + "http://dev.virtualearth.net/REST/v1/Locations/#{URI.escape(address_str)}?key=#{key}#{culture_string}&o=xml" end def self.parse_xml(xml) return GeoLoc.new if xml.elements['//Response/StatusCode'].try(:text) != '200' loc = nil