internetdata 1.0.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +125 -0
- data/lib/internetdata/api/database_v2_api.rb +376 -0
- data/lib/internetdata/api_client.rb +397 -0
- data/lib/internetdata/api_error.rb +58 -0
- data/lib/internetdata/api_model_base.rb +88 -0
- data/lib/internetdata/client.rb +34 -0
- data/lib/internetdata/configuration.rb +315 -0
- data/lib/internetdata/database_api.rb +182 -0
- data/lib/internetdata/errors.rb +110 -0
- data/lib/internetdata/models/database.rb +349 -0
- data/lib/internetdata/models/database_checksums_response.rb +240 -0
- data/lib/internetdata/models/database_list.rb +166 -0
- data/lib/internetdata/models/database_metadata.rb +299 -0
- data/lib/internetdata/models/database_metadata_column.rb +199 -0
- data/lib/internetdata/models/database_version.rb +258 -0
- data/lib/internetdata/models/db_checksums.rb +246 -0
- data/lib/internetdata/models/download.rb +329 -0
- data/lib/internetdata/models/download_list.rb +166 -0
- data/lib/internetdata/models/error_envelope.rb +165 -0
- data/lib/internetdata/retries.rb +33 -0
- data/lib/internetdata/transport.rb +72 -0
- data/lib/internetdata/version.rb +5 -0
- data/lib/internetdata.rb +26 -0
- metadata +84 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5319d9c11ea38c2debe6a794a88675b15a1fa859b143aff8038494a6dcaed084
|
|
4
|
+
data.tar.gz: 919e43190131f93f1e125883d02cbb9aed1d701444bd35becad968ee50104008
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aed277c219dfd96a398f53de465dd74cacc2c767e48d8cccb6fde98c6a2db3de69a89e1ea3652b1922fa247ac2b56c12d6c99a824011b941daf130f3df0d0ad6
|
|
7
|
+
data.tar.gz: 6efaab8bd604991aaf06e6db95c18e7391d4f36a65adc41f1345a6ae53f26eca35a3af56dc1a354ead0ff68b9a15f654842b9be3cb3af569a06fa8a2d9f435a3
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mslm Dev
|
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# [<img src="https://s3.internetdata.io/internetdata-public/brand/mark.svg" alt="InternetData" width="24"/>](https://internetdata.io/) InternetData Ruby Client Library
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/internetdata)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
The official Ruby client library for the [InternetData](https://internetdata.io) API.
|
|
7
|
+
|
|
8
|
+
InternetData publishes IP and ASN databases: VPN and proxy address space, hosting and CDN ranges, provider catalogs, bogons and more, as gzipped CSV and as MMDB. This library lists the databases your organization is licensed for, tells you what is inside one before you fetch it, downloads it, and verifies the bytes you got.
|
|
9
|
+
|
|
10
|
+
## Getting Started
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
gem install internetdata
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or add it to your Gemfile:
|
|
17
|
+
|
|
18
|
+
```ruby
|
|
19
|
+
gem 'internetdata'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Requires Ruby 3.1 or newer.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Every database published today needs an API key carrying the `db.download` scope. Access is granted by contract, one family at a time, so there is no self-serve tier: write to [dev@internetdata.io](mailto:dev@internetdata.io) to be licensed and issued a key. `api_key:` is nevertheless optional - a client built without one sends no `Authorization` header at all, ready for a database served without a licence.
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require 'internetdata'
|
|
30
|
+
|
|
31
|
+
client = InternetData::Client.new(api_key: ENV['INTERNETDATA_API_KEY'])
|
|
32
|
+
|
|
33
|
+
client.database.list.each do |database|
|
|
34
|
+
puts [database.base, database.standing, database.versions.map(&:id).join(', ')].join(' ')
|
|
35
|
+
end
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`list` returns one entry per database FAMILY, because a license is held against the family while a download names a specific version. `standing` is `licensed` if the family is yours today, `expired` if the term has ended, and `unlicensed` if it is published but has never been bought. `versions` carries the ids you pass everywhere else, oldest first, and the formats each one is actually built in.
|
|
39
|
+
|
|
40
|
+
**This listing is not the same for every key.** A database commissioned for a single customer is absent from the catalog for every other organization, rather than being listed as unlicensed. So a listing is only ever an answer about the key that asked. This library never caches one, and you should not carry an answer from one key over to another or treat it as the published catalog.
|
|
41
|
+
|
|
42
|
+
### What is inside a database
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
meta = client.database.metadata('bogon_ip_v1')
|
|
46
|
+
|
|
47
|
+
meta.updated # => '2026-09-04', the day this build was generated
|
|
48
|
+
meta.entries # => rows in the build
|
|
49
|
+
meta.size['csvgz'] # => bytes you are about to move
|
|
50
|
+
meta.schema['csvgz'] # => [#<DatabaseMetadataColumn name="ip" type="string" ...>, ...]
|
|
51
|
+
meta.sample['mmdb'] # => a few real rows
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Poll `updated` and `entries` to decide whether today's build is worth fetching; both are free of the transfer. `size` is also the honest way to budget a download before starting one.
|
|
55
|
+
|
|
56
|
+
### Downloading
|
|
57
|
+
|
|
58
|
+
`download` streams a file to a path and returns the number of bytes written. Nothing larger than a chunk is ever held in memory, whatever the database weighs:
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
written = client.database.download('bogon_ip_v1', 'mmdb', './bogon_ip_v1.mmdb')
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The bytes go to a neighboring `.part` file and the name only appears once the transfer completes, so an interruption cannot leave a truncated file that reads as a whole database, and a refresh that fails does not destroy the copy already there.
|
|
65
|
+
|
|
66
|
+
Or take the link and run the transfer yourself. The API answers a redirect to time-limited object storage, and that URL authorizes itself, so it can be handed to something holding no API key:
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
url = client.database.download_url('bogon_ip_v1', 'mmdb')
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or, for a small database, take the bytes directly:
|
|
73
|
+
|
|
74
|
+
```ruby
|
|
75
|
+
bytes = client.database.download_bytes('bogon_asn_v1', 'csvgz')
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`download_bytes` holds the whole file in memory and the catalog spans seven orders of magnitude, from a few hundred bytes to over 5 GiB, so use `download` for anything you have not checked with `metadata` first.
|
|
79
|
+
|
|
80
|
+
### Verifying what you got
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
sums = client.database.checksums('bogon_ip_v1', 'mmdb')
|
|
84
|
+
sums.sha256 # also md5, sha1, sha512
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Download history
|
|
88
|
+
|
|
89
|
+
Your organization's recent attempts, newest first, refusals included, because a denial is what answers "it stopped working" and its absence answers nothing:
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
client.database.downloads(limit: 20).each do |attempt|
|
|
93
|
+
puts [attempt.created, attempt.dataset_id, attempt.format, attempt.outcome].join(' ')
|
|
94
|
+
end
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Errors
|
|
98
|
+
|
|
99
|
+
Failures raise an `InternetData::Error` carrying a `kind` and a `retryable?` flag:
|
|
100
|
+
|
|
101
|
+
```ruby
|
|
102
|
+
begin
|
|
103
|
+
client.database.download('vpn_ip_v1', 'mmdb', './vpn_ip_v1.mmdb')
|
|
104
|
+
rescue InternetData::Error => e
|
|
105
|
+
warn "#{e.kind} #{e.status} #{e.retryable?}: #{e.rc}"
|
|
106
|
+
end
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`kind` is one of `:bad_request`, `:unauthorized`, `:forbidden`, `:rate_limited`, `:quota_exceeded`, `:server_error` or `:network`. `rc` is the API's own result code, such as `NOT_LICENSED` or `LICENSE_EXPIRED`, which is usually the specific thing you want to read.
|
|
110
|
+
|
|
111
|
+
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.
|
|
112
|
+
|
|
113
|
+
## Other Libraries
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
## About InternetData
|
|
118
|
+
|
|
119
|
+
IP intelligence databases: VPN, proxy, hosting, CDN and relay address space, provider catalogs and network metadata, published as CSV and MMDB.
|
|
120
|
+
|
|
121
|
+
[<img src="https://s3.internetdata.io/internetdata-public/brand/mark.svg" alt="InternetData" width="96"/>](https://internetdata.io/)
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#InternetData API
|
|
3
|
+
|
|
4
|
+
#The InternetData API. Please see https://docs.internetdata.io/api for more details.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026.09.04
|
|
7
|
+
Contact: dev@internetdata.io
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module InternetData
|
|
16
|
+
class DatabaseV2Api
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Checksums for one published file, to verify a download
|
|
23
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
24
|
+
# @param format [String] Database file format.
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @return [DatabaseChecksumsResponse]
|
|
27
|
+
def database_checksum_v2(id, format, opts = {})
|
|
28
|
+
data, _status_code, _headers = database_checksum_v2_with_http_info(id, format, opts)
|
|
29
|
+
data
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Checksums for one published file, to verify a download
|
|
33
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
34
|
+
# @param format [String] Database file format.
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(DatabaseChecksumsResponse, Integer, Hash)>] DatabaseChecksumsResponse data, response status code and response headers
|
|
37
|
+
def database_checksum_v2_with_http_info(id, format, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: DatabaseV2Api.database_checksum_v2 ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'id' is set
|
|
42
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DatabaseV2Api.database_checksum_v2"
|
|
44
|
+
end
|
|
45
|
+
pattern = Regexp.new(/^[a-zA-Z0-9_]+$/)
|
|
46
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
47
|
+
fail ArgumentError, "invalid value for 'id' when calling DatabaseV2Api.database_checksum_v2, must conform to the pattern #{pattern}."
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# verify the required parameter 'format' is set
|
|
51
|
+
if @api_client.config.client_side_validation && format.nil?
|
|
52
|
+
fail ArgumentError, "Missing the required parameter 'format' when calling DatabaseV2Api.database_checksum_v2"
|
|
53
|
+
end
|
|
54
|
+
# verify enum value
|
|
55
|
+
allowable_values = ["csvgz", "mmdb"]
|
|
56
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(format)
|
|
57
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
|
|
58
|
+
end
|
|
59
|
+
# resource path
|
|
60
|
+
local_var_path = '/api/v2/database/checksum'
|
|
61
|
+
|
|
62
|
+
# query parameters
|
|
63
|
+
query_params = opts[:query_params] || {}
|
|
64
|
+
query_params[:'id'] = id
|
|
65
|
+
query_params[:'format'] = format
|
|
66
|
+
|
|
67
|
+
# header parameters
|
|
68
|
+
header_params = opts[:header_params] || {}
|
|
69
|
+
# HTTP header 'Accept' (if needed)
|
|
70
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
71
|
+
|
|
72
|
+
# form parameters
|
|
73
|
+
form_params = opts[:form_params] || {}
|
|
74
|
+
|
|
75
|
+
# http body (model)
|
|
76
|
+
post_body = opts[:debug_body]
|
|
77
|
+
|
|
78
|
+
# return_type
|
|
79
|
+
return_type = opts[:debug_return_type] || 'DatabaseChecksumsResponse'
|
|
80
|
+
|
|
81
|
+
# auth_names
|
|
82
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
83
|
+
|
|
84
|
+
new_options = opts.merge(
|
|
85
|
+
:operation => :"DatabaseV2Api.database_checksum_v2",
|
|
86
|
+
:header_params => header_params,
|
|
87
|
+
:query_params => query_params,
|
|
88
|
+
:form_params => form_params,
|
|
89
|
+
:body => post_body,
|
|
90
|
+
:auth_names => auth_names,
|
|
91
|
+
:return_type => return_type
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
95
|
+
if @api_client.config.debugging
|
|
96
|
+
@api_client.config.logger.debug "API called: DatabaseV2Api#database_checksum_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
97
|
+
end
|
|
98
|
+
return data, status_code, headers
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# What is inside one database - schema, sample rows, row count, sizes
|
|
102
|
+
# Poll this to decide whether today's build is worth fetching: it carries `updated` and `entries` without downloading anything. No `format` parameter - one document describes every format the database is built in.
|
|
103
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
104
|
+
# @param [Hash] opts the optional parameters
|
|
105
|
+
# @return [DatabaseMetadata]
|
|
106
|
+
def database_metadata_v2(id, opts = {})
|
|
107
|
+
data, _status_code, _headers = database_metadata_v2_with_http_info(id, opts)
|
|
108
|
+
data
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# What is inside one database - schema, sample rows, row count, sizes
|
|
112
|
+
# Poll this to decide whether today's build is worth fetching: it carries `updated` and `entries` without downloading anything. No `format` parameter - one document describes every format the database is built in.
|
|
113
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
114
|
+
# @param [Hash] opts the optional parameters
|
|
115
|
+
# @return [Array<(DatabaseMetadata, Integer, Hash)>] DatabaseMetadata data, response status code and response headers
|
|
116
|
+
def database_metadata_v2_with_http_info(id, opts = {})
|
|
117
|
+
if @api_client.config.debugging
|
|
118
|
+
@api_client.config.logger.debug 'Calling API: DatabaseV2Api.database_metadata_v2 ...'
|
|
119
|
+
end
|
|
120
|
+
# verify the required parameter 'id' is set
|
|
121
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
122
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DatabaseV2Api.database_metadata_v2"
|
|
123
|
+
end
|
|
124
|
+
pattern = Regexp.new(/^[a-zA-Z0-9_]+$/)
|
|
125
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
126
|
+
fail ArgumentError, "invalid value for 'id' when calling DatabaseV2Api.database_metadata_v2, must conform to the pattern #{pattern}."
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# resource path
|
|
130
|
+
local_var_path = '/api/v2/database/metadata'
|
|
131
|
+
|
|
132
|
+
# query parameters
|
|
133
|
+
query_params = opts[:query_params] || {}
|
|
134
|
+
query_params[:'id'] = id
|
|
135
|
+
|
|
136
|
+
# header parameters
|
|
137
|
+
header_params = opts[:header_params] || {}
|
|
138
|
+
# HTTP header 'Accept' (if needed)
|
|
139
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
140
|
+
|
|
141
|
+
# form parameters
|
|
142
|
+
form_params = opts[:form_params] || {}
|
|
143
|
+
|
|
144
|
+
# http body (model)
|
|
145
|
+
post_body = opts[:debug_body]
|
|
146
|
+
|
|
147
|
+
# return_type
|
|
148
|
+
return_type = opts[:debug_return_type] || 'DatabaseMetadata'
|
|
149
|
+
|
|
150
|
+
# auth_names
|
|
151
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
152
|
+
|
|
153
|
+
new_options = opts.merge(
|
|
154
|
+
:operation => :"DatabaseV2Api.database_metadata_v2",
|
|
155
|
+
:header_params => header_params,
|
|
156
|
+
:query_params => query_params,
|
|
157
|
+
:form_params => form_params,
|
|
158
|
+
:body => post_body,
|
|
159
|
+
:auth_names => auth_names,
|
|
160
|
+
:return_type => return_type
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
164
|
+
if @api_client.config.debugging
|
|
165
|
+
@api_client.config.logger.debug "API called: DatabaseV2Api#database_metadata_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
166
|
+
end
|
|
167
|
+
return data, status_code, headers
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Redirect to a time-limited download URL for one database
|
|
171
|
+
# Answers `302`; the bytes come straight from object storage rather than through this API. Follow the redirect.
|
|
172
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
173
|
+
# @param format [String] Database file format.
|
|
174
|
+
# @param [Hash] opts the optional parameters
|
|
175
|
+
# @return [nil]
|
|
176
|
+
def download_database_v2(id, format, opts = {})
|
|
177
|
+
download_database_v2_with_http_info(id, format, opts)
|
|
178
|
+
nil
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Redirect to a time-limited download URL for one database
|
|
182
|
+
# Answers `302`; the bytes come straight from object storage rather than through this API. Follow the redirect.
|
|
183
|
+
# @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
|
|
184
|
+
# @param format [String] Database file format.
|
|
185
|
+
# @param [Hash] opts the optional parameters
|
|
186
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
187
|
+
def download_database_v2_with_http_info(id, format, opts = {})
|
|
188
|
+
if @api_client.config.debugging
|
|
189
|
+
@api_client.config.logger.debug 'Calling API: DatabaseV2Api.download_database_v2 ...'
|
|
190
|
+
end
|
|
191
|
+
# verify the required parameter 'id' is set
|
|
192
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
193
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling DatabaseV2Api.download_database_v2"
|
|
194
|
+
end
|
|
195
|
+
pattern = Regexp.new(/^[a-zA-Z0-9_]+$/)
|
|
196
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
197
|
+
fail ArgumentError, "invalid value for 'id' when calling DatabaseV2Api.download_database_v2, must conform to the pattern #{pattern}."
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# verify the required parameter 'format' is set
|
|
201
|
+
if @api_client.config.client_side_validation && format.nil?
|
|
202
|
+
fail ArgumentError, "Missing the required parameter 'format' when calling DatabaseV2Api.download_database_v2"
|
|
203
|
+
end
|
|
204
|
+
# verify enum value
|
|
205
|
+
allowable_values = ["csvgz", "mmdb"]
|
|
206
|
+
if @api_client.config.client_side_validation && !allowable_values.include?(format)
|
|
207
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
|
|
208
|
+
end
|
|
209
|
+
# resource path
|
|
210
|
+
local_var_path = '/api/v2/database/download'
|
|
211
|
+
|
|
212
|
+
# query parameters
|
|
213
|
+
query_params = opts[:query_params] || {}
|
|
214
|
+
query_params[:'id'] = id
|
|
215
|
+
query_params[:'format'] = format
|
|
216
|
+
|
|
217
|
+
# header parameters
|
|
218
|
+
header_params = opts[:header_params] || {}
|
|
219
|
+
# HTTP header 'Accept' (if needed)
|
|
220
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
221
|
+
|
|
222
|
+
# form parameters
|
|
223
|
+
form_params = opts[:form_params] || {}
|
|
224
|
+
|
|
225
|
+
# http body (model)
|
|
226
|
+
post_body = opts[:debug_body]
|
|
227
|
+
|
|
228
|
+
# return_type
|
|
229
|
+
return_type = opts[:debug_return_type]
|
|
230
|
+
|
|
231
|
+
# auth_names
|
|
232
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
233
|
+
|
|
234
|
+
new_options = opts.merge(
|
|
235
|
+
:operation => :"DatabaseV2Api.download_database_v2",
|
|
236
|
+
:header_params => header_params,
|
|
237
|
+
:query_params => query_params,
|
|
238
|
+
:form_params => form_params,
|
|
239
|
+
:body => post_body,
|
|
240
|
+
:auth_names => auth_names,
|
|
241
|
+
:return_type => return_type
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
245
|
+
if @api_client.config.debugging
|
|
246
|
+
@api_client.config.logger.debug "API called: DatabaseV2Api#download_database_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
247
|
+
end
|
|
248
|
+
return data, status_code, headers
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Every database your organization may see, and where each one stands
|
|
252
|
+
# The whole published catalog, with your organization's licence beside each entry, so `standing` says whether a database is yours today (`licensed`), was (`expired`), or has never been bought (`unlicensed`). Databases commissioned for a single customer are not listed to anyone else.
|
|
253
|
+
# @param [Hash] opts the optional parameters
|
|
254
|
+
# @return [DatabaseList]
|
|
255
|
+
def list_databases(opts = {})
|
|
256
|
+
data, _status_code, _headers = list_databases_with_http_info(opts)
|
|
257
|
+
data
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Every database your organization may see, and where each one stands
|
|
261
|
+
# The whole published catalog, with your organization's licence beside each entry, so `standing` says whether a database is yours today (`licensed`), was (`expired`), or has never been bought (`unlicensed`). Databases commissioned for a single customer are not listed to anyone else.
|
|
262
|
+
# @param [Hash] opts the optional parameters
|
|
263
|
+
# @return [Array<(DatabaseList, Integer, Hash)>] DatabaseList data, response status code and response headers
|
|
264
|
+
def list_databases_with_http_info(opts = {})
|
|
265
|
+
if @api_client.config.debugging
|
|
266
|
+
@api_client.config.logger.debug 'Calling API: DatabaseV2Api.list_databases ...'
|
|
267
|
+
end
|
|
268
|
+
# resource path
|
|
269
|
+
local_var_path = '/api/v2/database/list'
|
|
270
|
+
|
|
271
|
+
# query parameters
|
|
272
|
+
query_params = opts[:query_params] || {}
|
|
273
|
+
|
|
274
|
+
# header parameters
|
|
275
|
+
header_params = opts[:header_params] || {}
|
|
276
|
+
# HTTP header 'Accept' (if needed)
|
|
277
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
278
|
+
|
|
279
|
+
# form parameters
|
|
280
|
+
form_params = opts[:form_params] || {}
|
|
281
|
+
|
|
282
|
+
# http body (model)
|
|
283
|
+
post_body = opts[:debug_body]
|
|
284
|
+
|
|
285
|
+
# return_type
|
|
286
|
+
return_type = opts[:debug_return_type] || 'DatabaseList'
|
|
287
|
+
|
|
288
|
+
# auth_names
|
|
289
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
290
|
+
|
|
291
|
+
new_options = opts.merge(
|
|
292
|
+
:operation => :"DatabaseV2Api.list_databases",
|
|
293
|
+
:header_params => header_params,
|
|
294
|
+
:query_params => query_params,
|
|
295
|
+
:form_params => form_params,
|
|
296
|
+
:body => post_body,
|
|
297
|
+
:auth_names => auth_names,
|
|
298
|
+
:return_type => return_type
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
302
|
+
if @api_client.config.debugging
|
|
303
|
+
@api_client.config.logger.debug "API called: DatabaseV2Api#list_databases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
304
|
+
end
|
|
305
|
+
return data, status_code, headers
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Your organization's recent download attempts, newest first
|
|
309
|
+
# Refusals are listed too: a denial is what answers \"it stopped working\", and its absence answers nothing.
|
|
310
|
+
# @param [Hash] opts the optional parameters
|
|
311
|
+
# @option opts [Integer] :limit How many attempts to return. Clamped to 200. (default to 50)
|
|
312
|
+
# @return [DownloadList]
|
|
313
|
+
def list_downloads(opts = {})
|
|
314
|
+
data, _status_code, _headers = list_downloads_with_http_info(opts)
|
|
315
|
+
data
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Your organization's recent download attempts, newest first
|
|
319
|
+
# Refusals are listed too: a denial is what answers \"it stopped working\", and its absence answers nothing.
|
|
320
|
+
# @param [Hash] opts the optional parameters
|
|
321
|
+
# @option opts [Integer] :limit How many attempts to return. Clamped to 200. (default to 50)
|
|
322
|
+
# @return [Array<(DownloadList, Integer, Hash)>] DownloadList data, response status code and response headers
|
|
323
|
+
def list_downloads_with_http_info(opts = {})
|
|
324
|
+
if @api_client.config.debugging
|
|
325
|
+
@api_client.config.logger.debug 'Calling API: DatabaseV2Api.list_downloads ...'
|
|
326
|
+
end
|
|
327
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
|
|
328
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DatabaseV2Api.list_downloads, must be smaller than or equal to 200.'
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
332
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DatabaseV2Api.list_downloads, must be greater than or equal to 1.'
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# resource path
|
|
336
|
+
local_var_path = '/api/v2/database/downloads'
|
|
337
|
+
|
|
338
|
+
# query parameters
|
|
339
|
+
query_params = opts[:query_params] || {}
|
|
340
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
341
|
+
|
|
342
|
+
# header parameters
|
|
343
|
+
header_params = opts[:header_params] || {}
|
|
344
|
+
# HTTP header 'Accept' (if needed)
|
|
345
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
346
|
+
|
|
347
|
+
# form parameters
|
|
348
|
+
form_params = opts[:form_params] || {}
|
|
349
|
+
|
|
350
|
+
# http body (model)
|
|
351
|
+
post_body = opts[:debug_body]
|
|
352
|
+
|
|
353
|
+
# return_type
|
|
354
|
+
return_type = opts[:debug_return_type] || 'DownloadList'
|
|
355
|
+
|
|
356
|
+
# auth_names
|
|
357
|
+
auth_names = opts[:debug_auth_names] || ['BearerAuth']
|
|
358
|
+
|
|
359
|
+
new_options = opts.merge(
|
|
360
|
+
:operation => :"DatabaseV2Api.list_downloads",
|
|
361
|
+
:header_params => header_params,
|
|
362
|
+
:query_params => query_params,
|
|
363
|
+
:form_params => form_params,
|
|
364
|
+
:body => post_body,
|
|
365
|
+
:auth_names => auth_names,
|
|
366
|
+
:return_type => return_type
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
370
|
+
if @api_client.config.debugging
|
|
371
|
+
@api_client.config.logger.debug "API called: DatabaseV2Api#list_downloads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
372
|
+
end
|
|
373
|
+
return data, status_code, headers
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
end
|