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,258 @@
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 DatabaseVersion < ApiModelBase
18
+ # The versioned id. Pass this to `download`, `checksum` and `metadata`.
19
+ attr_accessor :id
20
+
21
+ attr_accessor :version
22
+
23
+ attr_accessor :summary
24
+
25
+ # The formats this version is BUILT in. Asking for another is a 400, not a gap - the `_provider` catalogs are keyed by provider id, so no MMDB exists for them.
26
+ attr_accessor :formats
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'id' => :'id',
54
+ :'version' => :'version',
55
+ :'summary' => :'summary',
56
+ :'formats' => :'formats'
57
+ }
58
+ end
59
+
60
+ # Returns attribute mapping this model knows about
61
+ def self.acceptable_attribute_map
62
+ attribute_map
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ acceptable_attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'id' => :'String',
74
+ :'version' => :'Integer',
75
+ :'summary' => :'String',
76
+ :'formats' => :'Array<String>'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::DatabaseVersion` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ acceptable_attribute_map = self.class.acceptable_attribute_map
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!acceptable_attribute_map.key?(k.to_sym))
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::DatabaseVersion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:'id')
103
+ self.id = attributes[:'id']
104
+ else
105
+ self.id = nil
106
+ end
107
+
108
+ if attributes.key?(:'version')
109
+ self.version = attributes[:'version']
110
+ else
111
+ self.version = nil
112
+ end
113
+
114
+ if attributes.key?(:'summary')
115
+ self.summary = attributes[:'summary']
116
+ else
117
+ self.summary = nil
118
+ end
119
+
120
+ if attributes.key?(:'formats')
121
+ if (value = attributes[:'formats']).is_a?(Array)
122
+ self.formats = value
123
+ end
124
+ else
125
+ self.formats = nil
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
133
+ invalid_properties = Array.new
134
+ if @id.nil?
135
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
136
+ end
137
+
138
+ if @version.nil?
139
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
140
+ end
141
+
142
+ if @summary.nil?
143
+ invalid_properties.push('invalid value for "summary", summary cannot be nil.')
144
+ end
145
+
146
+ if @formats.nil?
147
+ invalid_properties.push('invalid value for "formats", formats cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ warn '[DEPRECATED] the `valid?` method is obsolete'
157
+ return false if @id.nil?
158
+ return false if @version.nil?
159
+ return false if @summary.nil?
160
+ return false if @formats.nil?
161
+ true
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] id Value to be assigned
166
+ def id=(id)
167
+ if id.nil?
168
+ fail ArgumentError, 'id cannot be nil'
169
+ end
170
+
171
+ @id = id
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] version Value to be assigned
176
+ def version=(version)
177
+ if version.nil?
178
+ fail ArgumentError, 'version cannot be nil'
179
+ end
180
+
181
+ @version = version
182
+ end
183
+
184
+ # Custom attribute writer method with validation
185
+ # @param [Object] summary Value to be assigned
186
+ def summary=(summary)
187
+ if summary.nil?
188
+ fail ArgumentError, 'summary cannot be nil'
189
+ end
190
+
191
+ @summary = summary
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(o)
197
+ return true if self.equal?(o)
198
+ self.class == o.class &&
199
+ id == o.id &&
200
+ version == o.version &&
201
+ summary == o.summary &&
202
+ formats == o.formats
203
+ end
204
+
205
+ # @see the `==` method
206
+ # @param [Object] Object to be compared
207
+ def eql?(o)
208
+ self == o
209
+ end
210
+
211
+ # Calculates hash code according to all attributes.
212
+ # @return [Integer] Hash code
213
+ def hash
214
+ [id, version, summary, formats].hash
215
+ end
216
+
217
+ # Builds the object from hash
218
+ # @param [Hash] attributes Model attributes in the form of hash
219
+ # @return [Object] Returns the model itself
220
+ def self.build_from_hash(attributes)
221
+ return nil unless attributes.is_a?(Hash)
222
+ attributes = attributes.transform_keys(&:to_sym)
223
+ transformed_hash = {}
224
+ openapi_types.each_pair do |key, type|
225
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = nil
227
+ elsif type =~ /\AArray<(.*)>/i
228
+ # check to ensure the input is an array given that the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[attribute_map[key]].is_a?(Array)
231
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
232
+ end
233
+ elsif !attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
235
+ end
236
+ end
237
+ new(transformed_hash)
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ if value.nil?
247
+ is_nullable = self.class.openapi_nullable.include?(attr)
248
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
+ end
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ end
257
+
258
+ end
@@ -0,0 +1,246 @@
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 DbChecksums < ApiModelBase
18
+ # Hex-encoded MD5 digest.
19
+ attr_accessor :md5
20
+
21
+ # Hex-encoded SHA-1 digest.
22
+ attr_accessor :sha1
23
+
24
+ # Hex-encoded SHA-256 digest.
25
+ attr_accessor :sha256
26
+
27
+ # Hex-encoded SHA-512 digest.
28
+ attr_accessor :sha512
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'md5' => :'md5',
34
+ :'sha1' => :'sha1',
35
+ :'sha256' => :'sha256',
36
+ :'sha512' => :'sha512'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'md5' => :'String',
54
+ :'sha1' => :'String',
55
+ :'sha256' => :'String',
56
+ :'sha512' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::DbChecksums` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::DbChecksums`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'md5')
83
+ self.md5 = attributes[:'md5']
84
+ else
85
+ self.md5 = nil
86
+ end
87
+
88
+ if attributes.key?(:'sha1')
89
+ self.sha1 = attributes[:'sha1']
90
+ else
91
+ self.sha1 = nil
92
+ end
93
+
94
+ if attributes.key?(:'sha256')
95
+ self.sha256 = attributes[:'sha256']
96
+ else
97
+ self.sha256 = nil
98
+ end
99
+
100
+ if attributes.key?(:'sha512')
101
+ self.sha512 = attributes[:'sha512']
102
+ else
103
+ self.sha512 = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @md5.nil?
113
+ invalid_properties.push('invalid value for "md5", md5 cannot be nil.')
114
+ end
115
+
116
+ if @sha1.nil?
117
+ invalid_properties.push('invalid value for "sha1", sha1 cannot be nil.')
118
+ end
119
+
120
+ if @sha256.nil?
121
+ invalid_properties.push('invalid value for "sha256", sha256 cannot be nil.')
122
+ end
123
+
124
+ if @sha512.nil?
125
+ invalid_properties.push('invalid value for "sha512", sha512 cannot be nil.')
126
+ end
127
+
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
135
+ return false if @md5.nil?
136
+ return false if @sha1.nil?
137
+ return false if @sha256.nil?
138
+ return false if @sha512.nil?
139
+ true
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] md5 Value to be assigned
144
+ def md5=(md5)
145
+ if md5.nil?
146
+ fail ArgumentError, 'md5 cannot be nil'
147
+ end
148
+
149
+ @md5 = md5
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] sha1 Value to be assigned
154
+ def sha1=(sha1)
155
+ if sha1.nil?
156
+ fail ArgumentError, 'sha1 cannot be nil'
157
+ end
158
+
159
+ @sha1 = sha1
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] sha256 Value to be assigned
164
+ def sha256=(sha256)
165
+ if sha256.nil?
166
+ fail ArgumentError, 'sha256 cannot be nil'
167
+ end
168
+
169
+ @sha256 = sha256
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] sha512 Value to be assigned
174
+ def sha512=(sha512)
175
+ if sha512.nil?
176
+ fail ArgumentError, 'sha512 cannot be nil'
177
+ end
178
+
179
+ @sha512 = sha512
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ md5 == o.md5 &&
188
+ sha1 == o.sha1 &&
189
+ sha256 == o.sha256 &&
190
+ sha512 == o.sha512
191
+ end
192
+
193
+ # @see the `==` method
194
+ # @param [Object] Object to be compared
195
+ def eql?(o)
196
+ self == o
197
+ end
198
+
199
+ # Calculates hash code according to all attributes.
200
+ # @return [Integer] Hash code
201
+ def hash
202
+ [md5, sha1, sha256, sha512].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def self.build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+ attributes = attributes.transform_keys(&:to_sym)
211
+ transformed_hash = {}
212
+ openapi_types.each_pair do |key, type|
213
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
214
+ transformed_hash["#{key}"] = nil
215
+ elsif type =~ /\AArray<(.*)>/i
216
+ # check to ensure the input is an array given that the attribute
217
+ # is documented as an array but the input is not
218
+ if attributes[attribute_map[key]].is_a?(Array)
219
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
220
+ end
221
+ elsif !attributes[attribute_map[key]].nil?
222
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
223
+ end
224
+ end
225
+ new(transformed_hash)
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ end
245
+
246
+ end