internetdata 2.8.7 → 2.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f14b7d6a525337e7b52c053e18cef8025bf359912e95bc819d8fd410caa9838
4
- data.tar.gz: 44b976c01d3f6ddb0cdcbd92183fedadecb6f579350c00663377d7b8f3f65242
3
+ metadata.gz: 783a1de4060fb26d882a1c31aa946d6335be9877da416f0b95712830b5af46b0
4
+ data.tar.gz: c7eca2b3d6a11c1e5e96b285845458077189645fbdb8ebb28eb63805f5726d75
5
5
  SHA512:
6
- metadata.gz: b07e9d69f4b16770627a42cff9ea3db360646b97758ffdba433c8e534b3e4dbaf596101d0829021e146707bcc03105031902b80b241505c89af026802a2b2c30
7
- data.tar.gz: 50d8d1cc12b1f427d669cd273bed58af9a37f9eef8e1c3bc2e317f301fbade53a8f0ef7672680988aa77edb283d39e33685e8a53c59b1f86661a7f6cc7ad56c7
6
+ metadata.gz: '0995aa306107ade8ade8f92244a173dda410f2ea4bb46f4a8d06f0f9c85f3f51e7e8fb5e2661974c411dcdb572440fc71c3111cc84d1e3f5abc6b4c506e01eae'
7
+ data.tar.gz: 7c032b9d82262035aefe193f3f67dbd82e012771e0a65a55b2bcffea594595a38311cd1c9a27c65e26e2fa24b6ac7ca879555e2a743546355027901601f2f87c
data/README.md CHANGED
@@ -75,6 +75,14 @@ bytes = client.database.download_bytes('bogon_asn_v1', 'csvgz')
75
75
 
76
76
  `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.
77
77
 
78
+ Each of the three downloads the build that is live unless you name one. A `database.updated` webhook names the build it announces and carries its `sha256`, so a receiver that downloads after the next publish asks for that build to get the file the hash is of:
79
+
80
+ ```ruby
81
+ client.database.download('vpn_ip_v1', 'mmdb', './vpn_ip_v1.mmdb', build: event['data']['build'])
82
+ ```
83
+
84
+ A build is kept 7 days. Past that the call raises `bad_request` with the message `BUILD_GONE`, and downloading without `build:` fetches the live one. A name that is not a build's shape (`20261105.0t53s5`) raises `ArgumentError` before anything is sent.
85
+
78
86
  ### Verifying what you got
79
87
 
80
88
  ```ruby
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -169,6 +169,7 @@ module InternetData
169
169
  # @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
170
170
  # @param format [DatabaseFormat] Database file format.
171
171
  # @param [Hash] opts the optional parameters
172
+ # @option opts [String] :build One build of the database, by the name a `database.updated` webhook gives it, so the file is the one whose `sha256` the webhook carries. Without it, the build that is live.
172
173
  # @return [nil]
173
174
  def download_database_v2(id, format, opts = {})
174
175
  download_database_v2_with_http_info(id, format, opts)
@@ -180,6 +181,7 @@ module InternetData
180
181
  # @param id [String] Database identifier (e.g. `vpn_ip_v1`, `resproxy_provider_v1`).
181
182
  # @param format [DatabaseFormat] Database file format.
182
183
  # @param [Hash] opts the optional parameters
184
+ # @option opts [String] :build One build of the database, by the name a `database.updated` webhook gives it, so the file is the one whose `sha256` the webhook carries. Without it, the build that is live.
183
185
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
184
186
  def download_database_v2_with_http_info(id, format, opts = {})
185
187
  if @api_client.config.debugging
@@ -198,6 +200,11 @@ module InternetData
198
200
  if @api_client.config.client_side_validation && format.nil?
199
201
  fail ArgumentError, "Missing the required parameter 'format' when calling DatabaseV2Api.download_database_v2"
200
202
  end
203
+ pattern = Regexp.new(/^[0-9]{8}\.[a-z0-9]{6}$/)
204
+ if @api_client.config.client_side_validation && !opts[:'build'].nil? && opts[:'build'] !~ pattern
205
+ fail ArgumentError, "invalid value for 'opts[:\"build\"]' when calling DatabaseV2Api.download_database_v2, must conform to the pattern #{pattern}."
206
+ end
207
+
201
208
  # resource path
202
209
  local_var_path = '/api/v2/database/download'
203
210
 
@@ -205,6 +212,7 @@ module InternetData
205
212
  query_params = opts[:query_params] || {}
206
213
  query_params[:'id'] = id
207
214
  query_params[:'format'] = format
215
+ query_params[:'build'] = opts[:'build'] if !opts[:'build'].nil?
208
216
 
209
217
  # header parameters
210
218
  header_params = opts[:header_params] || {}
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -73,12 +73,18 @@ module InternetData
73
73
  # link authorizes the START of a transfer, so one already running is not
74
74
  # interrupted when it lapses.
75
75
  #
76
+ # @param build [String, nil] one build of the database, as a
77
+ # `database.updated` webhook names it (`20261105.0t53s5`), so the file is
78
+ # the one whose `sha256` the webhook carries. nil or empty, the default, is
79
+ # the build that is live. A build is kept 7 days; past that the call raises
80
+ # `bad_request` with the message `BUILD_GONE`.
76
81
  # @param timeout [Numeric, nil] seconds this attempt may take, for THIS call
77
82
  # only. It bounds the request that MINTS the link, which is an ordinary
78
83
  # JSON call, and says nothing about the transfer you then run with it.
79
- def download_url(id, format, timeout: nil)
84
+ def download_url(id, format, build: nil, timeout: nil)
80
85
  check_format!(format)
81
- call { redirect_location(id, format, timeout) }
86
+ build = checked_build(build)
87
+ call { redirect_location(id, format, build, timeout) }
82
88
  end
83
89
 
84
90
  # Download one database file to `path`, and return the bytes written.
@@ -88,10 +94,13 @@ module InternetData
88
94
  # whole database, and a refresh that fails does not destroy the copy already
89
95
  # there. Nothing beyond one chunk is ever held in memory, whatever the
90
96
  # database weighs.
91
- def download(id, format, path)
97
+ #
98
+ # @param build [String, nil] one build of the database, as `download_url`
99
+ # takes it.
100
+ def download(id, format, path, build: nil)
92
101
  partial = "#{path}.part"
93
102
  begin
94
- url = download_url(id, format)
103
+ url = download_url(id, format, build: build)
95
104
  written = File.open(partial, 'wb') { |file| transfer(url) { |chunk| file.write(chunk) } }
96
105
  File.rename(partial, path)
97
106
  rescue StandardError
@@ -108,8 +117,11 @@ module InternetData
108
117
  # published database is over 5 GiB. Reach for it at the small end, where the
109
118
  # bytes go straight into a parser, and use {#download} for anything you have
110
119
  # not measured with {#metadata}.
111
- def download_bytes(id, format)
112
- url = download_url(id, format)
120
+ #
121
+ # @param build [String, nil] one build of the database, as `download_url`
122
+ # takes it.
123
+ def download_bytes(id, format, build: nil)
124
+ url = download_url(id, format, build: build)
113
125
  bytes = String.new(encoding: Encoding::BINARY)
114
126
  transfer(url) { |chunk| bytes << chunk }
115
127
  bytes
@@ -192,8 +204,17 @@ module InternetData
192
204
  "invalid value for \"format\", must be one of #{DatabaseFormat.all_vars}"
193
205
  end
194
206
 
195
- def redirect_location(id, format, timeout)
196
- _, status, = @api.download_database_v2_with_http_info(id, format, timeout: timeout)
207
+ # nil for an empty name, so a value read from an unset setting downloads the
208
+ # live build.
209
+ def checked_build(build)
210
+ return nil if build.nil? || build == ''
211
+ raise ArgumentError, "build must be a String, not #{build.inspect}" unless build.is_a?(String)
212
+
213
+ build
214
+ end
215
+
216
+ def redirect_location(id, format, build, timeout)
217
+ _, status, = @api.download_database_v2_with_http_info(id, format, build: build, timeout: timeout)
197
218
  raise Error.new(:server_error, 'expected a redirect to object storage', status: status)
198
219
  rescue ApiError => e
199
220
  raise unless e.code == 302
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -3,7 +3,7 @@
3
3
 
4
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.11.02
6
+ The version of the OpenAPI document: 2026.11.05
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetData
4
- VERSION = '2.8.7'
4
+ VERSION = '2.9.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internetdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.7
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mslm Dev