akeyless 5.0.6 → 5.0.7

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -1
  3. data/docs/AzureLogAnalyticsForwardingConfig.md +2 -0
  4. data/docs/CertificateTemplateInfo.md +2 -0
  5. data/docs/CreateClassicKey.md +3 -1
  6. data/docs/CreateDFCKey.md +3 -1
  7. data/docs/CreateKey.md +3 -1
  8. data/docs/GatewayUpdateLogForwardingAzureAnalytics.md +2 -0
  9. data/docs/GatewayUpdateLogForwardingSplunk.md +2 -0
  10. data/docs/GeminiTargetDetails.md +22 -0
  11. data/docs/GenerateCsr.md +2 -0
  12. data/docs/GwUpdateRemoteAccessSessionLogsAzureAnalytics.md +2 -0
  13. data/docs/GwUpdateRemoteAccessSessionLogsSplunk.md +2 -0
  14. data/docs/OpenAITargetDetails.md +26 -0
  15. data/docs/SplunkLogForwardingConfig.md +2 -0
  16. data/docs/StaticSecretSync.md +2 -0
  17. data/docs/TargetCreateGemini.md +36 -0
  18. data/docs/TargetCreateOpenAI.md +40 -0
  19. data/docs/TargetTypeDetailsInput.md +4 -0
  20. data/docs/TargetUpdateGemini.md +42 -0
  21. data/docs/TargetUpdateOpenAI.md +46 -0
  22. data/docs/V2Api.md +252 -0
  23. data/lib/akeyless/api/v2_api.rb +256 -0
  24. data/lib/akeyless/models/azure_log_analytics_forwarding_config.rb +10 -1
  25. data/lib/akeyless/models/certificate_template_info.rb +10 -1
  26. data/lib/akeyless/models/create_classic_key.rb +14 -2
  27. data/lib/akeyless/models/create_dfc_key.rb +14 -2
  28. data/lib/akeyless/models/create_key.rb +14 -2
  29. data/lib/akeyless/models/gateway_update_log_forwarding_azure_analytics.rb +13 -1
  30. data/lib/akeyless/models/gateway_update_log_forwarding_splunk.rb +13 -1
  31. data/lib/akeyless/models/gemini_target_details.rb +233 -0
  32. data/lib/akeyless/models/generate_csr.rb +13 -1
  33. data/lib/akeyless/models/gw_update_remote_access_session_logs_azure_analytics.rb +13 -1
  34. data/lib/akeyless/models/gw_update_remote_access_session_logs_splunk.rb +13 -1
  35. data/lib/akeyless/models/open_ai_target_details.rb +251 -0
  36. data/lib/akeyless/models/splunk_log_forwarding_config.rb +10 -1
  37. data/lib/akeyless/models/static_secret_sync.rb +11 -1
  38. data/lib/akeyless/models/target_create_gemini.rb +317 -0
  39. data/lib/akeyless/models/target_create_open_ai.rb +337 -0
  40. data/lib/akeyless/models/target_type_details_input.rb +19 -1
  41. data/lib/akeyless/models/target_update_gemini.rb +351 -0
  42. data/lib/akeyless/models/target_update_open_ai.rb +371 -0
  43. data/lib/akeyless/version.rb +1 -1
  44. data/lib/akeyless.rb +6 -0
  45. data/spec/models/gemini_target_details_spec.rb +48 -0
  46. data/spec/models/open_ai_target_details_spec.rb +60 -0
  47. data/spec/models/target_create_gemini_spec.rb +90 -0
  48. data/spec/models/target_create_open_ai_spec.rb +102 -0
  49. data/spec/models/target_update_gemini_spec.rb +108 -0
  50. data/spec/models/target_update_open_ai_spec.rb +120 -0
  51. metadata +25 -1
@@ -0,0 +1,317 @@
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: 3.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ # targetCreateGemini is a command that creates a new gemini target
18
+ class TargetCreateGemini
19
+ # API key for Gemini
20
+ attr_accessor :api_key
21
+
22
+ # Description of the object
23
+ attr_accessor :description
24
+
25
+ # Base URL of the Gemini API
26
+ attr_accessor :gemini_url
27
+
28
+ # Set output format to JSON
29
+ attr_accessor :json
30
+
31
+ # The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
32
+ attr_accessor :key
33
+
34
+ # Set the maximum number of versions, limited by the account settings defaults.
35
+ attr_accessor :max_versions
36
+
37
+ # Default model to use with Gemini
38
+ attr_accessor :model
39
+
40
+ # Target name
41
+ attr_accessor :name
42
+
43
+ # Authentication token (see `/auth` and `/configure`)
44
+ attr_accessor :token
45
+
46
+ # The universal identity token, Required only for universal_identity authentication
47
+ attr_accessor :uid_token
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'api_key' => :'api-key',
53
+ :'description' => :'description',
54
+ :'gemini_url' => :'gemini-url',
55
+ :'json' => :'json',
56
+ :'key' => :'key',
57
+ :'max_versions' => :'max-versions',
58
+ :'model' => :'model',
59
+ :'name' => :'name',
60
+ :'token' => :'token',
61
+ :'uid_token' => :'uid-token'
62
+ }
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'api_key' => :'String',
74
+ :'description' => :'String',
75
+ :'gemini_url' => :'String',
76
+ :'json' => :'Boolean',
77
+ :'key' => :'String',
78
+ :'max_versions' => :'String',
79
+ :'model' => :'String',
80
+ :'name' => :'String',
81
+ :'token' => :'String',
82
+ :'uid_token' => :'String'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ if (!attributes.is_a?(Hash))
96
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::TargetCreateGemini` initialize method"
97
+ end
98
+
99
+ # check to see if the attribute exists and convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!self.class.attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::TargetCreateGemini`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'api_key')
108
+ self.api_key = attributes[:'api_key']
109
+ end
110
+
111
+ if attributes.key?(:'description')
112
+ self.description = attributes[:'description']
113
+ end
114
+
115
+ if attributes.key?(:'gemini_url')
116
+ self.gemini_url = attributes[:'gemini_url']
117
+ else
118
+ self.gemini_url = 'https://generativelanguage.googleapis.com'
119
+ end
120
+
121
+ if attributes.key?(:'json')
122
+ self.json = attributes[:'json']
123
+ else
124
+ self.json = false
125
+ end
126
+
127
+ if attributes.key?(:'key')
128
+ self.key = attributes[:'key']
129
+ end
130
+
131
+ if attributes.key?(:'max_versions')
132
+ self.max_versions = attributes[:'max_versions']
133
+ end
134
+
135
+ if attributes.key?(:'model')
136
+ self.model = attributes[:'model']
137
+ end
138
+
139
+ if attributes.key?(:'name')
140
+ self.name = attributes[:'name']
141
+ else
142
+ self.name = nil
143
+ end
144
+
145
+ if attributes.key?(:'token')
146
+ self.token = attributes[:'token']
147
+ end
148
+
149
+ if attributes.key?(:'uid_token')
150
+ self.uid_token = attributes[:'uid_token']
151
+ end
152
+ end
153
+
154
+ # Show invalid properties with the reasons. Usually used together with valid?
155
+ # @return Array for valid properties with the reasons
156
+ def list_invalid_properties
157
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
158
+ invalid_properties = Array.new
159
+ if @name.nil?
160
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
161
+ end
162
+
163
+ invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ warn '[DEPRECATED] the `valid?` method is obsolete'
170
+ return false if @name.nil?
171
+ true
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ api_key == o.api_key &&
180
+ description == o.description &&
181
+ gemini_url == o.gemini_url &&
182
+ json == o.json &&
183
+ key == o.key &&
184
+ max_versions == o.max_versions &&
185
+ model == o.model &&
186
+ name == o.name &&
187
+ token == o.token &&
188
+ uid_token == o.uid_token
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [api_key, description, gemini_url, json, key, max_versions, model, name, token, uid_token].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ attributes = attributes.transform_keys(&:to_sym)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
213
+ elsif type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
218
+ end
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
221
+ end
222
+ end
223
+ new(transformed_hash)
224
+ end
225
+
226
+ # Deserializes the data based on type
227
+ # @param string type Data type
228
+ # @param string value Value to be deserialized
229
+ # @return [Object] Deserialized data
230
+ def self._deserialize(type, value)
231
+ case type.to_sym
232
+ when :Time
233
+ Time.parse(value)
234
+ when :Date
235
+ Date.parse(value)
236
+ when :String
237
+ value.to_s
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ # models (e.g. Pet) or oneOf
264
+ klass = Akeyless.const_get(type)
265
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+
315
+ end
316
+
317
+ end
@@ -0,0 +1,337 @@
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: 3.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ # targetCreateOpenAI is a command that creates a new openai target
18
+ class TargetCreateOpenAI
19
+ # API key for OpenAI
20
+ attr_accessor :api_key
21
+
22
+ # API key ID
23
+ attr_accessor :api_key_id
24
+
25
+ # Description of the object
26
+ attr_accessor :description
27
+
28
+ # Set output format to JSON
29
+ attr_accessor :json
30
+
31
+ # The name of a key that used to encrypt the target secret value (if empty, the account default protectionKey key will be used)
32
+ attr_accessor :key
33
+
34
+ # Set the maximum number of versions, limited by the account settings defaults.
35
+ attr_accessor :max_versions
36
+
37
+ # Default model to use with OpenAI
38
+ attr_accessor :model
39
+
40
+ # Target name
41
+ attr_accessor :name
42
+
43
+ # Base URL of the OpenAI API
44
+ attr_accessor :openai_url
45
+
46
+ # Organization ID
47
+ attr_accessor :organization_id
48
+
49
+ # Authentication token (see `/auth` and `/configure`)
50
+ attr_accessor :token
51
+
52
+ # The universal identity token, Required only for universal_identity authentication
53
+ attr_accessor :uid_token
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'api_key' => :'api-key',
59
+ :'api_key_id' => :'api-key-id',
60
+ :'description' => :'description',
61
+ :'json' => :'json',
62
+ :'key' => :'key',
63
+ :'max_versions' => :'max-versions',
64
+ :'model' => :'model',
65
+ :'name' => :'name',
66
+ :'openai_url' => :'openai-url',
67
+ :'organization_id' => :'organization-id',
68
+ :'token' => :'token',
69
+ :'uid_token' => :'uid-token'
70
+ }
71
+ end
72
+
73
+ # Returns all the JSON keys this model knows about
74
+ def self.acceptable_attributes
75
+ attribute_map.values
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.openapi_types
80
+ {
81
+ :'api_key' => :'String',
82
+ :'api_key_id' => :'String',
83
+ :'description' => :'String',
84
+ :'json' => :'Boolean',
85
+ :'key' => :'String',
86
+ :'max_versions' => :'String',
87
+ :'model' => :'String',
88
+ :'name' => :'String',
89
+ :'openai_url' => :'String',
90
+ :'organization_id' => :'String',
91
+ :'token' => :'String',
92
+ :'uid_token' => :'String'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::TargetCreateOpenAI` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!self.class.attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::TargetCreateOpenAI`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'api_key')
118
+ self.api_key = attributes[:'api_key']
119
+ end
120
+
121
+ if attributes.key?(:'api_key_id')
122
+ self.api_key_id = attributes[:'api_key_id']
123
+ end
124
+
125
+ if attributes.key?(:'description')
126
+ self.description = attributes[:'description']
127
+ end
128
+
129
+ if attributes.key?(:'json')
130
+ self.json = attributes[:'json']
131
+ else
132
+ self.json = false
133
+ end
134
+
135
+ if attributes.key?(:'key')
136
+ self.key = attributes[:'key']
137
+ end
138
+
139
+ if attributes.key?(:'max_versions')
140
+ self.max_versions = attributes[:'max_versions']
141
+ end
142
+
143
+ if attributes.key?(:'model')
144
+ self.model = attributes[:'model']
145
+ end
146
+
147
+ if attributes.key?(:'name')
148
+ self.name = attributes[:'name']
149
+ else
150
+ self.name = nil
151
+ end
152
+
153
+ if attributes.key?(:'openai_url')
154
+ self.openai_url = attributes[:'openai_url']
155
+ else
156
+ self.openai_url = 'https://api.openai.com/v1'
157
+ end
158
+
159
+ if attributes.key?(:'organization_id')
160
+ self.organization_id = attributes[:'organization_id']
161
+ end
162
+
163
+ if attributes.key?(:'token')
164
+ self.token = attributes[:'token']
165
+ end
166
+
167
+ if attributes.key?(:'uid_token')
168
+ self.uid_token = attributes[:'uid_token']
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
176
+ invalid_properties = Array.new
177
+ if @name.nil?
178
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
179
+ end
180
+
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ warn '[DEPRECATED] the `valid?` method is obsolete'
188
+ return false if @name.nil?
189
+ true
190
+ end
191
+
192
+ # Checks equality by comparing each attribute.
193
+ # @param [Object] Object to be compared
194
+ def ==(o)
195
+ return true if self.equal?(o)
196
+ self.class == o.class &&
197
+ api_key == o.api_key &&
198
+ api_key_id == o.api_key_id &&
199
+ description == o.description &&
200
+ json == o.json &&
201
+ key == o.key &&
202
+ max_versions == o.max_versions &&
203
+ model == o.model &&
204
+ name == o.name &&
205
+ openai_url == o.openai_url &&
206
+ organization_id == o.organization_id &&
207
+ token == o.token &&
208
+ uid_token == o.uid_token
209
+ end
210
+
211
+ # @see the `==` method
212
+ # @param [Object] Object to be compared
213
+ def eql?(o)
214
+ self == o
215
+ end
216
+
217
+ # Calculates hash code according to all attributes.
218
+ # @return [Integer] Hash code
219
+ def hash
220
+ [api_key, api_key_id, description, json, key, max_versions, model, name, openai_url, organization_id, token, uid_token].hash
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def self.build_from_hash(attributes)
227
+ return nil unless attributes.is_a?(Hash)
228
+ attributes = attributes.transform_keys(&:to_sym)
229
+ transformed_hash = {}
230
+ openapi_types.each_pair do |key, type|
231
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
232
+ transformed_hash["#{key}"] = nil
233
+ elsif type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[attribute_map[key]].is_a?(Array)
237
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
238
+ end
239
+ elsif !attributes[attribute_map[key]].nil?
240
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
241
+ end
242
+ end
243
+ new(transformed_hash)
244
+ end
245
+
246
+ # Deserializes the data based on type
247
+ # @param string type Data type
248
+ # @param string value Value to be deserialized
249
+ # @return [Object] Deserialized data
250
+ def self._deserialize(type, value)
251
+ case type.to_sym
252
+ when :Time
253
+ Time.parse(value)
254
+ when :Date
255
+ Date.parse(value)
256
+ when :String
257
+ value.to_s
258
+ when :Integer
259
+ value.to_i
260
+ when :Float
261
+ value.to_f
262
+ when :Boolean
263
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
264
+ true
265
+ else
266
+ false
267
+ end
268
+ when :Object
269
+ # generic object (usually a Hash), return directly
270
+ value
271
+ when /\AArray<(?<inner_type>.+)>\z/
272
+ inner_type = Regexp.last_match[:inner_type]
273
+ value.map { |v| _deserialize(inner_type, v) }
274
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
275
+ k_type = Regexp.last_match[:k_type]
276
+ v_type = Regexp.last_match[:v_type]
277
+ {}.tap do |hash|
278
+ value.each do |k, v|
279
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
280
+ end
281
+ end
282
+ else # model
283
+ # models (e.g. Pet) or oneOf
284
+ klass = Akeyless.const_get(type)
285
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
286
+ end
287
+ end
288
+
289
+ # Returns the string representation of the object
290
+ # @return [String] String presentation of the object
291
+ def to_s
292
+ to_hash.to_s
293
+ end
294
+
295
+ # to_body is an alias to to_hash (backward compatibility)
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_body
298
+ to_hash
299
+ end
300
+
301
+ # Returns the object in the form of hash
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_hash
304
+ hash = {}
305
+ self.class.attribute_map.each_pair do |attr, param|
306
+ value = self.send(attr)
307
+ if value.nil?
308
+ is_nullable = self.class.openapi_nullable.include?(attr)
309
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
310
+ end
311
+
312
+ hash[param] = _to_hash(value)
313
+ end
314
+ hash
315
+ end
316
+
317
+ # Outputs non-array value in the form of hash
318
+ # For object, use to_hash. Otherwise, just return the value
319
+ # @param [Object] value Any valid value
320
+ # @return [Hash] Returns the value in the form of hash
321
+ def _to_hash(value)
322
+ if value.is_a?(Array)
323
+ value.compact.map { |v| _to_hash(v) }
324
+ elsif value.is_a?(Hash)
325
+ {}.tap do |hash|
326
+ value.each { |k, v| hash[k] = _to_hash(v) }
327
+ end
328
+ elsif value.respond_to? :to_hash
329
+ value.to_hash
330
+ else
331
+ value
332
+ end
333
+ end
334
+
335
+ end
336
+
337
+ end