Skip to content

Commit 9597170

Browse files
committed
Initial release
0 parents  commit 9597170

15 files changed

Lines changed: 1269 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Ruby ${{ matrix.ruby }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4']
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Ruby ${{ matrix.ruby }}
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: ${{ matrix.ruby }}
25+
bundler-cache: true
26+
27+
- name: Run tests
28+
run: bundle exec rake test

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ruby / Bundler
2+
/.bundle/
3+
/vendor/bundle/
4+
/vendor/cache/
5+
/pkg/
6+
*.gem
7+
*.rbc
8+
*.rbo
9+
*.log
10+
11+
# Test / coverage
12+
/coverage/
13+
/tmp/
14+
/log/
15+
/.yardoc/
16+
/doc/
17+
18+
# Bundler lockfile for gem library
19+
Gemfile.lock
20+
21+
# Environment / secrets
22+
.env
23+
.env.*
24+
!.env.example
25+
26+
# macOS
27+
.DS_Store
28+
.AppleDouble
29+
.LSOverride
30+
._*
31+
.Spotlight-V100
32+
.Trashes
33+
.fseventsd
34+
35+
# Editors / IDEs
36+
.idea/
37+
.vscode/
38+
*.swp
39+
*.swo
40+
*~

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
3+
All notable changes to the `ipwhois` gem will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.2.0] - 2026-05-12
9+
10+
### Added
11+
12+
- Initial public release of the `ipwhois` gem.
13+
- `Ipwhois::Client#lookup` — single IP lookup (IPv4 / IPv6, or current IP).
14+
- `Ipwhois::Client#bulk_lookup` — up to 100 IPs in a single GET request
15+
(paid plan).
16+
- Free plan (no API key, `ipwho.is`) and paid plan (with API key,
17+
`ipwhois.pro`) served by the same `Client` class.
18+
- HTTPS by default; `ssl: false` constructor option to fall back to HTTP.
19+
- Localisation (`:lang`), field filtering (`:fields`), threat detection
20+
(`:security`), rate-limit info (`:rate`).
21+
- Fluent client-wide defaults: `set_language`, `set_fields`, `set_security`,
22+
`set_rate`, `set_timeout`, `set_connect_timeout`, `set_user_agent` — each
23+
returns `self` and is chainable.
24+
- **The library never raises.** All errors — invalid input, network failure,
25+
API-level errors (bad IP, bad key, rate limit, …) — are returned in the
26+
response hash with `'success' => false` and a `'message'`. HTTP error
27+
responses are additionally enriched with `'http_status'`, and HTTP 429
28+
responses on the free plan with `'retry_after'`.
29+
- Every error response carries an `'error_type'` field: one of `'api'`,
30+
`'network'`, or `'invalid_argument'`, so callers can branch on the failure
31+
category with a single `info['error_type']` check.
32+
- Minitest test suite covering URL construction, IPv6 path encoding, and
33+
input validation. No real HTTP request is sent — the suite runs anywhere
34+
without an API key or network access.
35+
- No runtime dependencies — uses only the Ruby stdlib (`net/http`, `uri`,
36+
`json`, `openssl`).
37+
- Ruby `>= 3.0` requirement.

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
gemspec

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 ipwhois.io
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)