autosde_openapi_client 1.0.44 → 1.0.48

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 +58 -46
  3. data/docs/AbstractCapabilityApi.md +4 -4
  4. data/docs/AccountApi.md +2 -2
  5. data/docs/AddressApi.md +2 -2
  6. data/docs/AutoSDEProjectApi.md +4 -4
  7. data/docs/AutoSDERoleApi.md +4 -4
  8. data/docs/CapabilityTranslationApi.md +2 -2
  9. data/docs/HostApi.md +2 -2
  10. data/docs/HostCluster.md +32 -0
  11. data/docs/HostClusterApi.md +276 -0
  12. data/docs/HostClusterCreate.md +28 -0
  13. data/docs/HostClusterMembership.md +24 -0
  14. data/docs/HostClusterMembershipApi.md +276 -0
  15. data/docs/HostVolumeConnectionApi.md +2 -2
  16. data/docs/NativeCapabilityApi.md +2 -2
  17. data/docs/ProfileApi.md +4 -4
  18. data/docs/ProvisioningStrategyApi.md +2 -2
  19. data/docs/ServiceApi.md +2 -2
  20. data/docs/ServiceResourceAttachmentApi.md +2 -2
  21. data/docs/SnapshotApi.md +2 -2
  22. data/docs/StorageResourceApi.md +2 -2
  23. data/docs/StorageSystemApi.md +8 -8
  24. data/docs/StorageSystemUpdate.md +24 -0
  25. data/docs/SystemTypeApi.md +2 -2
  26. data/docs/VolumeApi.md +2 -2
  27. data/docs/VolumeSafeDeleteApi.md +2 -2
  28. data/lib/autosde_openapi_client/api/abstract_capability_api.rb +4 -4
  29. data/lib/autosde_openapi_client/api/account_api.rb +2 -2
  30. data/lib/autosde_openapi_client/api/address_api.rb +2 -2
  31. data/lib/autosde_openapi_client/api/auto_sde_project_api.rb +4 -4
  32. data/lib/autosde_openapi_client/api/auto_sde_role_api.rb +4 -4
  33. data/lib/autosde_openapi_client/api/capability_translation_api.rb +2 -2
  34. data/lib/autosde_openapi_client/api/host_api.rb +2 -2
  35. data/lib/autosde_openapi_client/api/host_cluster_api.rb +254 -0
  36. data/lib/autosde_openapi_client/api/host_cluster_membership_api.rb +254 -0
  37. data/lib/autosde_openapi_client/api/host_volume_connection_api.rb +2 -2
  38. data/lib/autosde_openapi_client/api/native_capability_api.rb +2 -2
  39. data/lib/autosde_openapi_client/api/profile_api.rb +4 -4
  40. data/lib/autosde_openapi_client/api/provisioning_strategy_api.rb +2 -2
  41. data/lib/autosde_openapi_client/api/service_api.rb +2 -2
  42. data/lib/autosde_openapi_client/api/service_resource_attachment_api.rb +2 -2
  43. data/lib/autosde_openapi_client/api/snapshot_api.rb +2 -2
  44. data/lib/autosde_openapi_client/api/storage_resource_api.rb +2 -2
  45. data/lib/autosde_openapi_client/api/storage_system_api.rb +11 -11
  46. data/lib/autosde_openapi_client/api/system_type_api.rb +2 -2
  47. data/lib/autosde_openapi_client/api/volume_api.rb +2 -2
  48. data/lib/autosde_openapi_client/api/volume_safe_delete_api.rb +2 -2
  49. data/lib/autosde_openapi_client/models/abstract_capability.rb +1 -1
  50. data/lib/autosde_openapi_client/models/host_cluster.rb +388 -0
  51. data/lib/autosde_openapi_client/models/host_cluster_create.rb +329 -0
  52. data/lib/autosde_openapi_client/models/host_cluster_membership.rb +287 -0
  53. data/lib/autosde_openapi_client/models/storage_system_update.rb +265 -0
  54. data/lib/autosde_openapi_client/version.rb +2 -2
  55. data/lib/autosde_openapi_client.rb +6 -0
  56. data/spec/api/host_cluster_api_spec.rb +74 -0
  57. data/spec/api/host_cluster_membership_api_spec.rb +74 -0
  58. data/spec/api/storage_system_api_spec.rb +1 -1
  59. data/spec/models/host_cluster_create_spec.rb +64 -0
  60. data/spec/models/host_cluster_membership_spec.rb +56 -0
  61. data/spec/models/host_cluster_spec.rb +80 -0
  62. data/spec/models/storage_system_update_spec.rb +52 -0
  63. metadata +81 -57
@@ -0,0 +1,329 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AutosdeOpenapiClient
17
+ # TODO add description
18
+ class HostClusterCreate
19
+ # name
20
+ attr_accessor :name
21
+
22
+ # owner_id
23
+ attr_accessor :owner_id
24
+
25
+ # owner_name
26
+ attr_accessor :owner_name
27
+
28
+ # protocol
29
+ attr_accessor :protocol
30
+
31
+ # status
32
+ attr_accessor :status
33
+
34
+ attr_accessor :storage_system
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'name' => :'name',
40
+ :'owner_id' => :'owner_id',
41
+ :'owner_name' => :'owner_name',
42
+ :'protocol' => :'protocol',
43
+ :'status' => :'status',
44
+ :'storage_system' => :'storage_system'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'name' => :'String',
57
+ :'owner_id' => :'String',
58
+ :'owner_name' => :'String',
59
+ :'protocol' => :'String',
60
+ :'status' => :'String',
61
+ :'storage_system' => :'StorageSystem'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::HostClusterCreate` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::HostClusterCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'name')
87
+ self.name = attributes[:'name']
88
+ end
89
+
90
+ if attributes.key?(:'owner_id')
91
+ self.owner_id = attributes[:'owner_id']
92
+ end
93
+
94
+ if attributes.key?(:'owner_name')
95
+ self.owner_name = attributes[:'owner_name']
96
+ end
97
+
98
+ if attributes.key?(:'protocol')
99
+ self.protocol = attributes[:'protocol']
100
+ end
101
+
102
+ if attributes.key?(:'status')
103
+ self.status = attributes[:'status']
104
+ end
105
+
106
+ if attributes.key?(:'storage_system')
107
+ self.storage_system = attributes[:'storage_system']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ if !@name.nil? && @name.to_s.length > 15
116
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
117
+ end
118
+
119
+ if !@owner_id.nil? && @owner_id.to_s.length > 15
120
+ invalid_properties.push('invalid value for "owner_id", the character length must be smaller than or equal to 15.')
121
+ end
122
+
123
+ if !@owner_name.nil? && @owner_name.to_s.length > 15
124
+ invalid_properties.push('invalid value for "owner_name", the character length must be smaller than or equal to 15.')
125
+ end
126
+
127
+ if !@protocol.nil? && @protocol.to_s.length > 15
128
+ invalid_properties.push('invalid value for "protocol", the character length must be smaller than or equal to 15.')
129
+ end
130
+
131
+ invalid_properties
132
+ end
133
+
134
+ # Check to see if the all the properties in the model are valid
135
+ # @return true if the model is valid
136
+ def valid?
137
+ return false if !@name.nil? && @name.to_s.length > 15
138
+ return false if !@owner_id.nil? && @owner_id.to_s.length > 15
139
+ return false if !@owner_name.nil? && @owner_name.to_s.length > 15
140
+ return false if !@protocol.nil? && @protocol.to_s.length > 15
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] name Value to be assigned
146
+ def name=(name)
147
+ if !name.nil? && name.to_s.length > 15
148
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
149
+ end
150
+
151
+ @name = name
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] owner_id Value to be assigned
156
+ def owner_id=(owner_id)
157
+ if !owner_id.nil? && owner_id.to_s.length > 15
158
+ fail ArgumentError, 'invalid value for "owner_id", the character length must be smaller than or equal to 15.'
159
+ end
160
+
161
+ @owner_id = owner_id
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] owner_name Value to be assigned
166
+ def owner_name=(owner_name)
167
+ if !owner_name.nil? && owner_name.to_s.length > 15
168
+ fail ArgumentError, 'invalid value for "owner_name", the character length must be smaller than or equal to 15.'
169
+ end
170
+
171
+ @owner_name = owner_name
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] protocol Value to be assigned
176
+ def protocol=(protocol)
177
+ if !protocol.nil? && protocol.to_s.length > 15
178
+ fail ArgumentError, 'invalid value for "protocol", the character length must be smaller than or equal to 15.'
179
+ end
180
+
181
+ @protocol = protocol
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ name == o.name &&
190
+ owner_id == o.owner_id &&
191
+ owner_name == o.owner_name &&
192
+ protocol == o.protocol &&
193
+ status == o.status &&
194
+ storage_system == o.storage_system
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [name, owner_id, owner_name, protocol, status, storage_system].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ new.build_from_hash(attributes)
214
+ end
215
+
216
+ # Builds the object from hash
217
+ # @param [Hash] attributes Model attributes in the form of hash
218
+ # @return [Object] Returns the model itself
219
+ def build_from_hash(attributes)
220
+ return nil unless attributes.is_a?(Hash)
221
+ self.class.openapi_types.each_pair do |key, type|
222
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
223
+ self.send("#{key}=", nil)
224
+ elsif type =~ /\AArray<(.*)>/i
225
+ # check to ensure the input is an array given that the attribute
226
+ # is documented as an array but the input is not
227
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
228
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ end
233
+ end
234
+
235
+ self
236
+ end
237
+
238
+ # Deserializes the data based on type
239
+ # @param string type Data type
240
+ # @param string value Value to be deserialized
241
+ # @return [Object] Deserialized data
242
+ def _deserialize(type, value)
243
+ case type.to_sym
244
+ when :Time
245
+ Time.parse(value)
246
+ when :Date
247
+ Date.parse(value)
248
+ when :String
249
+ value.to_s
250
+ when :Integer
251
+ value.to_i
252
+ when :Float
253
+ value.to_f
254
+ when :Boolean
255
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
256
+ true
257
+ else
258
+ false
259
+ end
260
+ when :Object
261
+ # generic object (usually a Hash), return directly
262
+ value
263
+ when /\AArray<(?<inner_type>.+)>\z/
264
+ inner_type = Regexp.last_match[:inner_type]
265
+ value.map { |v| _deserialize(inner_type, v) }
266
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
267
+ k_type = Regexp.last_match[:k_type]
268
+ v_type = Regexp.last_match[:v_type]
269
+ {}.tap do |hash|
270
+ value.each do |k, v|
271
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
272
+ end
273
+ end
274
+ else # model
275
+ # models (e.g. Pet) or oneOf
276
+ klass = AutosdeOpenapiClient.const_get(type)
277
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
278
+ end
279
+ end
280
+
281
+ # Returns the string representation of the object
282
+ # @return [String] String presentation of the object
283
+ def to_s
284
+ to_hash.to_s
285
+ end
286
+
287
+ # to_body is an alias to to_hash (backward compatibility)
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_body
290
+ to_hash
291
+ end
292
+
293
+ # Returns the object in the form of hash
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_hash
296
+ hash = {}
297
+ self.class.attribute_map.each_pair do |attr, param|
298
+ value = self.send(attr)
299
+ if value.nil?
300
+ is_nullable = self.class.openapi_nullable.include?(attr)
301
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
302
+ end
303
+
304
+ hash[param] = _to_hash(value)
305
+ end
306
+ hash
307
+ end
308
+
309
+ # Outputs non-array value in the form of hash
310
+ # For object, use to_hash. Otherwise, just return the value
311
+ # @param [Object] value Any valid value
312
+ # @return [Hash] Returns the value in the form of hash
313
+ def _to_hash(value)
314
+ if value.is_a?(Array)
315
+ value.compact.map { |v| _to_hash(v) }
316
+ elsif value.is_a?(Hash)
317
+ {}.tap do |hash|
318
+ value.each { |k, v| hash[k] = _to_hash(v) }
319
+ end
320
+ elsif value.respond_to? :to_hash
321
+ value.to_hash
322
+ else
323
+ value
324
+ end
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AutosdeOpenapiClient
17
+ # hostClusterMembership
18
+ class HostClusterMembership
19
+ attr_accessor :cluster
20
+
21
+ # component_state
22
+ attr_accessor :component_state
23
+
24
+ attr_accessor :host
25
+
26
+ # uuid
27
+ attr_accessor :uuid
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'cluster' => :'cluster',
55
+ :'component_state' => :'component_state',
56
+ :'host' => :'host',
57
+ :'uuid' => :'uuid'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'cluster' => :'HostCluster',
70
+ :'component_state' => :'String',
71
+ :'host' => :'StorageHost',
72
+ :'uuid' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::HostClusterMembership` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::HostClusterMembership`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'cluster')
98
+ self.cluster = attributes[:'cluster']
99
+ end
100
+
101
+ if attributes.key?(:'component_state')
102
+ self.component_state = attributes[:'component_state']
103
+ end
104
+
105
+ if attributes.key?(:'host')
106
+ self.host = attributes[:'host']
107
+ end
108
+
109
+ if attributes.key?(:'uuid')
110
+ self.uuid = attributes[:'uuid']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ if !@component_state.nil? && @component_state.to_s.length > 32
119
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
129
+ return false unless component_state_validator.valid?(@component_state)
130
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
131
+ true
132
+ end
133
+
134
+ # Custom attribute writer method checking allowed values (enum).
135
+ # @param [Object] component_state Object to be assigned
136
+ def component_state=(component_state)
137
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
138
+ unless validator.valid?(component_state)
139
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
140
+ end
141
+ @component_state = component_state
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ cluster == o.cluster &&
150
+ component_state == o.component_state &&
151
+ host == o.host &&
152
+ uuid == o.uuid
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(o)
158
+ self == o
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Integer] Hash code
163
+ def hash
164
+ [cluster, component_state, host, uuid].hash
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def self.build_from_hash(attributes)
171
+ new.build_from_hash(attributes)
172
+ end
173
+
174
+ # Builds the object from hash
175
+ # @param [Hash] attributes Model attributes in the form of hash
176
+ # @return [Object] Returns the model itself
177
+ def build_from_hash(attributes)
178
+ return nil unless attributes.is_a?(Hash)
179
+ self.class.openapi_types.each_pair do |key, type|
180
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
181
+ self.send("#{key}=", nil)
182
+ elsif type =~ /\AArray<(.*)>/i
183
+ # check to ensure the input is an array given that the attribute
184
+ # is documented as an array but the input is not
185
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
186
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
187
+ end
188
+ elsif !attributes[self.class.attribute_map[key]].nil?
189
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
190
+ end
191
+ end
192
+
193
+ self
194
+ end
195
+
196
+ # Deserializes the data based on type
197
+ # @param string type Data type
198
+ # @param string value Value to be deserialized
199
+ # @return [Object] Deserialized data
200
+ def _deserialize(type, value)
201
+ case type.to_sym
202
+ when :Time
203
+ Time.parse(value)
204
+ when :Date
205
+ Date.parse(value)
206
+ when :String
207
+ value.to_s
208
+ when :Integer
209
+ value.to_i
210
+ when :Float
211
+ value.to_f
212
+ when :Boolean
213
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
214
+ true
215
+ else
216
+ false
217
+ end
218
+ when :Object
219
+ # generic object (usually a Hash), return directly
220
+ value
221
+ when /\AArray<(?<inner_type>.+)>\z/
222
+ inner_type = Regexp.last_match[:inner_type]
223
+ value.map { |v| _deserialize(inner_type, v) }
224
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
225
+ k_type = Regexp.last_match[:k_type]
226
+ v_type = Regexp.last_match[:v_type]
227
+ {}.tap do |hash|
228
+ value.each do |k, v|
229
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
230
+ end
231
+ end
232
+ else # model
233
+ # models (e.g. Pet) or oneOf
234
+ klass = AutosdeOpenapiClient.const_get(type)
235
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ if value.nil?
258
+ is_nullable = self.class.openapi_nullable.include?(attr)
259
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
260
+ end
261
+
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map { |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+
287
+ end