topological_inventory-ingress_api-client 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -0
  3. data/docs/Inventory.md +11 -1
  4. data/docs/InventoryCollectionServiceCredentialType.md +21 -0
  5. data/docs/InventoryCollectionServiceInstanceNodeServiceCredential.md +21 -0
  6. data/docs/InventoryCollectionServiceInstanceServiceCredential.md +21 -0
  7. data/docs/InventoryCollectionServiceOfferingNodeServiceCredential.md +21 -0
  8. data/docs/InventoryCollectionServiceOfferingServiceCredential.md +21 -0
  9. data/docs/ServiceCredential.md +2 -0
  10. data/docs/ServiceCredentialAllOf.md +2 -0
  11. data/docs/ServiceCredentialType.md +33 -0
  12. data/docs/ServiceCredentialTypeAllOf.md +33 -0
  13. data/docs/ServiceCredentialTypeReference.md +21 -0
  14. data/docs/ServiceInstance.md +0 -2
  15. data/docs/ServiceInstanceAllOf.md +0 -2
  16. data/docs/ServiceInstanceNode.md +0 -2
  17. data/docs/ServiceInstanceNodeAllOf.md +0 -2
  18. data/docs/ServiceInstanceNodeReference.md +21 -0
  19. data/docs/ServiceInstanceNodeServiceCredential.md +19 -0
  20. data/docs/ServiceInstanceNodeServiceCredentialAllOf.md +19 -0
  21. data/docs/ServiceInstanceServiceCredential.md +19 -0
  22. data/docs/ServiceInstanceServiceCredentialAllOf.md +19 -0
  23. data/docs/ServiceOffering.md +0 -2
  24. data/docs/ServiceOfferingAllOf.md +0 -2
  25. data/docs/ServiceOfferingNode.md +0 -2
  26. data/docs/ServiceOfferingNodeAllOf.md +0 -2
  27. data/docs/ServiceOfferingNodeReference.md +21 -0
  28. data/docs/ServiceOfferingNodeServiceCredential.md +19 -0
  29. data/docs/ServiceOfferingNodeServiceCredentialAllOf.md +19 -0
  30. data/docs/ServiceOfferingServiceCredential.md +19 -0
  31. data/docs/ServiceOfferingServiceCredentialAllOf.md +19 -0
  32. data/lib/topological_inventory-ingress_api-client.rb +18 -0
  33. data/lib/topological_inventory-ingress_api-client/models/inventory.rb +66 -20
  34. data/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_credential_type.rb +233 -0
  35. data/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_instance_node_service_credential.rb +233 -0
  36. data/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_instance_service_credential.rb +233 -0
  37. data/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_offering_node_service_credential.rb +233 -0
  38. data/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_offering_service_credential.rb +233 -0
  39. data/lib/topological_inventory-ingress_api-client/models/service_credential.rb +11 -1
  40. data/lib/topological_inventory-ingress_api-client/models/service_credential_all_of.rb +11 -1
  41. data/lib/topological_inventory-ingress_api-client/models/service_credential_type.rb +299 -0
  42. data/lib/topological_inventory-ingress_api-client/models/service_credential_type_all_of.rb +291 -0
  43. data/lib/topological_inventory-ingress_api-client/models/service_credential_type_reference.rb +281 -0
  44. data/lib/topological_inventory-ingress_api-client/models/service_instance.rb +1 -11
  45. data/lib/topological_inventory-ingress_api-client/models/service_instance_all_of.rb +1 -11
  46. data/lib/topological_inventory-ingress_api-client/models/service_instance_node.rb +1 -11
  47. data/lib/topological_inventory-ingress_api-client/models/service_instance_node_all_of.rb +1 -11
  48. data/lib/topological_inventory-ingress_api-client/models/service_instance_node_reference.rb +281 -0
  49. data/lib/topological_inventory-ingress_api-client/models/service_instance_node_service_credential.rb +233 -0
  50. data/lib/topological_inventory-ingress_api-client/models/service_instance_node_service_credential_all_of.rb +225 -0
  51. data/lib/topological_inventory-ingress_api-client/models/service_instance_service_credential.rb +233 -0
  52. data/lib/topological_inventory-ingress_api-client/models/service_instance_service_credential_all_of.rb +225 -0
  53. data/lib/topological_inventory-ingress_api-client/models/service_offering.rb +1 -11
  54. data/lib/topological_inventory-ingress_api-client/models/service_offering_all_of.rb +1 -11
  55. data/lib/topological_inventory-ingress_api-client/models/service_offering_node.rb +1 -11
  56. data/lib/topological_inventory-ingress_api-client/models/service_offering_node_all_of.rb +1 -11
  57. data/lib/topological_inventory-ingress_api-client/models/service_offering_node_reference.rb +281 -0
  58. data/lib/topological_inventory-ingress_api-client/models/service_offering_node_service_credential.rb +233 -0
  59. data/lib/topological_inventory-ingress_api-client/models/service_offering_node_service_credential_all_of.rb +225 -0
  60. data/lib/topological_inventory-ingress_api-client/models/service_offering_service_credential.rb +233 -0
  61. data/lib/topological_inventory-ingress_api-client/models/service_offering_service_credential_all_of.rb +225 -0
  62. data/lib/topological_inventory-ingress_api-client/version.rb +1 -1
  63. data/spec/models/inventory_collection_service_credential_type_spec.rb +53 -0
  64. data/spec/models/inventory_collection_service_instance_node_service_credential_spec.rb +53 -0
  65. data/spec/models/inventory_collection_service_instance_service_credential_spec.rb +53 -0
  66. data/spec/models/inventory_collection_service_offering_node_service_credential_spec.rb +53 -0
  67. data/spec/models/inventory_collection_service_offering_service_credential_spec.rb +53 -0
  68. data/spec/models/service_credential_all_of_spec.rb +6 -0
  69. data/spec/models/service_credential_type_all_of_spec.rb +89 -0
  70. data/spec/models/service_credential_type_reference_spec.rb +53 -0
  71. data/spec/models/service_credential_type_spec.rb +89 -0
  72. data/spec/models/service_instance_all_of_spec.rb +0 -6
  73. data/spec/models/service_instance_node_all_of_spec.rb +0 -6
  74. data/spec/models/service_instance_node_reference_spec.rb +53 -0
  75. data/spec/models/service_instance_node_service_credential_all_of_spec.rb +47 -0
  76. data/spec/models/service_instance_node_service_credential_spec.rb +47 -0
  77. data/spec/models/service_instance_service_credential_all_of_spec.rb +47 -0
  78. data/spec/models/service_instance_service_credential_spec.rb +47 -0
  79. data/spec/models/service_offering_all_of_spec.rb +0 -6
  80. data/spec/models/service_offering_node_all_of_spec.rb +0 -6
  81. data/spec/models/service_offering_node_reference_spec.rb +53 -0
  82. data/spec/models/service_offering_node_service_credential_all_of_spec.rb +47 -0
  83. data/spec/models/service_offering_node_service_credential_spec.rb +47 -0
  84. data/spec/models/service_offering_service_credential_all_of_spec.rb +47 -0
  85. data/spec/models/service_offering_service_credential_spec.rb +47 -0
  86. metadata +246 -174
@@ -0,0 +1,281 @@
1
+ =begin
2
+ #Topological Inventory Ingress API
3
+
4
+ #Topological Inventory Ingress API
5
+
6
+ The version of the OpenAPI document: 0.0.2
7
+ Contact: support@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TopologicalInventoryIngressApiClient
16
+ class ServiceOfferingNodeReference
17
+ attr_accessor :inventory_collection_name
18
+
19
+ attr_accessor :reference
20
+
21
+ attr_accessor :ref
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'inventory_collection_name' => :'inventory_collection_name',
27
+ :'reference' => :'reference',
28
+ :'ref' => :'ref'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'inventory_collection_name' => :'String',
36
+ :'reference' => :'ClusterReferenceReference',
37
+ :'ref' => :'String'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TopologicalInventoryIngressApiClient::ServiceOfferingNodeReference` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TopologicalInventoryIngressApiClient::ServiceOfferingNodeReference`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'inventory_collection_name')
63
+ self.inventory_collection_name = attributes[:'inventory_collection_name']
64
+ end
65
+
66
+ if attributes.key?(:'reference')
67
+ self.reference = attributes[:'reference']
68
+ end
69
+
70
+ if attributes.key?(:'ref')
71
+ self.ref = attributes[:'ref']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @inventory_collection_name.nil?
80
+ invalid_properties.push('invalid value for "inventory_collection_name", inventory_collection_name cannot be nil.')
81
+ end
82
+
83
+ pattern = Regexp.new(/^service_offering_nodes$/)
84
+ if @inventory_collection_name !~ pattern
85
+ invalid_properties.push("invalid value for \"inventory_collection_name\", must conform to the pattern #{pattern}.")
86
+ end
87
+
88
+ if @reference.nil?
89
+ invalid_properties.push('invalid value for "reference", reference cannot be nil.')
90
+ end
91
+
92
+ if @ref.nil?
93
+ invalid_properties.push('invalid value for "ref", ref cannot be nil.')
94
+ end
95
+
96
+ pattern = Regexp.new(/^manager_ref$/)
97
+ if @ref !~ pattern
98
+ invalid_properties.push("invalid value for \"ref\", must conform to the pattern #{pattern}.")
99
+ end
100
+
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ return false if @inventory_collection_name.nil?
108
+ return false if @inventory_collection_name !~ Regexp.new(/^service_offering_nodes$/)
109
+ return false if @reference.nil?
110
+ return false if @ref.nil?
111
+ return false if @ref !~ Regexp.new(/^manager_ref$/)
112
+ true
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] inventory_collection_name Value to be assigned
117
+ def inventory_collection_name=(inventory_collection_name)
118
+ if inventory_collection_name.nil?
119
+ fail ArgumentError, 'inventory_collection_name cannot be nil'
120
+ end
121
+
122
+ pattern = Regexp.new(/^service_offering_nodes$/)
123
+ if inventory_collection_name !~ pattern
124
+ fail ArgumentError, "invalid value for \"inventory_collection_name\", must conform to the pattern #{pattern}."
125
+ end
126
+
127
+ @inventory_collection_name = inventory_collection_name
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] ref Value to be assigned
132
+ def ref=(ref)
133
+ if ref.nil?
134
+ fail ArgumentError, 'ref cannot be nil'
135
+ end
136
+
137
+ pattern = Regexp.new(/^manager_ref$/)
138
+ if ref !~ pattern
139
+ fail ArgumentError, "invalid value for \"ref\", must conform to the pattern #{pattern}."
140
+ end
141
+
142
+ @ref = ref
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ inventory_collection_name == o.inventory_collection_name &&
151
+ reference == o.reference &&
152
+ ref == o.ref
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
+ [inventory_collection_name, reference, ref].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 type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
189
+ end
190
+
191
+ self
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def _deserialize(type, value)
199
+ case type.to_sym
200
+ when :DateTime
201
+ DateTime.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ TopologicalInventoryIngressApiClient.const_get(type).build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+ end
281
+ end
@@ -0,0 +1,233 @@
1
+ =begin
2
+ #Topological Inventory Ingress API
3
+
4
+ #Topological Inventory Ingress API
5
+
6
+ The version of the OpenAPI document: 0.0.2
7
+ Contact: support@redhat.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TopologicalInventoryIngressApiClient
16
+ class ServiceOfferingNodeServiceCredential
17
+ attr_accessor :service_credential
18
+
19
+ attr_accessor :service_offering_node
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'service_credential' => :'service_credential',
25
+ :'service_offering_node' => :'service_offering_node'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'service_credential' => :'ServiceCredentialReference',
33
+ :'service_offering_node' => :'ServiceOfferingNodeReference'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # List of class defined in allOf (OpenAPI v3)
44
+ def self.openapi_all_of
45
+ [
46
+ :'InventoryObject',
47
+ :'ServiceOfferingNodeServiceCredentialAllOf'
48
+ ]
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TopologicalInventoryIngressApiClient::ServiceOfferingNodeServiceCredential` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TopologicalInventoryIngressApiClient::ServiceOfferingNodeServiceCredential`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'service_credential')
67
+ self.service_credential = attributes[:'service_credential']
68
+ end
69
+
70
+ if attributes.key?(:'service_offering_node')
71
+ self.service_offering_node = attributes[:'service_offering_node']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ if @service_credential.nil?
80
+ invalid_properties.push('invalid value for "service_credential", service_credential cannot be nil.')
81
+ end
82
+
83
+ if @service_offering_node.nil?
84
+ invalid_properties.push('invalid value for "service_offering_node", service_offering_node cannot be nil.')
85
+ end
86
+
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ return false if @service_credential.nil?
94
+ return false if @service_offering_node.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ service_credential == o.service_credential &&
104
+ service_offering_node == o.service_offering_node
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [service_credential, service_offering_node].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :DateTime
153
+ DateTime.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ TopologicalInventoryIngressApiClient.const_get(type).build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+ end
233
+ end