Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

adamcooke/geolocate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Ruby library to return information about a given IP (currently using ip-api.com)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages