lib/geokit/geocoders/ca_geocoder.rb in geokit-1.10.0 vs lib/geokit/geocoders/ca_geocoder.rb in geokit-1.11.0
- old
+ new
@@ -15,32 +15,31 @@
config :key
private
# Template method which does the geocode lookup.
- def self.do_geocode(loc)
+ def self.do_geocode(loc, _=nil)
process :xml, submit_url(loc), GeoLoc.new
end
def self.parse_xml(xml, loc)
- loc.lat = xml.elements["//latt"].text
- loc.lng = xml.elements["//longt"].text
- loc.city = xml.elements["//city"].text
- loc.street_number = xml.elements["//stnumber"].text
- loc.street_address = xml.elements["//staddress"].text
- loc.state = xml.elements["//prov"].text
- loc.province = xml.elements["//prov"].text
- loc.zip = xml.elements["//postal"].text
+ loc.lat = xml.elements['//latt'].text
+ loc.lng = xml.elements['//longt'].text
+ loc.city = xml.elements['//city'].text
+ loc.street_number = xml.elements['//stnumber'].text
+ loc.street_address = xml.elements['//staddress'].text
+ loc.state = xml.elements['//prov'].text
+ loc.zip = xml.elements['//postal'].text
loc.success = true
loc
end
# Formats the request in the format acceptable by the CA geocoder.
def self.submit_url(loc)
args = ["locate=#{Geokit::Inflector.url_escape(loc)}"]
args << "auth=#{key}" if key
- args << "geoit=xml"
- "http://geocoder.ca/?" + args.join("&")
+ args << 'geoit=xml'
+ 'http://geocoder.ca/?' + args.join('&')
end
end
end
end