Skip to content
A Ruby library to return information about a given IP (currently using ip-api.com)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
README.md
geolocate.gemspec

README.md

Geolocate

A Ruby library which will return information about a given IP using the ip-api.com API.

Installation

Add to your Gemfile as normal and then bundle to install.

gem "geolocate", "~> 1.0"

Usage

if result = Geolocate.find_from_ip('185.22.208.1', :timeout => 4)
  result.country          #=> "United Kingdom"
  result.country_code     #=> "GB"
  result.city             #=> "Poole"
  result.time_zone        #=> "Europe/London"
  result.latitude         #=> 50.7324
  result.longitude        #=> -1.9753
  result.isp              #=> "Atech Media Ltd"
  result.organization     #=> "Atech Media Ltd"
else
  # Failed to do the lookup after 4 seconds maximum.
end
You can’t perform that action at this time.