Module: IpgeobaseExample

Defined in:
lib/ipgeobase_example.rb,
lib/ipgeobase_example/version.rb,
lib/ipgeobase_example/response.rb

Defined Under Namespace

Classes: Response

Constant Summary collapse

URL =
'http://ipgeobase.ru:7020/geo'
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.lookup(ip) ⇒ Object

Your code goes here…



10
11
12
13
14
15
# File 'lib/ipgeobase_example.rb', line 10

def self.lookup(ip)
  uri = URI.parse(URL)
  uri.query = URI.encode_www_form :ip => ip
  response = Net::HTTP.get(uri)
  Response.parse(response)
end