akeyless 2.16.5 → 2.16.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -1
  3. data/docs/CreateTokenizer.md +42 -0
  4. data/docs/CreateTokenizerOutput.md +18 -0
  5. data/docs/Detokenize.md +26 -0
  6. data/docs/DetokenizeOutput.md +18 -0
  7. data/docs/DynamicSecretProducerInfo.md +2 -0
  8. data/docs/EmailTokenizerInfo.md +22 -0
  9. data/docs/ItemGeneralInfo.md +5 -1
  10. data/docs/ListTargets.md +2 -0
  11. data/docs/LogForwardingConfigPart.md +0 -2
  12. data/docs/Producer.md +2 -0
  13. data/docs/RegexpTokenizerInfo.md +24 -0
  14. data/docs/RotateSecret.md +22 -0
  15. data/docs/RotatedSecretOutput.md +18 -0
  16. data/docs/SystemAccessCredentialsReplyObj.md +2 -0
  17. data/docs/Tokenize.md +26 -0
  18. data/docs/TokenizeOutput.md +20 -0
  19. data/docs/TokenizerInfo.md +18 -0
  20. data/docs/UpdateTokenizer.md +46 -0
  21. data/docs/UpdateTokenizerOutput.md +18 -0
  22. data/docs/V2Api.md +315 -0
  23. data/docs/VaultlessTokenizerInfo.md +28 -0
  24. data/lib/akeyless/api/v2_api.rb +320 -0
  25. data/lib/akeyless/models/create_tokenizer.rb +358 -0
  26. data/lib/akeyless/models/create_tokenizer_output.rb +219 -0
  27. data/lib/akeyless/models/detokenize.rb +271 -0
  28. data/lib/akeyless/models/detokenize_output.rb +219 -0
  29. data/lib/akeyless/models/dynamic_secret_producer_info.rb +10 -1
  30. data/lib/akeyless/models/email_tokenizer_info.rb +241 -0
  31. data/lib/akeyless/models/item_general_info.rb +22 -4
  32. data/lib/akeyless/models/list_targets.rb +13 -1
  33. data/lib/akeyless/models/log_forwarding_config_part.rb +1 -10
  34. data/lib/akeyless/models/producer.rb +10 -1
  35. data/lib/akeyless/models/regexp_tokenizer_info.rb +251 -0
  36. data/lib/akeyless/models/rotate_secret.rb +245 -0
  37. data/lib/akeyless/models/rotated_secret_output.rb +219 -0
  38. data/lib/akeyless/models/system_access_credentials_reply_obj.rb +11 -1
  39. data/lib/akeyless/models/tokenize.rb +271 -0
  40. data/lib/akeyless/models/tokenize_output.rb +228 -0
  41. data/lib/akeyless/models/tokenizer_info.rb +219 -0
  42. data/lib/akeyless/models/update_tokenizer.rb +382 -0
  43. data/lib/akeyless/models/update_tokenizer_output.rb +219 -0
  44. data/lib/akeyless/models/vaultless_tokenizer_info.rb +267 -0
  45. data/lib/akeyless/version.rb +1 -1
  46. data/lib/akeyless.rb +14 -0
  47. data/spec/models/create_tokenizer_output_spec.rb +34 -0
  48. data/spec/models/create_tokenizer_spec.rb +106 -0
  49. data/spec/models/detokenize_output_spec.rb +34 -0
  50. data/spec/models/detokenize_spec.rb +58 -0
  51. data/spec/models/email_tokenizer_info_spec.rb +46 -0
  52. data/spec/models/regexp_tokenizer_info_spec.rb +52 -0
  53. data/spec/models/rotate_secret_spec.rb +46 -0
  54. data/spec/models/rotated_secret_output_spec.rb +34 -0
  55. data/spec/models/tokenize_output_spec.rb +40 -0
  56. data/spec/models/tokenize_spec.rb +58 -0
  57. data/spec/models/tokenizer_info_spec.rb +34 -0
  58. data/spec/models/update_tokenizer_output_spec.rb +34 -0
  59. data/spec/models/update_tokenizer_spec.rb +118 -0
  60. data/spec/models/vaultless_tokenizer_info_spec.rb +64 -0
  61. metadata +533 -477
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ class TokenizerInfo
18
+ attr_accessor :vaultless_tokenizer_info
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'vaultless_tokenizer_info' => :'vaultless_tokenizer_info'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'vaultless_tokenizer_info' => :'VaultlessTokenizerInfo'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::TokenizerInfo` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::TokenizerInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'vaultless_tokenizer_info')
61
+ self.vaultless_tokenizer_info = attributes[:'vaultless_tokenizer_info']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ vaultless_tokenizer_info == o.vaultless_tokenizer_info
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [vaultless_tokenizer_info].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = Akeyless.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,382 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ # updateTokenizer is a command that updates a tokenizer item
18
+ class UpdateTokenizer
19
+ # List of the new tags that will be attached to this item
20
+ attr_accessor :add_tag
21
+
22
+ # Alphabet to use in regexp vaultless tokenization
23
+ attr_accessor :alphabet
24
+
25
+ # The Decryption output template to use in regexp vaultless tokenization
26
+ attr_accessor :decryption_template
27
+
28
+ # AES key name to use in vaultless tokenization
29
+ attr_accessor :encryption_key_name
30
+
31
+ # The Encryption output template to use in regexp vaultless tokenization
32
+ attr_accessor :encryption_template
33
+
34
+ # Current item name
35
+ attr_accessor :name
36
+
37
+ # New item metadata
38
+ attr_accessor :new_metadata
39
+
40
+ # New item name
41
+ attr_accessor :new_name
42
+
43
+ # Pattern to use in regexp vaultless tokenization
44
+ attr_accessor :pattern
45
+
46
+ # List of the existent tags that will be removed from this item
47
+ attr_accessor :rm_tag
48
+
49
+ # Which template type this tokenizer is used for [SSN,CreditCard,USPhoneNumber,Email,Regexp]
50
+ attr_accessor :template_type
51
+
52
+ # Authentication token (see `/auth` and `/configure`)
53
+ attr_accessor :token
54
+
55
+ # Tokenizer type
56
+ attr_accessor :tokenizer_type
57
+
58
+ # The tweak type to use in vaultless tokenization [Supplied, Generated, Internal, Masking]
59
+ attr_accessor :tweak_type
60
+
61
+ # The universal identity token, Required only for universal_identity authentication
62
+ attr_accessor :uid_token
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'add_tag' => :'add-tag',
68
+ :'alphabet' => :'alphabet',
69
+ :'decryption_template' => :'decryption-template',
70
+ :'encryption_key_name' => :'encryption-key-name',
71
+ :'encryption_template' => :'encryption-template',
72
+ :'name' => :'name',
73
+ :'new_metadata' => :'new-metadata',
74
+ :'new_name' => :'new-name',
75
+ :'pattern' => :'pattern',
76
+ :'rm_tag' => :'rm-tag',
77
+ :'template_type' => :'template-type',
78
+ :'token' => :'token',
79
+ :'tokenizer_type' => :'tokenizer-type',
80
+ :'tweak_type' => :'tweak-type',
81
+ :'uid_token' => :'uid-token'
82
+ }
83
+ end
84
+
85
+ # Returns all the JSON keys this model knows about
86
+ def self.acceptable_attributes
87
+ attribute_map.values
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :'add_tag' => :'Array<String>',
94
+ :'alphabet' => :'String',
95
+ :'decryption_template' => :'String',
96
+ :'encryption_key_name' => :'String',
97
+ :'encryption_template' => :'String',
98
+ :'name' => :'String',
99
+ :'new_metadata' => :'String',
100
+ :'new_name' => :'String',
101
+ :'pattern' => :'String',
102
+ :'rm_tag' => :'Array<String>',
103
+ :'template_type' => :'String',
104
+ :'token' => :'String',
105
+ :'tokenizer_type' => :'String',
106
+ :'tweak_type' => :'String',
107
+ :'uid_token' => :'String'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::UpdateTokenizer` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!self.class.attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::UpdateTokenizer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'add_tag')
133
+ if (value = attributes[:'add_tag']).is_a?(Array)
134
+ self.add_tag = value
135
+ end
136
+ end
137
+
138
+ if attributes.key?(:'alphabet')
139
+ self.alphabet = attributes[:'alphabet']
140
+ end
141
+
142
+ if attributes.key?(:'decryption_template')
143
+ self.decryption_template = attributes[:'decryption_template']
144
+ end
145
+
146
+ if attributes.key?(:'encryption_key_name')
147
+ self.encryption_key_name = attributes[:'encryption_key_name']
148
+ end
149
+
150
+ if attributes.key?(:'encryption_template')
151
+ self.encryption_template = attributes[:'encryption_template']
152
+ end
153
+
154
+ if attributes.key?(:'name')
155
+ self.name = attributes[:'name']
156
+ end
157
+
158
+ if attributes.key?(:'new_metadata')
159
+ self.new_metadata = attributes[:'new_metadata']
160
+ else
161
+ self.new_metadata = 'default_metadata'
162
+ end
163
+
164
+ if attributes.key?(:'new_name')
165
+ self.new_name = attributes[:'new_name']
166
+ end
167
+
168
+ if attributes.key?(:'pattern')
169
+ self.pattern = attributes[:'pattern']
170
+ end
171
+
172
+ if attributes.key?(:'rm_tag')
173
+ if (value = attributes[:'rm_tag']).is_a?(Array)
174
+ self.rm_tag = value
175
+ end
176
+ end
177
+
178
+ if attributes.key?(:'template_type')
179
+ self.template_type = attributes[:'template_type']
180
+ end
181
+
182
+ if attributes.key?(:'token')
183
+ self.token = attributes[:'token']
184
+ end
185
+
186
+ if attributes.key?(:'tokenizer_type')
187
+ self.tokenizer_type = attributes[:'tokenizer_type']
188
+ end
189
+
190
+ if attributes.key?(:'tweak_type')
191
+ self.tweak_type = attributes[:'tweak_type']
192
+ end
193
+
194
+ if attributes.key?(:'uid_token')
195
+ self.uid_token = attributes[:'uid_token']
196
+ end
197
+ end
198
+
199
+ # Show invalid properties with the reasons. Usually used together with valid?
200
+ # @return Array for valid properties with the reasons
201
+ def list_invalid_properties
202
+ invalid_properties = Array.new
203
+ if @name.nil?
204
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
205
+ end
206
+
207
+ if @template_type.nil?
208
+ invalid_properties.push('invalid value for "template_type", template_type cannot be nil.')
209
+ end
210
+
211
+ if @tokenizer_type.nil?
212
+ invalid_properties.push('invalid value for "tokenizer_type", tokenizer_type cannot be nil.')
213
+ end
214
+
215
+ invalid_properties
216
+ end
217
+
218
+ # Check to see if the all the properties in the model are valid
219
+ # @return true if the model is valid
220
+ def valid?
221
+ return false if @name.nil?
222
+ return false if @template_type.nil?
223
+ return false if @tokenizer_type.nil?
224
+ true
225
+ end
226
+
227
+ # Checks equality by comparing each attribute.
228
+ # @param [Object] Object to be compared
229
+ def ==(o)
230
+ return true if self.equal?(o)
231
+ self.class == o.class &&
232
+ add_tag == o.add_tag &&
233
+ alphabet == o.alphabet &&
234
+ decryption_template == o.decryption_template &&
235
+ encryption_key_name == o.encryption_key_name &&
236
+ encryption_template == o.encryption_template &&
237
+ name == o.name &&
238
+ new_metadata == o.new_metadata &&
239
+ new_name == o.new_name &&
240
+ pattern == o.pattern &&
241
+ rm_tag == o.rm_tag &&
242
+ template_type == o.template_type &&
243
+ token == o.token &&
244
+ tokenizer_type == o.tokenizer_type &&
245
+ tweak_type == o.tweak_type &&
246
+ uid_token == o.uid_token
247
+ end
248
+
249
+ # @see the `==` method
250
+ # @param [Object] Object to be compared
251
+ def eql?(o)
252
+ self == o
253
+ end
254
+
255
+ # Calculates hash code according to all attributes.
256
+ # @return [Integer] Hash code
257
+ def hash
258
+ [add_tag, alphabet, decryption_template, encryption_key_name, encryption_template, name, new_metadata, new_name, pattern, rm_tag, template_type, token, tokenizer_type, tweak_type, uid_token].hash
259
+ end
260
+
261
+ # Builds the object from hash
262
+ # @param [Hash] attributes Model attributes in the form of hash
263
+ # @return [Object] Returns the model itself
264
+ def self.build_from_hash(attributes)
265
+ new.build_from_hash(attributes)
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ attributes = attributes.transform_keys(&:to_sym)
274
+ self.class.openapi_types.each_pair do |key, type|
275
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
276
+ self.send("#{key}=", nil)
277
+ elsif type =~ /\AArray<(.*)>/i
278
+ # check to ensure the input is an array given that the attribute
279
+ # is documented as an array but the input is not
280
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
281
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
282
+ end
283
+ elsif !attributes[self.class.attribute_map[key]].nil?
284
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
285
+ end
286
+ end
287
+
288
+ self
289
+ end
290
+
291
+ # Deserializes the data based on type
292
+ # @param string type Data type
293
+ # @param string value Value to be deserialized
294
+ # @return [Object] Deserialized data
295
+ def _deserialize(type, value)
296
+ case type.to_sym
297
+ when :Time
298
+ Time.parse(value)
299
+ when :Date
300
+ Date.parse(value)
301
+ when :String
302
+ value.to_s
303
+ when :Integer
304
+ value.to_i
305
+ when :Float
306
+ value.to_f
307
+ when :Boolean
308
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
309
+ true
310
+ else
311
+ false
312
+ end
313
+ when :Object
314
+ # generic object (usually a Hash), return directly
315
+ value
316
+ when /\AArray<(?<inner_type>.+)>\z/
317
+ inner_type = Regexp.last_match[:inner_type]
318
+ value.map { |v| _deserialize(inner_type, v) }
319
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
320
+ k_type = Regexp.last_match[:k_type]
321
+ v_type = Regexp.last_match[:v_type]
322
+ {}.tap do |hash|
323
+ value.each do |k, v|
324
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
325
+ end
326
+ end
327
+ else # model
328
+ # models (e.g. Pet) or oneOf
329
+ klass = Akeyless.const_get(type)
330
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
331
+ end
332
+ end
333
+
334
+ # Returns the string representation of the object
335
+ # @return [String] String presentation of the object
336
+ def to_s
337
+ to_hash.to_s
338
+ end
339
+
340
+ # to_body is an alias to to_hash (backward compatibility)
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_body
343
+ to_hash
344
+ end
345
+
346
+ # Returns the object in the form of hash
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_hash
349
+ hash = {}
350
+ self.class.attribute_map.each_pair do |attr, param|
351
+ value = self.send(attr)
352
+ if value.nil?
353
+ is_nullable = self.class.openapi_nullable.include?(attr)
354
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
355
+ end
356
+
357
+ hash[param] = _to_hash(value)
358
+ end
359
+ hash
360
+ end
361
+
362
+ # Outputs non-array value in the form of hash
363
+ # For object, use to_hash. Otherwise, just return the value
364
+ # @param [Object] value Any valid value
365
+ # @return [Hash] Returns the value in the form of hash
366
+ def _to_hash(value)
367
+ if value.is_a?(Array)
368
+ value.compact.map { |v| _to_hash(v) }
369
+ elsif value.is_a?(Hash)
370
+ {}.tap do |hash|
371
+ value.each { |k, v| hash[k] = _to_hash(v) }
372
+ end
373
+ elsif value.respond_to? :to_hash
374
+ value.to_hash
375
+ else
376
+ value
377
+ end
378
+ end
379
+
380
+ end
381
+
382
+ end