Skip to content

Commit 14589ac

Browse files
committed
Add documentation for Core and Plus bundles and resproxy
1 parent 7c234f9 commit 14589ac

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

README.md

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# [<img src="https://ipinfo.io/static/ipinfo-small.svg" alt="IPinfo" width="24"/>](https://ipinfo.io/) IPinfo Ruby Client Library
22

33
This is the official Ruby client library for the [IPinfo.io](https://ipinfo.io) IP address API, allowing you to look up your own IP address, or get any of the following details for an IP:
4-
- [IP geolocation data](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)
5-
- [ASN information](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)
6-
- [Firmographic data](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)
7-
- [Carrier details](https://ipinfo.io/ip-carrier-api) (the name of the mobile carrier and MNC and MCC for that carrier if the IP is used exclusively for mobile traffic)
4+
5+
- [IP geolocation data](https://ipinfo.io/ip-geolocation-api) (city, region, country, postal code, latitude, and longitude)
6+
- [ASN information](https://ipinfo.io/asn-api) (ISP or network operator, associated domain name, and type, such as business, hosting, or company)
7+
- [Firmographic data](https://ipinfo.io/ip-company-api) (the name and domain of the business that uses the IP address)
8+
- [Carrier details](https://ipinfo.io/ip-carrier-api) (the name of the mobile carrier and MNC and MCC for that carrier if the IP is used exclusively for mobile traffic)
89

910
Check all the data we have for your IP address [here](https://ipinfo.io/what-is-my-ip).
1011

@@ -234,6 +235,58 @@ details.country_code # US
234235
details.country # United States
235236
```
236237

238+
### Core API
239+
240+
The library also supports the [Core API](https://ipinfo.io/developers/data-types#core-data), which provides city-level geolocation with nested geo and AS objects. Authentication with your token is required.
241+
242+
```ruby
243+
require 'ipinfo_core'
244+
245+
access_token = '123456789abc'
246+
handler = IPinfoCore::create(access_token)
247+
248+
details = handler.details('8.8.8.8')
249+
details.ip # 8.8.8.8
250+
details.geo['city'] # Mountain View
251+
details.geo['country'] # United States
252+
details.as['asn'] # AS15169
253+
details.as['name'] # Google LLC
254+
```
255+
256+
### Plus API
257+
258+
The library also supports the [Plus API](https://ipinfo.io/developers/data-types#plus-data), which provides enhanced data including mobile carrier info and privacy detection. Authentication with your token is required.
259+
260+
```ruby
261+
require 'ipinfo_plus'
262+
263+
access_token = '123456789abc'
264+
handler = IPinfoPlus::create(access_token)
265+
266+
details = handler.details('8.8.8.8')
267+
details.ip # 8.8.8.8
268+
details.geo['city'] # Mountain View
269+
details.mobile # mobile carrier info
270+
details.anonymous['is_proxy'] # false
271+
```
272+
273+
### Residential Proxy API
274+
275+
The library also supports the [Residential Proxy API](https://ipinfo.io/developers/residential-proxy-api), which allows you to check if an IP address is a residential proxy. Authentication with your token is required.
276+
277+
```ruby
278+
require 'ipinfo'
279+
280+
access_token = '123456789abc'
281+
handler = IPinfo::create(access_token)
282+
283+
resproxy = handler.get_resproxy('175.107.211.204')
284+
resproxy.ip # 175.107.211.204
285+
resproxy.last_seen # 2025-01-20
286+
resproxy.percent_days_seen # 0.85
287+
resproxy.service # Bright Data
288+
```
289+
237290
#### Caching
238291

239292
In-memory caching of `details` data is provided by default via the
@@ -250,9 +303,9 @@ Cache behavior can be modified by setting the `cache_options` keyword argument.
250303
specified in the `cachetools` library. The nesting of keyword arguments is to
251304
prevent name collisions between this library and its dependencies.
252305

253-
* Default maximum cache size: 4096 (multiples of 2 are recommended to increase
306+
- Default maximum cache size: 4096 (multiples of 2 are recommended to increase
254307
efficiency)
255-
* Default TTL: 24 hours (in seconds)
308+
- Default TTL: 24 hours (in seconds)
256309

257310
```ruby
258311
token = '1234'

0 commit comments

Comments
 (0)