autosde_openapi_client 1.0.46 → 1.0.47

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,388 @@
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
+ # HostCluster
18
+ class HostCluster
19
+ # component_state
20
+ attr_accessor :component_state
21
+
22
+ # name
23
+ attr_accessor :name
24
+
25
+ # owner_id
26
+ attr_accessor :owner_id
27
+
28
+ # owner_name
29
+ attr_accessor :owner_name
30
+
31
+ # protocol
32
+ attr_accessor :protocol
33
+
34
+ # status
35
+ attr_accessor :status
36
+
37
+ attr_accessor :storage_system
38
+
39
+ # uuid
40
+ attr_accessor :uuid
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'component_state' => :'component_state',
68
+ :'name' => :'name',
69
+ :'owner_id' => :'owner_id',
70
+ :'owner_name' => :'owner_name',
71
+ :'protocol' => :'protocol',
72
+ :'status' => :'status',
73
+ :'storage_system' => :'storage_system',
74
+ :'uuid' => :'uuid'
75
+ }
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'component_state' => :'String',
87
+ :'name' => :'String',
88
+ :'owner_id' => :'String',
89
+ :'owner_name' => :'String',
90
+ :'protocol' => :'String',
91
+ :'status' => :'String',
92
+ :'storage_system' => :'StorageSystem',
93
+ :'uuid' => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::HostCluster` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::HostCluster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'component_state')
119
+ self.component_state = attributes[:'component_state']
120
+ end
121
+
122
+ if attributes.key?(:'name')
123
+ self.name = attributes[:'name']
124
+ end
125
+
126
+ if attributes.key?(:'owner_id')
127
+ self.owner_id = attributes[:'owner_id']
128
+ end
129
+
130
+ if attributes.key?(:'owner_name')
131
+ self.owner_name = attributes[:'owner_name']
132
+ end
133
+
134
+ if attributes.key?(:'protocol')
135
+ self.protocol = attributes[:'protocol']
136
+ end
137
+
138
+ if attributes.key?(:'status')
139
+ self.status = attributes[:'status']
140
+ end
141
+
142
+ if attributes.key?(:'storage_system')
143
+ self.storage_system = attributes[:'storage_system']
144
+ end
145
+
146
+ if attributes.key?(:'uuid')
147
+ self.uuid = attributes[:'uuid']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = Array.new
155
+ if !@component_state.nil? && @component_state.to_s.length > 32
156
+ invalid_properties.push('invalid value for "component_state", the character length must be smaller than or equal to 32.')
157
+ end
158
+
159
+ if !@name.nil? && @name.to_s.length > 15
160
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 15.')
161
+ end
162
+
163
+ if !@owner_id.nil? && @owner_id.to_s.length > 15
164
+ invalid_properties.push('invalid value for "owner_id", the character length must be smaller than or equal to 15.')
165
+ end
166
+
167
+ if !@owner_name.nil? && @owner_name.to_s.length > 15
168
+ invalid_properties.push('invalid value for "owner_name", the character length must be smaller than or equal to 15.')
169
+ end
170
+
171
+ if !@protocol.nil? && @protocol.to_s.length > 15
172
+ invalid_properties.push('invalid value for "protocol", the character length must be smaller than or equal to 15.')
173
+ end
174
+
175
+ invalid_properties
176
+ end
177
+
178
+ # Check to see if the all the properties in the model are valid
179
+ # @return true if the model is valid
180
+ def valid?
181
+ component_state_validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
182
+ return false unless component_state_validator.valid?(@component_state)
183
+ return false if !@component_state.nil? && @component_state.to_s.length > 32
184
+ return false if !@name.nil? && @name.to_s.length > 15
185
+ return false if !@owner_id.nil? && @owner_id.to_s.length > 15
186
+ return false if !@owner_name.nil? && @owner_name.to_s.length > 15
187
+ return false if !@protocol.nil? && @protocol.to_s.length > 15
188
+ true
189
+ end
190
+
191
+ # Custom attribute writer method checking allowed values (enum).
192
+ # @param [Object] component_state Object to be assigned
193
+ def component_state=(component_state)
194
+ validator = EnumAttributeValidator.new('String', ["PENDING_CREATION", "CREATED", "DELETED", "PENDING_DELETION", "MODIFICATION", "PENDING_MODIFICATION"])
195
+ unless validator.valid?(component_state)
196
+ fail ArgumentError, "invalid value for \"component_state\", must be one of #{validator.allowable_values}."
197
+ end
198
+ @component_state = component_state
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] name Value to be assigned
203
+ def name=(name)
204
+ if !name.nil? && name.to_s.length > 15
205
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 15.'
206
+ end
207
+
208
+ @name = name
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] owner_id Value to be assigned
213
+ def owner_id=(owner_id)
214
+ if !owner_id.nil? && owner_id.to_s.length > 15
215
+ fail ArgumentError, 'invalid value for "owner_id", the character length must be smaller than or equal to 15.'
216
+ end
217
+
218
+ @owner_id = owner_id
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] owner_name Value to be assigned
223
+ def owner_name=(owner_name)
224
+ if !owner_name.nil? && owner_name.to_s.length > 15
225
+ fail ArgumentError, 'invalid value for "owner_name", the character length must be smaller than or equal to 15.'
226
+ end
227
+
228
+ @owner_name = owner_name
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] protocol Value to be assigned
233
+ def protocol=(protocol)
234
+ if !protocol.nil? && protocol.to_s.length > 15
235
+ fail ArgumentError, 'invalid value for "protocol", the character length must be smaller than or equal to 15.'
236
+ end
237
+
238
+ @protocol = protocol
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ component_state == o.component_state &&
247
+ name == o.name &&
248
+ owner_id == o.owner_id &&
249
+ owner_name == o.owner_name &&
250
+ protocol == o.protocol &&
251
+ status == o.status &&
252
+ storage_system == o.storage_system &&
253
+ uuid == o.uuid
254
+ end
255
+
256
+ # @see the `==` method
257
+ # @param [Object] Object to be compared
258
+ def eql?(o)
259
+ self == o
260
+ end
261
+
262
+ # Calculates hash code according to all attributes.
263
+ # @return [Integer] Hash code
264
+ def hash
265
+ [component_state, name, owner_id, owner_name, protocol, status, storage_system, uuid].hash
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 self.build_from_hash(attributes)
272
+ new.build_from_hash(attributes)
273
+ end
274
+
275
+ # Builds the object from hash
276
+ # @param [Hash] attributes Model attributes in the form of hash
277
+ # @return [Object] Returns the model itself
278
+ def build_from_hash(attributes)
279
+ return nil unless attributes.is_a?(Hash)
280
+ self.class.openapi_types.each_pair do |key, type|
281
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
282
+ self.send("#{key}=", nil)
283
+ elsif type =~ /\AArray<(.*)>/i
284
+ # check to ensure the input is an array given that the attribute
285
+ # is documented as an array but the input is not
286
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
287
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
288
+ end
289
+ elsif !attributes[self.class.attribute_map[key]].nil?
290
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
291
+ end
292
+ end
293
+
294
+ self
295
+ end
296
+
297
+ # Deserializes the data based on type
298
+ # @param string type Data type
299
+ # @param string value Value to be deserialized
300
+ # @return [Object] Deserialized data
301
+ def _deserialize(type, value)
302
+ case type.to_sym
303
+ when :Time
304
+ Time.parse(value)
305
+ when :Date
306
+ Date.parse(value)
307
+ when :String
308
+ value.to_s
309
+ when :Integer
310
+ value.to_i
311
+ when :Float
312
+ value.to_f
313
+ when :Boolean
314
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
315
+ true
316
+ else
317
+ false
318
+ end
319
+ when :Object
320
+ # generic object (usually a Hash), return directly
321
+ value
322
+ when /\AArray<(?<inner_type>.+)>\z/
323
+ inner_type = Regexp.last_match[:inner_type]
324
+ value.map { |v| _deserialize(inner_type, v) }
325
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
326
+ k_type = Regexp.last_match[:k_type]
327
+ v_type = Regexp.last_match[:v_type]
328
+ {}.tap do |hash|
329
+ value.each do |k, v|
330
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
331
+ end
332
+ end
333
+ else # model
334
+ # models (e.g. Pet) or oneOf
335
+ klass = AutosdeOpenapiClient.const_get(type)
336
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
337
+ end
338
+ end
339
+
340
+ # Returns the string representation of the object
341
+ # @return [String] String presentation of the object
342
+ def to_s
343
+ to_hash.to_s
344
+ end
345
+
346
+ # to_body is an alias to to_hash (backward compatibility)
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_body
349
+ to_hash
350
+ end
351
+
352
+ # Returns the object in the form of hash
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_hash
355
+ hash = {}
356
+ self.class.attribute_map.each_pair do |attr, param|
357
+ value = self.send(attr)
358
+ if value.nil?
359
+ is_nullable = self.class.openapi_nullable.include?(attr)
360
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
361
+ end
362
+
363
+ hash[param] = _to_hash(value)
364
+ end
365
+ hash
366
+ end
367
+
368
+ # Outputs non-array value in the form of hash
369
+ # For object, use to_hash. Otherwise, just return the value
370
+ # @param [Object] value Any valid value
371
+ # @return [Hash] Returns the value in the form of hash
372
+ def _to_hash(value)
373
+ if value.is_a?(Array)
374
+ value.compact.map { |v| _to_hash(v) }
375
+ elsif value.is_a?(Hash)
376
+ {}.tap do |hash|
377
+ value.each { |k, v| hash[k] = _to_hash(v) }
378
+ end
379
+ elsif value.respond_to? :to_hash
380
+ value.to_hash
381
+ else
382
+ value
383
+ end
384
+ end
385
+
386
+ end
387
+
388
+ end
@@ -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