Sha256: 594787f312798003622175a1cf21dbecaa729f2d480220137731df88ca90ec95
Contents?: true
Size: 808 Bytes
Versions: 1
Compression:
Stored size: 808 Bytes
Contents
module Geokit module Geocoders # Provides geocoding based upon an IP address. The underlying web service is geoplugin.net class GeoPluginGeocoder < BaseIpGeocoder private def self.do_geocode(ip) process :xml, ip end def self.submit_url(ip) "http://www.geoplugin.net/xml.gp?ip=#{ip}" end XML_MAPPINGS = { city: 'geoplugin_city', state: 'geoplugin_region', country_code: 'geoplugin_countryCode', lat: 'geoplugin_latitude', lng: 'geoplugin_longitude' } 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geokit-1.9.0 | lib/geokit/geocoders/geo_plugin.rb |