- def self.IPToCountry(ip_address)
- Timer.timeout(4) do
- ipinfo = Quova::IpInfo.new(ip_address)
-
- if ipinfo.status == Quova::Success then
- country = ipinfo.country_code
- else
- Net::HTTP.start('api.hostip.info') do |http|
- country = http.get("/country.php?ip=#{ip_address}").body
- country = "GB" if country == "UK"
- end
- end
+ def self.ip_to_country(ip_address)
+ ipinfo = geoip_database.country(ip_address) if defined?(GEOIP_DATABASE)