vpndetection 4.0.0 → 5.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -0
  3. data/lib/vpndetection/api/account_wire_api.rb +16 -16
  4. data/lib/vpndetection/api/api_keys_wire_api.rb +336 -0
  5. data/lib/vpndetection/api/authorization_wire_api.rb +421 -0
  6. data/lib/vpndetection/api/database_wire_api.rb +1 -1
  7. data/lib/vpndetection/api/entitlement_wire_api.rb +79 -0
  8. data/lib/vpndetection/api/lookup_wire_api.rb +3 -3
  9. data/lib/vpndetection/api/organization_wire_api.rb +136 -0
  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 +41 -0
  14. data/lib/vpndetection/configuration.rb +1 -5
  15. data/lib/vpndetection/models/account_create_apikey_request.rb +177 -0
  16. data/lib/vpndetection/models/account_created_apikey.rb +257 -0
  17. data/lib/vpndetection/models/account_org.rb +183 -0
  18. data/lib/vpndetection/models/account_org_ref.rb +164 -0
  19. data/lib/vpndetection/models/account_org_wrap.rb +190 -0
  20. data/lib/vpndetection/models/account_rc.rb +165 -0
  21. data/lib/vpndetection/models/account_revealed_apikey.rb +191 -0
  22. data/lib/vpndetection/models/account_user.rb +182 -0
  23. data/lib/vpndetection/models/apikey_detail.rb +307 -0
  24. data/lib/vpndetection/models/apikey_list.rb +192 -0
  25. data/lib/vpndetection/models/class_detail.rb +1 -1
  26. data/lib/vpndetection/models/database.rb +1 -1
  27. data/lib/vpndetection/models/database_checksums_response.rb +1 -1
  28. data/lib/vpndetection/models/database_format.rb +1 -1
  29. data/lib/vpndetection/models/database_format_size.rb +2 -2
  30. data/lib/vpndetection/models/database_list.rb +1 -1
  31. data/lib/vpndetection/models/database_metadata.rb +1 -1
  32. data/lib/vpndetection/models/database_metadata_column.rb +1 -1
  33. data/lib/vpndetection/models/database_version.rb +1 -1
  34. data/lib/vpndetection/models/db_checksums.rb +1 -1
  35. data/lib/vpndetection/models/device_authorization.rb +281 -0
  36. data/lib/vpndetection/models/download.rb +2 -2
  37. data/lib/vpndetection/models/download_list.rb +1 -1
  38. data/lib/vpndetection/models/{account_me.rb → entitlement.rb} +7 -7
  39. data/lib/vpndetection/models/{account_apikey.rb → entitlement_apikey.rb} +4 -4
  40. data/lib/vpndetection/models/{account_error.rb → entitlement_error.rb} +4 -4
  41. data/lib/vpndetection/models/{account_plan.rb → entitlement_plan.rb} +4 -4
  42. data/lib/vpndetection/models/{account_usage.rb → entitlement_usage.rb} +4 -4
  43. data/lib/vpndetection/models/error_envelope.rb +1 -1
  44. data/lib/vpndetection/models/identity.rb +245 -0
  45. data/lib/vpndetection/models/lookup_error.rb +1 -1
  46. data/lib/vpndetection/models/lookup_response.rb +1 -1
  47. data/lib/vpndetection/models/oauth_error.rb +173 -0
  48. data/lib/vpndetection/models/oauth_metadata.rb +288 -0
  49. data/lib/vpndetection/models/proxy_detail.rb +1 -1
  50. data/lib/vpndetection/models/standing.rb +1 -1
  51. data/lib/vpndetection/models/token_response.rb +235 -0
  52. data/lib/vpndetection/models/vpn_detail.rb +1 -1
  53. data/lib/vpndetection/transport.rb +25 -0
  54. data/lib/vpndetection/version.rb +1 -1
  55. metadata +25 -6
@@ -0,0 +1,191 @@
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.15
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 AccountRevealedApikey < ApiModelBase
18
+ attr_accessor :rc
19
+
20
+ # The secret.
21
+ attr_accessor :key
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'rc' => :'rc',
27
+ :'key' => :'key'
28
+ }
29
+ end
30
+
31
+ # Returns attribute mapping this model knows about
32
+ def self.acceptable_attribute_map
33
+ attribute_map
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ acceptable_attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'rc' => :'String',
45
+ :'key' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountRevealedApikey` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!acceptable_attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountRevealedApikey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'rc')
72
+ self.rc = attributes[:'rc']
73
+ else
74
+ self.rc = nil
75
+ end
76
+
77
+ if attributes.key?(:'key')
78
+ self.key = attributes[:'key']
79
+ else
80
+ self.key = nil
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ if @rc.nil?
90
+ invalid_properties.push('invalid value for "rc", rc cannot be nil.')
91
+ end
92
+
93
+ if @key.nil?
94
+ invalid_properties.push('invalid value for "key", key cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ warn '[DEPRECATED] the `valid?` method is obsolete'
104
+ return false if @rc.nil?
105
+ return false if @key.nil?
106
+ true
107
+ end
108
+
109
+ # Custom attribute writer method with validation
110
+ # @param [Object] rc Value to be assigned
111
+ def rc=(rc)
112
+ if rc.nil?
113
+ fail ArgumentError, 'rc cannot be nil'
114
+ end
115
+
116
+ @rc = rc
117
+ end
118
+
119
+ # Custom attribute writer method with validation
120
+ # @param [Object] key Value to be assigned
121
+ def key=(key)
122
+ if key.nil?
123
+ fail ArgumentError, 'key cannot be nil'
124
+ end
125
+
126
+ @key = key
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ rc == o.rc &&
135
+ key == o.key
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [rc, key].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ transformed_hash = {}
157
+ openapi_types.each_pair do |key, type|
158
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = nil
160
+ elsif type =~ /\AArray<(.*)>/i
161
+ # check to ensure the input is an array given that the attribute
162
+ # is documented as an array but the input is not
163
+ if attributes[attribute_map[key]].is_a?(Array)
164
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
165
+ end
166
+ elsif !attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
168
+ end
169
+ end
170
+ new(transformed_hash)
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ end
190
+
191
+ end
@@ -0,0 +1,182 @@
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.15
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 AccountUser < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :fullname
21
+
22
+ attr_accessor :email
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'fullname' => :'fullname',
29
+ :'email' => :'email'
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
+ :'id' => :'String',
47
+ :'fullname' => :'String',
48
+ :'email' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::AccountUser` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ acceptable_attribute_map = self.class.acceptable_attribute_map
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!acceptable_attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::AccountUser`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
73
+
74
+ if attributes.key?(:'id')
75
+ self.id = attributes[:'id']
76
+ else
77
+ self.id = nil
78
+ end
79
+
80
+ if attributes.key?(:'fullname')
81
+ self.fullname = attributes[:'fullname']
82
+ end
83
+
84
+ if attributes.key?(:'email')
85
+ self.email = attributes[:'email']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
93
+ invalid_properties = Array.new
94
+ if @id.nil?
95
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @id.nil?
106
+ true
107
+ end
108
+
109
+ # Custom attribute writer method with validation
110
+ # @param [Object] id Value to be assigned
111
+ def id=(id)
112
+ if id.nil?
113
+ fail ArgumentError, 'id cannot be nil'
114
+ end
115
+
116
+ @id = id
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ id == o.id &&
125
+ fullname == o.fullname &&
126
+ email == o.email
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [id, fullname, email].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+ attributes = attributes.transform_keys(&:to_sym)
147
+ transformed_hash = {}
148
+ openapi_types.each_pair do |key, type|
149
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
150
+ transformed_hash["#{key}"] = nil
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[attribute_map[key]].is_a?(Array)
155
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
156
+ end
157
+ elsif !attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
159
+ end
160
+ end
161
+ new(transformed_hash)
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ if value.nil?
171
+ is_nullable = self.class.openapi_nullable.include?(attr)
172
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
173
+ end
174
+
175
+ hash[param] = _to_hash(value)
176
+ end
177
+ hash
178
+ end
179
+
180
+ end
181
+
182
+ end
@@ -0,0 +1,307 @@
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.15
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
+ # Key METADATA. Never the key itself.
18
+ class ApikeyDetail < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :name
22
+
23
+ # The leading, non-secret part, so a key is recognisable without storing it.
24
+ attr_accessor :key_prefix
25
+
26
+ attr_accessor :created
27
+
28
+ attr_accessor :expires
29
+
30
+ attr_accessor :last_used_at
31
+
32
+ attr_accessor :revoked_at
33
+
34
+ # Source-IP allowlist. EMPTY MEANS UNRESTRICTED, not deny-all.
35
+ attr_accessor :allowed_cidrs
36
+
37
+ attr_accessor :allowed_scopes
38
+
39
+ # Whether this key's secret can still be read back. False permanently for a key issued before secrets were stored recoverably.
40
+ attr_accessor :retrievable
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'id' => :'id',
46
+ :'name' => :'name',
47
+ :'key_prefix' => :'key_prefix',
48
+ :'created' => :'created',
49
+ :'expires' => :'expires',
50
+ :'last_used_at' => :'last_used_at',
51
+ :'revoked_at' => :'revoked_at',
52
+ :'allowed_cidrs' => :'allowed_cidrs',
53
+ :'allowed_scopes' => :'allowed_scopes',
54
+ :'retrievable' => :'retrievable'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'id' => :'String',
72
+ :'name' => :'String',
73
+ :'key_prefix' => :'String',
74
+ :'created' => :'Time',
75
+ :'expires' => :'Time',
76
+ :'last_used_at' => :'Time',
77
+ :'revoked_at' => :'Time',
78
+ :'allowed_cidrs' => :'Array<String>',
79
+ :'allowed_scopes' => :'Array<String>',
80
+ :'retrievable' => :'Boolean'
81
+ }
82
+ end
83
+
84
+ # List of attributes with nullable: true
85
+ def self.openapi_nullable
86
+ Set.new([
87
+ :'expires',
88
+ :'last_used_at',
89
+ :'revoked_at',
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `VPNDetection::ApikeyDetail` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ acceptable_attribute_map = self.class.acceptable_attribute_map
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!acceptable_attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `VPNDetection::ApikeyDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'id')
110
+ self.id = attributes[:'id']
111
+ else
112
+ self.id = nil
113
+ end
114
+
115
+ if attributes.key?(:'name')
116
+ self.name = attributes[:'name']
117
+ else
118
+ self.name = nil
119
+ end
120
+
121
+ if attributes.key?(:'key_prefix')
122
+ self.key_prefix = attributes[:'key_prefix']
123
+ else
124
+ self.key_prefix = nil
125
+ end
126
+
127
+ if attributes.key?(:'created')
128
+ self.created = attributes[:'created']
129
+ else
130
+ self.created = nil
131
+ end
132
+
133
+ if attributes.key?(:'expires')
134
+ self.expires = attributes[:'expires']
135
+ end
136
+
137
+ if attributes.key?(:'last_used_at')
138
+ self.last_used_at = attributes[:'last_used_at']
139
+ end
140
+
141
+ if attributes.key?(:'revoked_at')
142
+ self.revoked_at = attributes[:'revoked_at']
143
+ end
144
+
145
+ if attributes.key?(:'allowed_cidrs')
146
+ if (value = attributes[:'allowed_cidrs']).is_a?(Array)
147
+ self.allowed_cidrs = value
148
+ end
149
+ end
150
+
151
+ if attributes.key?(:'allowed_scopes')
152
+ if (value = attributes[:'allowed_scopes']).is_a?(Array)
153
+ self.allowed_scopes = value
154
+ end
155
+ end
156
+
157
+ if attributes.key?(:'retrievable')
158
+ self.retrievable = attributes[:'retrievable']
159
+ end
160
+ end
161
+
162
+ # Show invalid properties with the reasons. Usually used together with valid?
163
+ # @return Array for valid properties with the reasons
164
+ def list_invalid_properties
165
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
166
+ invalid_properties = Array.new
167
+ if @id.nil?
168
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
169
+ end
170
+
171
+ if @name.nil?
172
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
173
+ end
174
+
175
+ if @key_prefix.nil?
176
+ invalid_properties.push('invalid value for "key_prefix", key_prefix cannot be nil.')
177
+ end
178
+
179
+ if @created.nil?
180
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
181
+ end
182
+
183
+ invalid_properties
184
+ end
185
+
186
+ # Check to see if the all the properties in the model are valid
187
+ # @return true if the model is valid
188
+ def valid?
189
+ warn '[DEPRECATED] the `valid?` method is obsolete'
190
+ return false if @id.nil?
191
+ return false if @name.nil?
192
+ return false if @key_prefix.nil?
193
+ return false if @created.nil?
194
+ true
195
+ end
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] id Value to be assigned
199
+ def id=(id)
200
+ if id.nil?
201
+ fail ArgumentError, 'id cannot be nil'
202
+ end
203
+
204
+ @id = id
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] name Value to be assigned
209
+ def name=(name)
210
+ if name.nil?
211
+ fail ArgumentError, 'name cannot be nil'
212
+ end
213
+
214
+ @name = name
215
+ end
216
+
217
+ # Custom attribute writer method with validation
218
+ # @param [Object] key_prefix Value to be assigned
219
+ def key_prefix=(key_prefix)
220
+ if key_prefix.nil?
221
+ fail ArgumentError, 'key_prefix cannot be nil'
222
+ end
223
+
224
+ @key_prefix = key_prefix
225
+ end
226
+
227
+ # Custom attribute writer method with validation
228
+ # @param [Object] created Value to be assigned
229
+ def created=(created)
230
+ if created.nil?
231
+ fail ArgumentError, 'created cannot be nil'
232
+ end
233
+
234
+ @created = created
235
+ end
236
+
237
+ # Checks equality by comparing each attribute.
238
+ # @param [Object] Object to be compared
239
+ def ==(o)
240
+ return true if self.equal?(o)
241
+ self.class == o.class &&
242
+ id == o.id &&
243
+ name == o.name &&
244
+ key_prefix == o.key_prefix &&
245
+ created == o.created &&
246
+ expires == o.expires &&
247
+ last_used_at == o.last_used_at &&
248
+ revoked_at == o.revoked_at &&
249
+ allowed_cidrs == o.allowed_cidrs &&
250
+ allowed_scopes == o.allowed_scopes &&
251
+ retrievable == o.retrievable
252
+ end
253
+
254
+ # @see the `==` method
255
+ # @param [Object] Object to be compared
256
+ def eql?(o)
257
+ self == o
258
+ end
259
+
260
+ # Calculates hash code according to all attributes.
261
+ # @return [Integer] Hash code
262
+ def hash
263
+ [id, name, key_prefix, created, expires, last_used_at, revoked_at, allowed_cidrs, allowed_scopes, retrievable].hash
264
+ end
265
+
266
+ # Builds the object from hash
267
+ # @param [Hash] attributes Model attributes in the form of hash
268
+ # @return [Object] Returns the model itself
269
+ def self.build_from_hash(attributes)
270
+ return nil unless attributes.is_a?(Hash)
271
+ attributes = attributes.transform_keys(&:to_sym)
272
+ transformed_hash = {}
273
+ openapi_types.each_pair do |key, type|
274
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
275
+ transformed_hash["#{key}"] = nil
276
+ elsif type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[attribute_map[key]].is_a?(Array)
280
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
281
+ end
282
+ elsif !attributes[attribute_map[key]].nil?
283
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
284
+ end
285
+ end
286
+ new(transformed_hash)
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ end
306
+
307
+ end