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.
@@ -0,0 +1,329 @@
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 'date'
14
+ require 'time'
15
+
16
+ module InternetData
17
+ # One download ATTEMPT, refusals included.
18
+ class Download < ApiModelBase
19
+ attr_accessor :dataset_id
20
+
21
+ attr_accessor :format
22
+
23
+ attr_accessor :outcome
24
+
25
+ # Object size at redirect time, NOT bytes delivered: the transfer is a presigned redirect straight to object storage, so we never observe how much of it was taken.
26
+ attr_accessor :bytes
27
+
28
+ attr_accessor :http_status
29
+
30
+ # The key that made the request. Null when it could not be resolved.
31
+ attr_accessor :apikey_id
32
+
33
+ attr_accessor :client_ip
34
+
35
+ attr_accessor :user_agent
36
+
37
+ attr_accessor :created
38
+
39
+ class EnumAttributeValidator
40
+ attr_reader :datatype
41
+ attr_reader :allowable_values
42
+
43
+ def initialize(datatype, allowable_values)
44
+ @allowable_values = allowable_values.map do |value|
45
+ case datatype.to_s
46
+ when /Integer/i
47
+ value.to_i
48
+ when /Float/i
49
+ value.to_f
50
+ else
51
+ value
52
+ end
53
+ end
54
+ end
55
+
56
+ def valid?(value)
57
+ !value || allowable_values.include?(value)
58
+ end
59
+ end
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'dataset_id' => :'dataset_id',
65
+ :'format' => :'format',
66
+ :'outcome' => :'outcome',
67
+ :'bytes' => :'bytes',
68
+ :'http_status' => :'http_status',
69
+ :'apikey_id' => :'apikey_id',
70
+ :'client_ip' => :'client_ip',
71
+ :'user_agent' => :'user_agent',
72
+ :'created' => :'created'
73
+ }
74
+ end
75
+
76
+ # Returns attribute mapping this model knows about
77
+ def self.acceptable_attribute_map
78
+ attribute_map
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ acceptable_attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'dataset_id' => :'String',
90
+ :'format' => :'String',
91
+ :'outcome' => :'String',
92
+ :'bytes' => :'Integer',
93
+ :'http_status' => :'Integer',
94
+ :'apikey_id' => :'String',
95
+ :'client_ip' => :'String',
96
+ :'user_agent' => :'String',
97
+ :'created' => :'Time'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ :'bytes',
105
+ :'http_status',
106
+ :'apikey_id',
107
+ :'client_ip',
108
+ :'user_agent',
109
+ ])
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ if (!attributes.is_a?(Hash))
116
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::Download` initialize method"
117
+ end
118
+
119
+ # check to see if the attribute exists and convert string to symbol for hash key
120
+ acceptable_attribute_map = self.class.acceptable_attribute_map
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!acceptable_attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::Download`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'dataset_id')
129
+ self.dataset_id = attributes[:'dataset_id']
130
+ else
131
+ self.dataset_id = nil
132
+ end
133
+
134
+ if attributes.key?(:'format')
135
+ self.format = attributes[:'format']
136
+ else
137
+ self.format = nil
138
+ end
139
+
140
+ if attributes.key?(:'outcome')
141
+ self.outcome = attributes[:'outcome']
142
+ else
143
+ self.outcome = nil
144
+ end
145
+
146
+ if attributes.key?(:'bytes')
147
+ self.bytes = attributes[:'bytes']
148
+ else
149
+ self.bytes = nil
150
+ end
151
+
152
+ if attributes.key?(:'http_status')
153
+ self.http_status = attributes[:'http_status']
154
+ else
155
+ self.http_status = nil
156
+ end
157
+
158
+ if attributes.key?(:'apikey_id')
159
+ self.apikey_id = attributes[:'apikey_id']
160
+ else
161
+ self.apikey_id = nil
162
+ end
163
+
164
+ if attributes.key?(:'client_ip')
165
+ self.client_ip = attributes[:'client_ip']
166
+ else
167
+ self.client_ip = nil
168
+ end
169
+
170
+ if attributes.key?(:'user_agent')
171
+ self.user_agent = attributes[:'user_agent']
172
+ else
173
+ self.user_agent = nil
174
+ end
175
+
176
+ if attributes.key?(:'created')
177
+ self.created = attributes[:'created']
178
+ else
179
+ self.created = nil
180
+ end
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properties with the reasons
185
+ def list_invalid_properties
186
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
187
+ invalid_properties = Array.new
188
+ if @dataset_id.nil?
189
+ invalid_properties.push('invalid value for "dataset_id", dataset_id cannot be nil.')
190
+ end
191
+
192
+ if @format.nil?
193
+ invalid_properties.push('invalid value for "format", format cannot be nil.')
194
+ end
195
+
196
+ if @outcome.nil?
197
+ invalid_properties.push('invalid value for "outcome", outcome cannot be nil.')
198
+ end
199
+
200
+ if @created.nil?
201
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
202
+ end
203
+
204
+ invalid_properties
205
+ end
206
+
207
+ # Check to see if the all the properties in the model are valid
208
+ # @return true if the model is valid
209
+ def valid?
210
+ warn '[DEPRECATED] the `valid?` method is obsolete'
211
+ return false if @dataset_id.nil?
212
+ return false if @format.nil?
213
+ return false if @outcome.nil?
214
+ outcome_validator = EnumAttributeValidator.new('String', ["ok", "unauthorized", "denied", "expired", "unknown", "unavailable"])
215
+ return false unless outcome_validator.valid?(@outcome)
216
+ return false if @created.nil?
217
+ true
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] dataset_id Value to be assigned
222
+ def dataset_id=(dataset_id)
223
+ if dataset_id.nil?
224
+ fail ArgumentError, 'dataset_id cannot be nil'
225
+ end
226
+
227
+ @dataset_id = dataset_id
228
+ end
229
+
230
+ # Custom attribute writer method with validation
231
+ # @param [Object] format Value to be assigned
232
+ def format=(format)
233
+ if format.nil?
234
+ fail ArgumentError, 'format cannot be nil'
235
+ end
236
+
237
+ @format = format
238
+ end
239
+
240
+ # Custom attribute writer method checking allowed values (enum).
241
+ # @param [Object] outcome Object to be assigned
242
+ def outcome=(outcome)
243
+ validator = EnumAttributeValidator.new('String', ["ok", "unauthorized", "denied", "expired", "unknown", "unavailable"])
244
+ unless validator.valid?(outcome)
245
+ fail ArgumentError, "invalid value for \"outcome\", must be one of #{validator.allowable_values}."
246
+ end
247
+ @outcome = outcome
248
+ end
249
+
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] created Value to be assigned
252
+ def created=(created)
253
+ if created.nil?
254
+ fail ArgumentError, 'created cannot be nil'
255
+ end
256
+
257
+ @created = created
258
+ end
259
+
260
+ # Checks equality by comparing each attribute.
261
+ # @param [Object] Object to be compared
262
+ def ==(o)
263
+ return true if self.equal?(o)
264
+ self.class == o.class &&
265
+ dataset_id == o.dataset_id &&
266
+ format == o.format &&
267
+ outcome == o.outcome &&
268
+ bytes == o.bytes &&
269
+ http_status == o.http_status &&
270
+ apikey_id == o.apikey_id &&
271
+ client_ip == o.client_ip &&
272
+ user_agent == o.user_agent &&
273
+ created == o.created
274
+ end
275
+
276
+ # @see the `==` method
277
+ # @param [Object] Object to be compared
278
+ def eql?(o)
279
+ self == o
280
+ end
281
+
282
+ # Calculates hash code according to all attributes.
283
+ # @return [Integer] Hash code
284
+ def hash
285
+ [dataset_id, format, outcome, bytes, http_status, apikey_id, client_ip, user_agent, created].hash
286
+ end
287
+
288
+ # Builds the object from hash
289
+ # @param [Hash] attributes Model attributes in the form of hash
290
+ # @return [Object] Returns the model itself
291
+ def self.build_from_hash(attributes)
292
+ return nil unless attributes.is_a?(Hash)
293
+ attributes = attributes.transform_keys(&:to_sym)
294
+ transformed_hash = {}
295
+ openapi_types.each_pair do |key, type|
296
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = nil
298
+ elsif type =~ /\AArray<(.*)>/i
299
+ # check to ensure the input is an array given that the attribute
300
+ # is documented as an array but the input is not
301
+ if attributes[attribute_map[key]].is_a?(Array)
302
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
303
+ end
304
+ elsif !attributes[attribute_map[key]].nil?
305
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
306
+ end
307
+ end
308
+ new(transformed_hash)
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ if value.nil?
318
+ is_nullable = self.class.openapi_nullable.include?(attr)
319
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
+ end
321
+
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -0,0 +1,166 @@
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 'date'
14
+ require 'time'
15
+
16
+ module InternetData
17
+ class DownloadList < ApiModelBase
18
+ attr_accessor :downloads
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'downloads' => :'downloads'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'downloads' => :'Array<Download>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::DownloadList` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::DownloadList`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'downloads')
67
+ if (value = attributes[:'downloads']).is_a?(Array)
68
+ self.downloads = value
69
+ end
70
+ else
71
+ self.downloads = nil
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ if @downloads.nil?
81
+ invalid_properties.push('invalid value for "downloads", downloads cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ return false if @downloads.nil?
92
+ true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] downloads Value to be assigned
97
+ def downloads=(downloads)
98
+ if downloads.nil?
99
+ fail ArgumentError, 'downloads cannot be nil'
100
+ end
101
+
102
+ @downloads = downloads
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ downloads == o.downloads
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [downloads].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = self.send(attr)
154
+ if value.nil?
155
+ is_nullable = self.class.openapi_nullable.include?(attr)
156
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
157
+ end
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ end
165
+
166
+ end
@@ -0,0 +1,165 @@
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 'date'
14
+ require 'time'
15
+
16
+ module InternetData
17
+ class ErrorEnvelope < ApiModelBase
18
+ # A machine-readable result code. Deliberately not an enum: a code added later must stay parseable by a client generated today.
19
+ attr_accessor :rc
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'rc' => :'rc'
25
+ }
26
+ end
27
+
28
+ # Returns attribute mapping this model knows about
29
+ def self.acceptable_attribute_map
30
+ attribute_map
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ acceptable_attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'rc' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::ErrorEnvelope` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::ErrorEnvelope`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'rc')
68
+ self.rc = attributes[:'rc']
69
+ else
70
+ self.rc = nil
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
+ invalid_properties = Array.new
79
+ if @rc.nil?
80
+ invalid_properties.push('invalid value for "rc", rc cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ warn '[DEPRECATED] the `valid?` method is obsolete'
90
+ return false if @rc.nil?
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method with validation
95
+ # @param [Object] rc Value to be assigned
96
+ def rc=(rc)
97
+ if rc.nil?
98
+ fail ArgumentError, 'rc cannot be nil'
99
+ end
100
+
101
+ @rc = rc
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ rc == o.rc
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [rc].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ if value.nil?
154
+ is_nullable = self.class.openapi_nullable.include?(attr)
155
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
156
+ end
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ end
164
+
165
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module InternetData
4
+ # What may be tried again, and how long to wait first.
5
+ #
6
+ # Only a 5xx, a transport failure and a 429 that carried `Retry-After` are
7
+ # worth another attempt. Every other 4xx is a client error and fails on the
8
+ # first try, so an unknown database id is not asked for three times.
9
+ module Retries
10
+ BACKOFF_SECONDS = 0.25
11
+
12
+ module_function
13
+
14
+ def with_retries(retries)
15
+ attempt = 0
16
+ begin
17
+ yield
18
+ rescue Error => e
19
+ raise unless e.retryable? && attempt < retries
20
+
21
+ attempt += 1
22
+ sleep(delay_for(e, attempt))
23
+ retry
24
+ end
25
+ end
26
+
27
+ # A server-supplied delay always wins, including a `Retry-After: 0`, which
28
+ # is the server saying "immediately" rather than saying nothing.
29
+ def delay_for(error, attempt)
30
+ error.retry_after_seconds || BACKOFF_SECONDS * (2**(attempt - 1))
31
+ end
32
+ end
33
+ end