lib/ipgeobase.rb in ipgeobase-0.0.1 vs lib/ipgeobase.rb in ipgeobase-0.1.0
- old
+ new
@@ -1,14 +1,14 @@
require 'uri'
require 'net/http'
-require 'happymapper'
module Ipgeobase
- autoload 'Version', 'ipgeobase/version'
+ URL = 'http://ipgeobase.ru:7020/geo'
autoload 'IpMetaData', 'ipgeobase/ip_meta_data'
def self.lookup(ip)
- uri = URI.parse('http://ipgeobase.ru:7020/geo')
+ uri = URI.parse(URL)
uri.query = URI.encode_www_form :ip => ip
+
IpMetaData.parse(Net::HTTP.get(uri))
end
end