internetdata 2.9.2 → 2.10.1

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +146 -9
  3. data/lib/internetdata/api/database_v2_api.rb +2 -2
  4. data/lib/internetdata/api_client.rb +2 -2
  5. data/lib/internetdata/api_error.rb +2 -2
  6. data/lib/internetdata/api_model_base.rb +2 -2
  7. data/lib/internetdata/asn_result.rb +107 -0
  8. data/lib/internetdata/bogon.rb +92 -0
  9. data/lib/internetdata/bogons.rb +93 -0
  10. data/lib/internetdata/cache.rb +35 -0
  11. data/lib/internetdata/client.rb +396 -16
  12. data/lib/internetdata/configuration.rb +23 -2
  13. data/lib/internetdata/domain_result.rb +124 -0
  14. data/lib/internetdata/errors.rb +29 -6
  15. data/lib/internetdata/models/abuse_contact.rb +236 -0
  16. data/lib/internetdata/models/asn.rb +294 -0
  17. data/lib/internetdata/models/asn_lookup_response.rb +405 -0
  18. data/lib/internetdata/models/asn_prefix.rb +329 -0
  19. data/lib/internetdata/models/batch_lookup_error.rb +192 -0
  20. data/lib/internetdata/models/bit_torrent_detail.rb +240 -0
  21. data/lib/internetdata/models/carrier_detail.rb +188 -0
  22. data/lib/internetdata/models/class_detail.rb +178 -0
  23. data/lib/internetdata/models/client_registration.rb +2 -2
  24. data/lib/internetdata/models/company.rb +213 -0
  25. data/lib/internetdata/models/database.rb +2 -2
  26. data/lib/internetdata/models/database_checksums_response.rb +2 -2
  27. data/lib/internetdata/models/database_format.rb +2 -2
  28. data/lib/internetdata/models/database_list.rb +2 -2
  29. data/lib/internetdata/models/database_metadata.rb +2 -2
  30. data/lib/internetdata/models/database_metadata_column.rb +2 -2
  31. data/lib/internetdata/models/database_version.rb +2 -2
  32. data/lib/internetdata/models/db_checksums.rb +2 -2
  33. data/lib/internetdata/models/device_authorization.rb +2 -2
  34. data/lib/internetdata/models/disposable_detail.rb +180 -0
  35. data/lib/internetdata/models/dns_address_record.rb +192 -0
  36. data/lib/internetdata/models/dns_cname_record.rb +192 -0
  37. data/lib/internetdata/models/dns_mx_record.rb +219 -0
  38. data/lib/internetdata/models/dns_ns_record.rb +192 -0
  39. data/lib/internetdata/models/dns_resolver_detail.rb +198 -0
  40. data/lib/internetdata/models/domain_dns.rb +279 -0
  41. data/lib/internetdata/models/domain_ip_range.rb +219 -0
  42. data/lib/internetdata/models/domain_ip_ranges.rb +276 -0
  43. data/lib/internetdata/models/domain_lookup_response.rb +376 -0
  44. data/lib/internetdata/models/download.rb +2 -2
  45. data/lib/internetdata/models/download_list.rb +2 -2
  46. data/lib/internetdata/models/entitlement.rb +243 -0
  47. data/lib/internetdata/models/entitlement_apikey.rb +207 -0
  48. data/lib/internetdata/models/entitlement_plan.rb +216 -0
  49. data/lib/internetdata/models/entitlement_usage.rb +259 -0
  50. data/lib/internetdata/models/error_envelope.rb +2 -2
  51. data/lib/internetdata/models/hosted_domains.rb +166 -0
  52. data/lib/internetdata/models/location.rb +509 -0
  53. data/lib/internetdata/models/lookup_response.rb +897 -0
  54. data/lib/internetdata/models/oauth_metadata.rb +2 -2
  55. data/lib/internetdata/models/proxy_detail.rb +208 -0
  56. data/lib/internetdata/models/pubproxy_detail.rb +210 -0
  57. data/lib/internetdata/models/rwhois.rb +301 -0
  58. data/lib/internetdata/models/satellite_detail.rb +208 -0
  59. data/lib/internetdata/models/smtp_detail.rb +188 -0
  60. data/lib/internetdata/models/ssh_detail.rb +198 -0
  61. data/lib/internetdata/models/standing.rb +2 -2
  62. data/lib/internetdata/models/token_response.rb +2 -2
  63. data/lib/internetdata/models/web_detail.rb +516 -0
  64. data/lib/internetdata/models/whois.rb +382 -0
  65. data/lib/internetdata/oauth_api.rb +1 -1
  66. data/lib/internetdata/result.rb +431 -0
  67. data/lib/internetdata/transport.rb +210 -26
  68. data/lib/internetdata/version.rb +1 -1
  69. data/lib/internetdata.rb +17 -2
  70. metadata +58 -3
@@ -0,0 +1,376 @@
1
+ =begin
2
+ #InternetData API
3
+
4
+ #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, 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
+
6
+ The version of the OpenAPI document: 2026.11.13
7
+ Contact: support@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
+ # What every database says about one domain.
18
+ class DomainLookupResponse < ApiModelBase
19
+ # The domain, lowercase and in punycode.
20
+ attr_accessor :domain
21
+
22
+ # In Domain List: a registered domain.
23
+ attr_accessor :is_registered
24
+
25
+ # In Disposable Domain. Paid plans and the trial.
26
+ attr_accessor :is_disposable
27
+
28
+ # It has A records.
29
+ attr_accessor :has_a
30
+
31
+ # AAAA records.
32
+ attr_accessor :has_aaaa
33
+
34
+ # MX records.
35
+ attr_accessor :has_mx
36
+
37
+ # NS records.
38
+ attr_accessor :has_ns
39
+
40
+ # A CNAME record.
41
+ attr_accessor :has_cname
42
+
43
+ attr_accessor :dns
44
+
45
+ attr_accessor :ip_ranges
46
+
47
+ # `{}` when `is_disposable` is false. Paid plans and the trial.
48
+ attr_accessor :disposable
49
+
50
+ # On every answer to a key on the free plan, and on no other: `false` while the day's trial of every field lasts, `true` once the answer has Unlimited's fields.
51
+ attr_accessor :trial_expired
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'domain' => :'domain',
57
+ :'is_registered' => :'is_registered',
58
+ :'is_disposable' => :'is_disposable',
59
+ :'has_a' => :'has_a',
60
+ :'has_aaaa' => :'has_aaaa',
61
+ :'has_mx' => :'has_mx',
62
+ :'has_ns' => :'has_ns',
63
+ :'has_cname' => :'has_cname',
64
+ :'dns' => :'dns',
65
+ :'ip_ranges' => :'ip_ranges',
66
+ :'disposable' => :'disposable',
67
+ :'trial_expired' => :'trial_expired'
68
+ }
69
+ end
70
+
71
+ # Returns attribute mapping this model knows about
72
+ def self.acceptable_attribute_map
73
+ attribute_map
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ acceptable_attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'domain' => :'String',
85
+ :'is_registered' => :'Boolean',
86
+ :'is_disposable' => :'Boolean',
87
+ :'has_a' => :'Boolean',
88
+ :'has_aaaa' => :'Boolean',
89
+ :'has_mx' => :'Boolean',
90
+ :'has_ns' => :'Boolean',
91
+ :'has_cname' => :'Boolean',
92
+ :'dns' => :'DomainDns',
93
+ :'ip_ranges' => :'DomainIpRanges',
94
+ :'disposable' => :'DisposableDetail',
95
+ :'trial_expired' => :'Boolean'
96
+ }
97
+ end
98
+
99
+ # List of attributes with nullable: true
100
+ def self.openapi_nullable
101
+ Set.new([
102
+ ])
103
+ end
104
+
105
+ # Initializes the object
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ def initialize(attributes = {})
108
+ if (!attributes.is_a?(Hash))
109
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::DomainLookupResponse` initialize method"
110
+ end
111
+
112
+ # check to see if the attribute exists and convert string to symbol for hash key
113
+ acceptable_attribute_map = self.class.acceptable_attribute_map
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!acceptable_attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::DomainLookupResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'domain')
122
+ self.domain = attributes[:'domain']
123
+ else
124
+ self.domain = nil
125
+ end
126
+
127
+ if attributes.key?(:'is_registered')
128
+ self.is_registered = attributes[:'is_registered']
129
+ else
130
+ self.is_registered = nil
131
+ end
132
+
133
+ if attributes.key?(:'is_disposable')
134
+ self.is_disposable = attributes[:'is_disposable']
135
+ end
136
+
137
+ if attributes.key?(:'has_a')
138
+ self.has_a = attributes[:'has_a']
139
+ else
140
+ self.has_a = nil
141
+ end
142
+
143
+ if attributes.key?(:'has_aaaa')
144
+ self.has_aaaa = attributes[:'has_aaaa']
145
+ else
146
+ self.has_aaaa = nil
147
+ end
148
+
149
+ if attributes.key?(:'has_mx')
150
+ self.has_mx = attributes[:'has_mx']
151
+ else
152
+ self.has_mx = nil
153
+ end
154
+
155
+ if attributes.key?(:'has_ns')
156
+ self.has_ns = attributes[:'has_ns']
157
+ else
158
+ self.has_ns = nil
159
+ end
160
+
161
+ if attributes.key?(:'has_cname')
162
+ self.has_cname = attributes[:'has_cname']
163
+ else
164
+ self.has_cname = nil
165
+ end
166
+
167
+ if attributes.key?(:'dns')
168
+ self.dns = attributes[:'dns']
169
+ end
170
+
171
+ if attributes.key?(:'ip_ranges')
172
+ self.ip_ranges = attributes[:'ip_ranges']
173
+ end
174
+
175
+ if attributes.key?(:'disposable')
176
+ self.disposable = attributes[:'disposable']
177
+ end
178
+
179
+ if attributes.key?(:'trial_expired')
180
+ self.trial_expired = attributes[:'trial_expired']
181
+ end
182
+ end
183
+
184
+ # Show invalid properties with the reasons. Usually used together with valid?
185
+ # @return Array for valid properties with the reasons
186
+ def list_invalid_properties
187
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
188
+ invalid_properties = Array.new
189
+ if @domain.nil?
190
+ invalid_properties.push('invalid value for "domain", domain cannot be nil.')
191
+ end
192
+
193
+ if @is_registered.nil?
194
+ invalid_properties.push('invalid value for "is_registered", is_registered cannot be nil.')
195
+ end
196
+
197
+ if @has_a.nil?
198
+ invalid_properties.push('invalid value for "has_a", has_a cannot be nil.')
199
+ end
200
+
201
+ if @has_aaaa.nil?
202
+ invalid_properties.push('invalid value for "has_aaaa", has_aaaa cannot be nil.')
203
+ end
204
+
205
+ if @has_mx.nil?
206
+ invalid_properties.push('invalid value for "has_mx", has_mx cannot be nil.')
207
+ end
208
+
209
+ if @has_ns.nil?
210
+ invalid_properties.push('invalid value for "has_ns", has_ns cannot be nil.')
211
+ end
212
+
213
+ if @has_cname.nil?
214
+ invalid_properties.push('invalid value for "has_cname", has_cname cannot be nil.')
215
+ end
216
+
217
+ invalid_properties
218
+ end
219
+
220
+ # Check to see if the all the properties in the model are valid
221
+ # @return true if the model is valid
222
+ def valid?
223
+ warn '[DEPRECATED] the `valid?` method is obsolete'
224
+ return false if @domain.nil?
225
+ return false if @is_registered.nil?
226
+ return false if @has_a.nil?
227
+ return false if @has_aaaa.nil?
228
+ return false if @has_mx.nil?
229
+ return false if @has_ns.nil?
230
+ return false if @has_cname.nil?
231
+ true
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] domain Value to be assigned
236
+ def domain=(domain)
237
+ if domain.nil?
238
+ fail ArgumentError, 'domain cannot be nil'
239
+ end
240
+
241
+ @domain = domain
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] is_registered Value to be assigned
246
+ def is_registered=(is_registered)
247
+ if is_registered.nil?
248
+ fail ArgumentError, 'is_registered cannot be nil'
249
+ end
250
+
251
+ @is_registered = is_registered
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] has_a Value to be assigned
256
+ def has_a=(has_a)
257
+ if has_a.nil?
258
+ fail ArgumentError, 'has_a cannot be nil'
259
+ end
260
+
261
+ @has_a = has_a
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] has_aaaa Value to be assigned
266
+ def has_aaaa=(has_aaaa)
267
+ if has_aaaa.nil?
268
+ fail ArgumentError, 'has_aaaa cannot be nil'
269
+ end
270
+
271
+ @has_aaaa = has_aaaa
272
+ end
273
+
274
+ # Custom attribute writer method with validation
275
+ # @param [Object] has_mx Value to be assigned
276
+ def has_mx=(has_mx)
277
+ if has_mx.nil?
278
+ fail ArgumentError, 'has_mx cannot be nil'
279
+ end
280
+
281
+ @has_mx = has_mx
282
+ end
283
+
284
+ # Custom attribute writer method with validation
285
+ # @param [Object] has_ns Value to be assigned
286
+ def has_ns=(has_ns)
287
+ if has_ns.nil?
288
+ fail ArgumentError, 'has_ns cannot be nil'
289
+ end
290
+
291
+ @has_ns = has_ns
292
+ end
293
+
294
+ # Custom attribute writer method with validation
295
+ # @param [Object] has_cname Value to be assigned
296
+ def has_cname=(has_cname)
297
+ if has_cname.nil?
298
+ fail ArgumentError, 'has_cname cannot be nil'
299
+ end
300
+
301
+ @has_cname = has_cname
302
+ end
303
+
304
+ # Checks equality by comparing each attribute.
305
+ # @param [Object] Object to be compared
306
+ def ==(o)
307
+ return true if self.equal?(o)
308
+ self.class == o.class &&
309
+ domain == o.domain &&
310
+ is_registered == o.is_registered &&
311
+ is_disposable == o.is_disposable &&
312
+ has_a == o.has_a &&
313
+ has_aaaa == o.has_aaaa &&
314
+ has_mx == o.has_mx &&
315
+ has_ns == o.has_ns &&
316
+ has_cname == o.has_cname &&
317
+ dns == o.dns &&
318
+ ip_ranges == o.ip_ranges &&
319
+ disposable == o.disposable &&
320
+ trial_expired == o.trial_expired
321
+ end
322
+
323
+ # @see the `==` method
324
+ # @param [Object] Object to be compared
325
+ def eql?(o)
326
+ self == o
327
+ end
328
+
329
+ # Calculates hash code according to all attributes.
330
+ # @return [Integer] Hash code
331
+ def hash
332
+ [domain, is_registered, is_disposable, has_a, has_aaaa, has_mx, has_ns, has_cname, dns, ip_ranges, disposable, trial_expired].hash
333
+ end
334
+
335
+ # Builds the object from hash
336
+ # @param [Hash] attributes Model attributes in the form of hash
337
+ # @return [Object] Returns the model itself
338
+ def self.build_from_hash(attributes)
339
+ return nil unless attributes.is_a?(Hash)
340
+ attributes = attributes.transform_keys(&:to_sym)
341
+ transformed_hash = {}
342
+ openapi_types.each_pair do |key, type|
343
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
344
+ transformed_hash["#{key}"] = nil
345
+ elsif type =~ /\AArray<(.*)>/i
346
+ # check to ensure the input is an array given that the attribute
347
+ # is documented as an array but the input is not
348
+ if attributes[attribute_map[key]].is_a?(Array)
349
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
350
+ end
351
+ elsif !attributes[attribute_map[key]].nil?
352
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
353
+ end
354
+ end
355
+ new(transformed_hash)
356
+ end
357
+
358
+ # Returns the object in the form of hash
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_hash
361
+ hash = {}
362
+ self.class.attribute_map.each_pair do |attr, param|
363
+ value = self.send(attr)
364
+ if value.nil?
365
+ is_nullable = self.class.openapi_nullable.include?(attr)
366
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
367
+ end
368
+
369
+ hash[param] = _to_hash(value)
370
+ end
371
+ hash
372
+ end
373
+
374
+ end
375
+
376
+ end
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #InternetData API
3
3
 
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.
4
+ #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, 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.08
6
+ The version of the OpenAPI document: 2026.11.13
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -1,9 +1,9 @@
1
1
  =begin
2
2
  #InternetData API
3
3
 
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.
4
+ #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, 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.08
6
+ The version of the OpenAPI document: 2026.11.13
7
7
  Contact: support@internetdata.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #InternetData API
3
+
4
+ #The InternetData API: look up what every database InternetData publishes says about an IP address, an AS or a domain, 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
+
6
+ The version of the OpenAPI document: 2026.11.13
7
+ Contact: support@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 Entitlement < ApiModelBase
18
+ # The organization the key belongs to.
19
+ attr_accessor :org_id
20
+
21
+ attr_accessor :apikey
22
+
23
+ attr_accessor :plan
24
+
25
+ attr_accessor :usage
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'org_id' => :'org_id',
31
+ :'apikey' => :'apikey',
32
+ :'plan' => :'plan',
33
+ :'usage' => :'usage'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'org_id' => :'String',
51
+ :'apikey' => :'EntitlementApikey',
52
+ :'plan' => :'EntitlementPlan',
53
+ :'usage' => :'EntitlementUsage'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `InternetData::Entitlement` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `InternetData::Entitlement`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'org_id')
80
+ self.org_id = attributes[:'org_id']
81
+ else
82
+ self.org_id = nil
83
+ end
84
+
85
+ if attributes.key?(:'apikey')
86
+ self.apikey = attributes[:'apikey']
87
+ else
88
+ self.apikey = nil
89
+ end
90
+
91
+ if attributes.key?(:'plan')
92
+ self.plan = attributes[:'plan']
93
+ else
94
+ self.plan = nil
95
+ end
96
+
97
+ if attributes.key?(:'usage')
98
+ self.usage = attributes[:'usage']
99
+ else
100
+ self.usage = nil
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @org_id.nil?
110
+ invalid_properties.push('invalid value for "org_id", org_id cannot be nil.')
111
+ end
112
+
113
+ if @apikey.nil?
114
+ invalid_properties.push('invalid value for "apikey", apikey cannot be nil.')
115
+ end
116
+
117
+ if @plan.nil?
118
+ invalid_properties.push('invalid value for "plan", plan cannot be nil.')
119
+ end
120
+
121
+ if @usage.nil?
122
+ invalid_properties.push('invalid value for "usage", usage cannot be nil.')
123
+ end
124
+
125
+ invalid_properties
126
+ end
127
+
128
+ # Check to see if the all the properties in the model are valid
129
+ # @return true if the model is valid
130
+ def valid?
131
+ warn '[DEPRECATED] the `valid?` method is obsolete'
132
+ return false if @org_id.nil?
133
+ return false if @apikey.nil?
134
+ return false if @plan.nil?
135
+ return false if @usage.nil?
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] org_id Value to be assigned
141
+ def org_id=(org_id)
142
+ if org_id.nil?
143
+ fail ArgumentError, 'org_id cannot be nil'
144
+ end
145
+
146
+ @org_id = org_id
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] apikey Value to be assigned
151
+ def apikey=(apikey)
152
+ if apikey.nil?
153
+ fail ArgumentError, 'apikey cannot be nil'
154
+ end
155
+
156
+ @apikey = apikey
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] plan Value to be assigned
161
+ def plan=(plan)
162
+ if plan.nil?
163
+ fail ArgumentError, 'plan cannot be nil'
164
+ end
165
+
166
+ @plan = plan
167
+ end
168
+
169
+ # Custom attribute writer method with validation
170
+ # @param [Object] usage Value to be assigned
171
+ def usage=(usage)
172
+ if usage.nil?
173
+ fail ArgumentError, 'usage cannot be nil'
174
+ end
175
+
176
+ @usage = usage
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ org_id == o.org_id &&
185
+ apikey == o.apikey &&
186
+ plan == o.plan &&
187
+ usage == o.usage
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(o)
193
+ self == o
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Integer] Hash code
198
+ def hash
199
+ [org_id, apikey, plan, usage].hash
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def self.build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ attributes = attributes.transform_keys(&:to_sym)
208
+ transformed_hash = {}
209
+ openapi_types.each_pair do |key, type|
210
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
211
+ transformed_hash["#{key}"] = nil
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[attribute_map[key]].is_a?(Array)
216
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
217
+ end
218
+ elsif !attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
220
+ end
221
+ end
222
+ new(transformed_hash)
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ end
242
+
243
+ end