class MaxmindCity
Constants
- VERSION
Public Class Methods
license_key=( new_license_key )
click to toggle source
# File lib/maxmind_city.rb, line 10 def self.license_key=( new_license_key ) @@license_key = new_license_key end
lookup( ip )
click to toggle source
# File lib/maxmind_city.rb, line 14 def self.lookup( ip ) self.parse_response( self.get("/b", :query => {:l => @@license_key, :i => ip}) ) end
parse_response( response )
click to toggle source
# File lib/maxmind_city.rb, line 20 def self.parse_response( response ) { :country_code => response.split(",")[0], :region_code => response.split(",")[1], :city => response.split(",")[2], :latitude => response.split(",")[3], :longitude => response.split(",")[4] } end