Ruby SDK
The IPWho Ruby SDK wraps the IP geolocation API in idiomatic Ruby — typed response objects, built-in error classes, and a single gem install. One call returns the full payload: geolocation, timezone, currency, connection (ASN/ISP), security flags, and more.
- Source: lavrox/SDK-IPWho-IP-Geolocation-Ruby
- RubyGems:
ipwho1.0.0 - API key: ipwho.org/free-plan
Installation
Section titled “Installation”gem install ipwhogem "ipwho"Ruby >= 2.5, Faraday. Client: IpwhoApi::Client.
Quick start
Section titled “Quick start”require "ipwho"
client = IpwhoApi::Client.new(ENV.fetch("IPWHO_API_KEY"))
res = client.lookup("8.8.8.8") # GET /ip/{ip}me = client.me # GET /mebulk = client.bulk(["8.8.8.8", "1.1.1.1"]) # GET /bulk/{a,b,c}
puts res.data.geoLocation.country # United StatesError handling
Section titled “Error handling”begin res = client.lookup("8.8.8.8")rescue IpwhoApi::Errors::InvalidIPError # malformed IP address (404)rescue IpwhoApi::Errors::RateLimitError # plan limit reached (429)rescue IpwhoApi::Errors::APIResponseError # unexpected responseendMethods
Section titled “Methods”lookup(ip)—GET /ip/{ip}me—GET /mebulk(ips)—GET /bulk/{a,b,c}; rows ondata.responseArray