internetdata 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -0
- data/lib/internetdata/api/database_v2_api.rb +5 -5
- data/lib/internetdata/api_client.rb +3 -3
- data/lib/internetdata/api_error.rb +3 -3
- data/lib/internetdata/api_model_base.rb +3 -3
- data/lib/internetdata/client.rb +5 -2
- data/lib/internetdata/configuration.rb +3 -3
- data/lib/internetdata/errors.rb +55 -13
- data/lib/internetdata/models/database.rb +8 -8
- data/lib/internetdata/models/database_checksums_response.rb +3 -3
- data/lib/internetdata/models/database_format.rb +3 -3
- data/lib/internetdata/models/database_list.rb +3 -3
- data/lib/internetdata/models/database_metadata.rb +3 -3
- data/lib/internetdata/models/database_metadata_column.rb +3 -3
- data/lib/internetdata/models/database_version.rb +3 -3
- data/lib/internetdata/models/db_checksums.rb +3 -3
- data/lib/internetdata/models/device_authorization.rb +282 -0
- data/lib/internetdata/models/download.rb +3 -3
- data/lib/internetdata/models/download_list.rb +3 -3
- data/lib/internetdata/models/error_envelope.rb +3 -3
- data/lib/internetdata/models/oauth_metadata.rb +309 -0
- data/lib/internetdata/models/standing.rb +3 -3
- data/lib/internetdata/models/token_response.rb +258 -0
- data/lib/internetdata/oauth_api.rb +166 -0
- data/lib/internetdata/transport.rb +63 -0
- data/lib/internetdata/version.rb +1 -1
- data/lib/internetdata.rb +1 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7297574e75072216b4bc6de21ae97563873d2a8aac243f8f83961e84f3832cb7
|
|
4
|
+
data.tar.gz: 19f7135e1781940562401dc64d94f9238264d00c8597f17b18102bbe649da32a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 763bea6cada7ee68b35da1268a0b267397b414a900d3771275bdcd86f27a73c2fb66802a4568e4d60a15c4cee224c755dc53cb4fdcf3d4c8fc5475f10f2ced4c
|
|
7
|
+
data.tar.gz: 4dada1a18466fee2d4cb2d0426a0eb897debcb1684e721f1cecce596eefd079f3fed35d0759ecf2cdf34ee688bc564a16fc3175a033701e983f494014e3a0662
|
data/README.md
CHANGED
|
@@ -120,6 +120,23 @@ end
|
|
|
120
120
|
|
|
121
121
|
Note that `:rate_limited` and `:quota_exceeded` both arrive as HTTP 429 and are not the same thing. A rate limit is the API facing a burst, so retrying later works; a spent quota needs your allowance raised or the window to roll over. The library retries the first for you and never the second.
|
|
122
122
|
|
|
123
|
+
### Sign in with OAuth (device flow)
|
|
124
|
+
|
|
125
|
+
A program running on a person's own machine can let them sign in with their browser and pick one of their API keys, instead of asking them to paste one.
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
client = InternetData::Client.new
|
|
129
|
+
device = client.oauth.device_authorization('your-client-id', scope: 'account.read apikeys.read apikeys.reveal')
|
|
130
|
+
puts "Open #{device.verification_uri} and enter #{device.user_code}"
|
|
131
|
+
|
|
132
|
+
token = client.oauth.poll_device_token('your-client-id', device)
|
|
133
|
+
raise 'no API key was picked' if token.apikey.nil?
|
|
134
|
+
|
|
135
|
+
keyed = InternetData::Client.new(api_key: token.apikey)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`poll_device_token` raises `InternetData::OauthAccessDeniedError` when the person refuses and `InternetData::OauthExpiredTokenError` when the code expires first. Client IDs are issued on request from support@internetdata.io, and `client.oauth.revoke('your-client-id', token.refresh_token)` signs the machine out.
|
|
139
|
+
|
|
123
140
|
## Other Libraries
|
|
124
141
|
|
|
125
142
|
There are official InternetData client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails, and Laravel. See our GitHub at https://github.com/internetdata for more.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -241,7 +241,7 @@ module InternetData
|
|
|
241
241
|
end
|
|
242
242
|
|
|
243
243
|
# List
|
|
244
|
-
# The whole published catalog, with your organization's
|
|
244
|
+
# The whole published catalog, with your organization's license beside each entry, so `standing` says whether a database is yours today (`licensed`), was (`expired`), or has never been bought (`unlicensed`).
|
|
245
245
|
# @param [Hash] opts the optional parameters
|
|
246
246
|
# @return [DatabaseList]
|
|
247
247
|
def list_databases(opts = {})
|
|
@@ -250,7 +250,7 @@ module InternetData
|
|
|
250
250
|
end
|
|
251
251
|
|
|
252
252
|
# List
|
|
253
|
-
# The whole published catalog, with your organization's
|
|
253
|
+
# The whole published catalog, with your organization's license beside each entry, so `standing` says whether a database is yours today (`licensed`), was (`expired`), or has never been bought (`unlicensed`).
|
|
254
254
|
# @param [Hash] opts the optional parameters
|
|
255
255
|
# @return [Array<(DatabaseList, Integer, Hash)>] DatabaseList data, response status code and response headers
|
|
256
256
|
def list_databases_with_http_info(opts = {})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
data/lib/internetdata/client.rb
CHANGED
|
@@ -12,13 +12,15 @@ module InternetData
|
|
|
12
12
|
# Every database published today needs an API key carrying the `db.download`
|
|
13
13
|
# scope, granted by contract one family at a time. The key is still OPTIONAL:
|
|
14
14
|
# a client built without one sends no `Authorization` header at all, which is
|
|
15
|
-
# what a database served without a license would need.
|
|
15
|
+
# what a database served without a license would need, and `oauth` needs none.
|
|
16
16
|
class Client
|
|
17
17
|
# The licensed database downloads, and everything about them.
|
|
18
18
|
attr_reader :database
|
|
19
|
+
# Signing a person in with OAuth, which needs no API key at all.
|
|
20
|
+
attr_reader :oauth
|
|
19
21
|
|
|
20
22
|
# @param api_key [String, nil] a key carrying the `db.download` scope. Omit
|
|
21
|
-
# it and no credential is sent; every
|
|
23
|
+
# it and no credential is sent; every database published today answers 401.
|
|
22
24
|
# @param retries [Integer] extra attempts for a transient failure.
|
|
23
25
|
# @param timeout [Numeric] seconds allowed for one API call. It also bounds the
|
|
24
26
|
# CONNECT phase of a transfer, which is otherwise unlimited.
|
|
@@ -29,6 +31,7 @@ module InternetData
|
|
|
29
31
|
Transport::Config.new(api_key: api_key, base_url: base_url, timeout: timeout),
|
|
30
32
|
)
|
|
31
33
|
@database = DatabaseApi.new(@transport, retries: retries)
|
|
34
|
+
@oauth = OauthApi.new(@transport, retries: retries)
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
data/lib/internetdata/errors.rb
CHANGED
|
@@ -43,25 +43,26 @@ module InternetData
|
|
|
43
43
|
rc = rc_of(body)
|
|
44
44
|
message ||= rc || "request failed with status #{status}"
|
|
45
45
|
retry_after = parse_retry_after(header(headers, 'retry-after'))
|
|
46
|
+
kind = kind_for(status, headers)
|
|
46
47
|
|
|
48
|
+
new(kind, message, status: status, rc: rc, retry_after_seconds: kind == :rate_limited ? retry_after : nil)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# What a response with this status is, whatever its body says.
|
|
52
|
+
def self.kind_for(status, headers)
|
|
47
53
|
case status
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
new(:rate_limited, message, status: status, rc: rc, retry_after_seconds: retry_after)
|
|
55
|
-
end
|
|
56
|
-
when 400 then new(:bad_request, message, status: status, rc: rc)
|
|
57
|
-
when 401 then new(:unauthorized, message, status: status, rc: rc)
|
|
58
|
-
when 403 then new(:forbidden, message, status: status, rc: rc)
|
|
54
|
+
# Present means transient, absent means an allowance is spent. Nothing
|
|
55
|
+
# else in the response separates the two.
|
|
56
|
+
when 429 then parse_retry_after(header(headers, 'retry-after')).nil? ? :quota_exceeded : :rate_limited
|
|
57
|
+
when 400 then :bad_request
|
|
58
|
+
when 401 then :unauthorized
|
|
59
|
+
when 403 then :forbidden
|
|
59
60
|
# Every other 4xx is a CLIENT error. Classifying on the RANGE rather than
|
|
60
61
|
# on an enumerated list is what keeps a 404 from an unknown database id
|
|
61
62
|
# falling through to the retryable server_error default and being retried
|
|
62
63
|
# twice before it fails.
|
|
63
|
-
when 400..499 then
|
|
64
|
-
else
|
|
64
|
+
when 400..499 then :bad_request
|
|
65
|
+
else :server_error
|
|
65
66
|
end
|
|
66
67
|
end
|
|
67
68
|
|
|
@@ -107,4 +108,45 @@ module InternetData
|
|
|
107
108
|
|
|
108
109
|
private_class_method :header, :rc_of, :parse_retry_after
|
|
109
110
|
end
|
|
111
|
+
|
|
112
|
+
# The authorization server refusing an OAuth request: a 4xx whose body names an
|
|
113
|
+
# RFC 6749 `error` code. Never retryable, whatever the status, because every
|
|
114
|
+
# code it can carry answers the request as it was made.
|
|
115
|
+
#
|
|
116
|
+
# Not `OauthError`, the name the spec gives the error body, so the class keeps
|
|
117
|
+
# the same name in both brands' gems.
|
|
118
|
+
class OauthRequestError < Error
|
|
119
|
+
# The `error` code, such as `slow_down` or `invalid_grant`.
|
|
120
|
+
attr_reader :error_code
|
|
121
|
+
# `error_description` when the server sent one as a string, otherwise nil.
|
|
122
|
+
attr_reader :error_description
|
|
123
|
+
|
|
124
|
+
# The refusal a response carries, as the most specific class its code has.
|
|
125
|
+
def self.for_code(error_code, error_description, status:, headers: {})
|
|
126
|
+
klass = case error_code
|
|
127
|
+
when 'access_denied' then OauthAccessDeniedError
|
|
128
|
+
when 'expired_token' then OauthExpiredTokenError
|
|
129
|
+
else OauthRequestError
|
|
130
|
+
end
|
|
131
|
+
klass.new(error_code, error_description, kind: Error.kind_for(status, headers), status: status)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def initialize(error_code, error_description = nil, kind: :bad_request, status: nil)
|
|
135
|
+
super(kind, error_description.nil? ? error_code : "#{error_code}: #{error_description}", status: status)
|
|
136
|
+
@error_code = error_code
|
|
137
|
+
@error_description = error_description
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def retryable?
|
|
141
|
+
false
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# The person refused the sign-in. Their device code is spent.
|
|
146
|
+
class OauthAccessDeniedError < OauthRequestError; end
|
|
147
|
+
|
|
148
|
+
# The device code is no longer valid: it expired, or was already exchanged or
|
|
149
|
+
# refused. Raised with no status when {OauthApi#poll_device_token} reaches the
|
|
150
|
+
# code's lifetime before the server says so.
|
|
151
|
+
class OauthExpiredTokenError < OauthRequestError; end
|
|
110
152
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -14,9 +14,9 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module InternetData
|
|
17
|
-
# One database FAMILY, with your organization's
|
|
17
|
+
# One database FAMILY, with your organization's license beside it. A license covers the family, while a download names a specific version, so the ids passed to `download` and `checksum` come from `versions`.
|
|
18
18
|
class Database < ApiModelBase
|
|
19
|
-
# The family, e.g. `vpn_ip`. What a
|
|
19
|
+
# The family, e.g. `vpn_ip`. What a license is held against.
|
|
20
20
|
attr_accessor :base
|
|
21
21
|
|
|
22
22
|
attr_accessor :name
|
|
@@ -26,15 +26,15 @@ module InternetData
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :standing
|
|
28
28
|
|
|
29
|
-
# What your
|
|
29
|
+
# What your license permits you to do with the data. Null when there is no license, which is every family with standing `unlicensed`.
|
|
30
30
|
attr_accessor :license_type
|
|
31
31
|
|
|
32
32
|
attr_accessor :starts
|
|
33
33
|
|
|
34
|
-
# A hard stop. Null when the
|
|
34
|
+
# A hard stop. Null when the license has no end date, which is the normal case for a rolling agreement, and when there is no license. A rolling license reports its turnover date in renews_at instead.
|
|
35
35
|
attr_accessor :expires
|
|
36
36
|
|
|
37
|
-
# When a rolling
|
|
37
|
+
# When a rolling license next renews. Null when the license has no defined term, when expires sets a hard stop instead, and when there is no license.
|
|
38
38
|
attr_accessor :renews_at
|
|
39
39
|
|
|
40
40
|
# The last day notice of non-renewal can be given for the term ending at renews_at. Null whenever renews_at is, and when the agreement records no notice period.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
=begin
|
|
2
2
|
#InternetData API
|
|
3
3
|
|
|
4
|
-
#The InternetData API
|
|
4
|
+
#The InternetData API: download the databases your organization is licensed for, and manage the account behind them. See https://docs.internetdata.io for guides and https://github.com/internetdata for the official client libraries.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 2026.09.
|
|
7
|
-
Contact:
|
|
6
|
+
The version of the OpenAPI document: 2026.09.21
|
|
7
|
+
Contact: support@internetdata.io
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.25.0
|
|
10
10
|
|