if ipinfo
country = ipinfo.country_code2
else
- country = http_client.get("http://api.hostip.info/country.php?ip=#{ip_address}").body
+ country = http_client.get("https://api.hostip.info/country.php?ip=#{ip_address}").body
country = "GB" if country == "UK"
end
- return country
+ country
rescue StandardError
- return nil
+ nil
end
def self.ip_location(ip_address)