vpndetection 5.0.0 → 5.2.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -4
  3. data/lib/vpndetection/api/account_wire_api.rb +1 -1
  4. data/lib/vpndetection/api/api_keys_wire_api.rb +1 -1
  5. data/lib/vpndetection/api/authorization_wire_api.rb +19 -17
  6. data/lib/vpndetection/api/database_wire_api.rb +7 -3
  7. data/lib/vpndetection/api/entitlement_wire_api.rb +1 -1
  8. data/lib/vpndetection/api/lookup_wire_api.rb +69 -1
  9. data/lib/vpndetection/api/organization_wire_api.rb +1 -1
  10. data/lib/vpndetection/api_client.rb +1 -1
  11. data/lib/vpndetection/api_error.rb +1 -1
  12. data/lib/vpndetection/api_model_base.rb +1 -1
  13. data/lib/vpndetection/client.rb +77 -30
  14. data/lib/vpndetection/configuration.rb +1 -1
  15. data/lib/vpndetection/database_api.rb +18 -10
  16. data/lib/vpndetection/errors.rb +61 -13
  17. data/lib/vpndetection/models/account_create_apikey_request.rb +1 -1
  18. data/lib/vpndetection/models/account_created_apikey.rb +1 -1
  19. data/lib/vpndetection/models/account_org.rb +1 -1
  20. data/lib/vpndetection/models/account_org_ref.rb +1 -1
  21. data/lib/vpndetection/models/account_org_wrap.rb +1 -1
  22. data/lib/vpndetection/models/account_rc.rb +1 -1
  23. data/lib/vpndetection/models/account_revealed_apikey.rb +1 -1
  24. data/lib/vpndetection/models/account_user.rb +1 -1
  25. data/lib/vpndetection/models/apikey_detail.rb +1 -1
  26. data/lib/vpndetection/models/apikey_list.rb +1 -1
  27. data/lib/vpndetection/models/batch_lookup_error.rb +193 -0
  28. data/lib/vpndetection/models/batch_lookup_request.rb +185 -0
  29. data/lib/vpndetection/models/batch_lookup_response.rb +196 -0
  30. data/lib/vpndetection/models/class_detail.rb +1 -1
  31. data/lib/vpndetection/models/database.rb +1 -1
  32. data/lib/vpndetection/models/database_checksums_response.rb +1 -1
  33. data/lib/vpndetection/models/database_format.rb +1 -1
  34. data/lib/vpndetection/models/database_format_size.rb +1 -1
  35. data/lib/vpndetection/models/database_list.rb +1 -1
  36. data/lib/vpndetection/models/database_metadata.rb +1 -1
  37. data/lib/vpndetection/models/database_metadata_column.rb +1 -1
  38. data/lib/vpndetection/models/database_version.rb +1 -1
  39. data/lib/vpndetection/models/db_checksums.rb +1 -1
  40. data/lib/vpndetection/models/device_authorization.rb +2 -1
  41. data/lib/vpndetection/models/download.rb +1 -1
  42. data/lib/vpndetection/models/download_list.rb +1 -1
  43. data/lib/vpndetection/models/entitlement.rb +1 -1
  44. data/lib/vpndetection/models/entitlement_apikey.rb +1 -1
  45. data/lib/vpndetection/models/entitlement_error.rb +1 -1
  46. data/lib/vpndetection/models/entitlement_plan.rb +1 -1
  47. data/lib/vpndetection/models/entitlement_usage.rb +1 -1
  48. data/lib/vpndetection/models/error_envelope.rb +1 -1
  49. data/lib/vpndetection/models/identity.rb +1 -1
  50. data/lib/vpndetection/models/lookup_error.rb +1 -1
  51. data/lib/vpndetection/models/lookup_response.rb +1 -1
  52. data/lib/vpndetection/models/oauth_error.rb +1 -1
  53. data/lib/vpndetection/models/oauth_metadata.rb +30 -9
  54. data/lib/vpndetection/models/proxy_detail.rb +1 -1
  55. data/lib/vpndetection/models/standing.rb +1 -1
  56. data/lib/vpndetection/models/token_response.rb +28 -5
  57. data/lib/vpndetection/models/vpn_detail.rb +1 -1
  58. data/lib/vpndetection/oauth_api.rb +166 -0
  59. data/lib/vpndetection/retries.rb +4 -2
  60. data/lib/vpndetection/transport.rb +80 -4
  61. data/lib/vpndetection/version.rb +1 -1
  62. data/lib/vpndetection.rb +1 -0
  63. metadata +5 -1
@@ -38,25 +38,26 @@ module VPNDetection
38
38
  def self.from_status(status, headers, body, message: nil)
39
39
  message ||= message_of(body) || "request failed with status #{status}"
40
40
  retry_after = parse_retry_after(header(headers, 'retry-after'))
41
+ kind = kind_for(status, headers)
41
42
 
43
+ new(kind, message, status: status, retry_after_seconds: kind == :rate_limited ? retry_after : nil)
44
+ end
45
+
46
+ # What a response with this status is, whatever its body says.
47
+ def self.kind_for(status, headers)
42
48
  case status
43
- when 429
44
- # Present means transient, absent means an allowance is spent. Nothing
45
- # else in the response separates the two.
46
- if retry_after.nil?
47
- new(:quota_exceeded, message, status: status)
48
- else
49
- new(:rate_limited, message, status: status, retry_after_seconds: retry_after)
50
- end
51
- when 400 then new(:bad_request, message, status: status)
52
- when 401 then new(:unauthorized, message, status: status)
53
- when 403 then new(:forbidden, message, status: status)
49
+ # Present means transient, absent means an allowance is spent. Nothing
50
+ # else in the response separates the two.
51
+ when 429 then parse_retry_after(header(headers, 'retry-after')).nil? ? :quota_exceeded : :rate_limited
52
+ when 400 then :bad_request
53
+ when 401 then :unauthorized
54
+ when 403 then :forbidden
54
55
  # Every other 4xx is a CLIENT error. Classifying on the RANGE rather than
55
56
  # on an enumerated list is what keeps a 404 from a bad dataset id falling
56
57
  # through to the retryable server_error default and being retried twice
57
58
  # before it fails.
58
- when 400..499 then new(:bad_request, message, status: status)
59
- else new(:server_error, message, status: status)
59
+ when 400..499 then :bad_request
60
+ else :server_error
60
61
  end
61
62
  end
62
63
 
@@ -67,6 +68,13 @@ module VPNDetection
67
68
  new(:network, message)
68
69
  end
69
70
 
71
+ # A per-entry failure inside a successful batch: the status the single lookup
72
+ # would have answered, and its message, with no headers at all - so a 429
73
+ # here is a spent allowance, which is the only kind the API puts in an entry.
74
+ def self.from_entry(status, message)
75
+ from_status(status.to_i, {}, nil, message: message.to_s)
76
+ end
77
+
70
78
  # Case-insensitive, and works with a plain Hash as well as with the
71
79
  # case-blind header object Typhoeus builds from a live response.
72
80
  def self.header(headers, name)
@@ -104,4 +112,44 @@ module VPNDetection
104
112
 
105
113
  private_class_method :header, :message_of, :parse_retry_after
106
114
  end
115
+
116
+ # The authorization server refusing an OAuth request: a 4xx whose body names an
117
+ # RFC 6749 `error` code. Never retryable, whatever the status, because every
118
+ # code it can carry answers the request as it was made.
119
+ #
120
+ # Not `OauthError`: that constant is the generated model of the error body.
121
+ class OauthRequestError < Error
122
+ # The `error` code, such as `slow_down` or `invalid_grant`.
123
+ attr_reader :error_code
124
+ # `error_description` when the server sent one as a string, otherwise nil.
125
+ attr_reader :error_description
126
+
127
+ # The refusal a response carries, as the most specific class its code has.
128
+ def self.for_code(error_code, error_description, status:, headers: {})
129
+ klass = case error_code
130
+ when 'access_denied' then OauthAccessDeniedError
131
+ when 'expired_token' then OauthExpiredTokenError
132
+ else OauthRequestError
133
+ end
134
+ klass.new(error_code, error_description, kind: Error.kind_for(status, headers), status: status)
135
+ end
136
+
137
+ def initialize(error_code, error_description = nil, kind: :bad_request, status: nil)
138
+ super(kind, error_description.nil? ? error_code : "#{error_code}: #{error_description}", status: status)
139
+ @error_code = error_code
140
+ @error_description = error_description
141
+ end
142
+
143
+ def retryable?
144
+ false
145
+ end
146
+ end
147
+
148
+ # The person refused the sign-in. Their device code is spent.
149
+ class OauthAccessDeniedError < OauthRequestError; end
150
+
151
+ # The device code is no longer valid: it expired, or was already exchanged or
152
+ # refused. Raised with no status when {OauthApi#poll_device_token} reaches the
153
+ # code's lifetime before the server says so.
154
+ class OauthExpiredTokenError < OauthRequestError; end
107
155
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #The VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.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 VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
5
 
6
- The version of the OpenAPI document: 2026.09.15
6
+ The version of the OpenAPI document: 2026.09.16
7
7
  Contact: support@vpndetection.io
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.25.0
@@ -0,0 +1,193 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
+
6
+ The version of the OpenAPI document: 2026.09.16
7
+ Contact: support@vpndetection.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 VPNDetection
17
+ # Why one entry of a batch was not answered, as the single lookup would have reported it.
18
+ class BatchLookupError < ApiModelBase
19
+ # The HTTP status `GET /{ip}` would have answered for this entry: `400` for a string that is not an address, `429` for a spent allowance, `500` when the VPN dataset could not be consulted. A `429` here is never a throttle; the whole call is refused instead.
20
+ attr_accessor :status
21
+
22
+ # The same message the single lookup carries for that status.
23
+ attr_accessor :error
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'status' => :'status',
29
+ :'error' => :'error'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'status' => :'Integer',
47
+ :'error' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::BatchLookupError` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ acceptable_attribute_map = self.class.acceptable_attribute_map
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!acceptable_attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::BatchLookupError`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'status')
74
+ self.status = attributes[:'status']
75
+ else
76
+ self.status = nil
77
+ end
78
+
79
+ if attributes.key?(:'error')
80
+ self.error = attributes[:'error']
81
+ else
82
+ self.error = nil
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
+ invalid_properties = Array.new
91
+ if @status.nil?
92
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
93
+ end
94
+
95
+ if @error.nil?
96
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ return false if @status.nil?
107
+ return false if @error.nil?
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] status Value to be assigned
113
+ def status=(status)
114
+ if status.nil?
115
+ fail ArgumentError, 'status cannot be nil'
116
+ end
117
+
118
+ @status = status
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] error Value to be assigned
123
+ def error=(error)
124
+ if error.nil?
125
+ fail ArgumentError, 'error cannot be nil'
126
+ end
127
+
128
+ @error = error
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ status == o.status &&
137
+ error == o.error
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [status, error].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ end
192
+
193
+ end
@@ -0,0 +1,185 @@
1
+ =begin
2
+ #VPNDetection API
3
+
4
+ #The VPNDetection API: classify any IP address, and download the databases behind the answers. See https://docs.vpndetection.io for guides and https://github.com/vpndetection-io for the official client libraries.
5
+
6
+ The version of the OpenAPI document: 2026.09.16
7
+ Contact: support@vpndetection.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 VPNDetection
17
+ class BatchLookupRequest < ApiModelBase
18
+ # The addresses to classify, 1 to 1000 per call, counted before duplicates collapse. Each distinct string is one lookup.
19
+ attr_accessor :ips
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'ips' => :'ips'
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
+ :'ips' => :'Array<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 `VPNDetection::BatchLookupRequest` 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 `VPNDetection::BatchLookupRequest`. 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?(:'ips')
68
+ if (value = attributes[:'ips']).is_a?(Array)
69
+ self.ips = value
70
+ end
71
+ else
72
+ self.ips = nil
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
+ invalid_properties = Array.new
81
+ if @ips.nil?
82
+ invalid_properties.push('invalid value for "ips", ips cannot be nil.')
83
+ end
84
+
85
+ if @ips.length > 1000
86
+ invalid_properties.push('invalid value for "ips", number of items must be less than or equal to 1000.')
87
+ end
88
+
89
+ if @ips.length < 1
90
+ invalid_properties.push('invalid value for "ips", number of items must be greater than or equal to 1.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ return false if @ips.nil?
101
+ return false if @ips.length > 1000
102
+ return false if @ips.length < 1
103
+ true
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] ips Value to be assigned
108
+ def ips=(ips)
109
+ if ips.nil?
110
+ fail ArgumentError, 'ips cannot be nil'
111
+ end
112
+
113
+ if ips.length > 1000
114
+ fail ArgumentError, 'invalid value for "ips", number of items must be less than or equal to 1000.'
115
+ end
116
+
117
+ if ips.length < 1
118
+ fail ArgumentError, 'invalid value for "ips", number of items must be greater than or equal to 1.'
119
+ end
120
+
121
+ @ips = ips
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ ips == o.ips
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Integer] Hash code
140
+ def hash
141
+ [ips].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def self.build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ attributes = attributes.transform_keys(&:to_sym)
150
+ transformed_hash = {}
151
+ openapi_types.each_pair do |key, type|
152
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
153
+ transformed_hash["#{key}"] = nil
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[attribute_map[key]].is_a?(Array)
158
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
159
+ end
160
+ elsif !attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
162
+ end
163
+ end
164
+ new(transformed_hash)
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ if value.nil?
174
+ is_nullable = self.class.openapi_nullable.include?(attr)
175
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
176
+ end
177
+
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ end
184
+
185
+ end