class Geokit::Geocoders::GeobytesGeocoder
Provides geocoding based upon an IP address. The underlying web service is GeoSelect
Public Class Methods
do_geocode(ip, _=nil)
click to toggle source
# File lib/geokit/geocoders/geobytes.rb, line 5 def self.do_geocode(ip, _=nil) process :json, ip end
parse_json(json)
click to toggle source
# File lib/geokit/geocoders/geobytes.rb, line 13 def self.parse_json(json) loc = new_loc loc.city = json['geobytescity'] loc.country_code = json['geobytesinternet'] loc.full_address = json['geobytesfqcn'] loc.lat = json['geobyteslatitude'] loc.lng = json['geobyteslongitude'] loc.state = json['geobytescode'] loc.precision = json['geobytescertainty'] loc.state_name = json['geobytesregion'] loc.success = !json['geobytescity'].empty? loc end
submit_url(ip)
click to toggle source
# File lib/geokit/geocoders/geobytes.rb, line 9 def self.submit_url(ip) "http://getcitydetails.geobytes.com/GetCityDetails?fqcn=#{ip}" end