Module: Ipwhois

Defined in:
lib/ipwhois.rb,
lib/ipwhois/client.rb,
lib/ipwhois/version.rb

Overview

Top-level namespace for the ipwhois.io IP Geolocation API client.

Quick start


# Free plan (no API key, ~1 request/second per client IP)
client = Ipwhois::Client.new
info   = client.lookup('8.8.8.8')

# Paid plan (with API key, higher limits, bulk, security data, …)
client = Ipwhois::Client.new('YOUR_API_KEY')
info   = client.lookup('8.8.8.8', lang: 'en', security: true)

# Bulk lookup — up to 100 IPs in one call (paid only)
list = client.bulk_lookup(['8.8.8.8', '1.1.1.1', '208.67.222.222'])

# HTTPS is enabled by default. Pass `ssl: false` to fall back to HTTP.

Error handling


The library never raises. All errors — invalid input, network failure, API-level errors (bad IP, bad key, rate limit, …) — are returned in the response hash with ‘’success’ => false` and a ‘’message’‘. Just check `info` after every call.

Defined Under Namespace

Classes: Client

Constant Summary collapse

VERSION =

Gem version, used in the default User-Agent header.

'1.2.0'