class Geokit::Geocoders::GeoPluginGeocoder

Provides geocoding based upon an IP address. The underlying web service is geoplugin.net

Constants

XML_MAPPINGS

Private Class Methods

do_geocode(ip) click to toggle source
# File lib/geokit/geocoders/geo_plugin.rb, line 7
def self.do_geocode(ip)
  process :xml, ip
end
parse_xml(xml) click to toggle source
# File lib/geokit/geocoders/geo_plugin.rb, line 23
def self.parse_xml(xml)
  loc = new_loc
  set_mappings(loc, xml.elements["geoPlugin"], XML_MAPPINGS)
  loc.success = !!loc.city && !loc.city.empty?
  loc
end
submit_url(ip) click to toggle source
# File lib/geokit/geocoders/geo_plugin.rb, line 11
def self.submit_url(ip)
  "http://www.geoplugin.net/xml.gp?ip=#{ip}"
end