autosde_openapi_client 1.0.48 → 1.0.49

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