Skip to content

Instantly share code, notes, and snippets.

Created December 31, 2015 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a31548037bf8873845b8 to your computer and use it in GitHub Desktop.
Save anonymous/a31548037bf8873845b8 to your computer and use it in GitHub Desktop.
geoInfo = @geo.city(query)
asnInfo = @isp.asn(query)
p geoInfo # #<struct GeoIP::City request="google.com", ip="208.117.229.217", country_code2="US", country_code3="USA", country_name="United States", continent_code="NA", region_name="CA", city_name="Mountain View", postal_code="94043", latitude=37.41919999999999, longitude=-122.0574, dma_code=807, area_code=650, timezone="America/Los_Angeles", real_region_name="California">
geoInfo.each do |v|
p v
end
"%s [%s/%s] %s [%s/%s]" % [ # WORKS
geoInfo.ip,
geoInfo.country_name,
geoInfo.real_region_name,
geoInfo.city_name,
asnInfo.asn,
asnInfo.number
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment