sources-api-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.md +151 -0
  6. data/Rakefile +10 -0
  7. data/docs/Application.md +31 -0
  8. data/docs/ApplicationType.md +31 -0
  9. data/docs/ApplicationTypesCollection.md +21 -0
  10. data/docs/ApplicationsCollection.md +21 -0
  11. data/docs/Authentication.md +41 -0
  12. data/docs/AuthenticationExtra.md +17 -0
  13. data/docs/AuthenticationExtraAzure.md +17 -0
  14. data/docs/AuthenticationsCollection.md +21 -0
  15. data/docs/CollectionLinks.md +23 -0
  16. data/docs/CollectionMetadata.md +21 -0
  17. data/docs/DefaultApi.md +1945 -0
  18. data/docs/Endpoint.md +47 -0
  19. data/docs/EndpointsCollection.md +21 -0
  20. data/docs/ErrorNotFound.md +17 -0
  21. data/docs/ErrorNotFoundErrors.md +19 -0
  22. data/docs/GraphQLRequest.md +21 -0
  23. data/docs/GraphQLResponse.md +19 -0
  24. data/docs/Source.md +37 -0
  25. data/docs/SourceType.md +31 -0
  26. data/docs/SourceTypesCollection.md +21 -0
  27. data/docs/SourcesCollection.md +21 -0
  28. data/docs/Tenant.md +21 -0
  29. data/git_push.sh +58 -0
  30. data/lib/sources-api-client.rb +61 -0
  31. data/lib/sources-api-client/api/default_api.rb +2523 -0
  32. data/lib/sources-api-client/api_client.rb +386 -0
  33. data/lib/sources-api-client/api_error.rb +57 -0
  34. data/lib/sources-api-client/configuration.rb +268 -0
  35. data/lib/sources-api-client/models/application.rb +323 -0
  36. data/lib/sources-api-client/models/application_type.rb +287 -0
  37. data/lib/sources-api-client/models/application_types_collection.rb +226 -0
  38. data/lib/sources-api-client/models/applications_collection.rb +226 -0
  39. data/lib/sources-api-client/models/authentication.rb +350 -0
  40. data/lib/sources-api-client/models/authentication_extra.rb +206 -0
  41. data/lib/sources-api-client/models/authentication_extra_azure.rb +206 -0
  42. data/lib/sources-api-client/models/authentications_collection.rb +226 -0
  43. data/lib/sources-api-client/models/collection_links.rb +233 -0
  44. data/lib/sources-api-client/models/collection_metadata.rb +224 -0
  45. data/lib/sources-api-client/models/endpoint.rb +384 -0
  46. data/lib/sources-api-client/models/endpoints_collection.rb +226 -0
  47. data/lib/sources-api-client/models/error_not_found.rb +208 -0
  48. data/lib/sources-api-client/models/error_not_found_errors.rb +215 -0
  49. data/lib/sources-api-client/models/graph_ql_request.rb +237 -0
  50. data/lib/sources-api-client/models/graph_ql_response.rb +219 -0
  51. data/lib/sources-api-client/models/source.rb +332 -0
  52. data/lib/sources-api-client/models/source_type.rb +287 -0
  53. data/lib/sources-api-client/models/source_types_collection.rb +226 -0
  54. data/lib/sources-api-client/models/sources_collection.rb +226 -0
  55. data/lib/sources-api-client/models/tenant.rb +224 -0
  56. data/lib/sources-api-client/version.rb +15 -0
  57. data/pkg/sources-api-client-1.0.0.gem +0 -0
  58. data/sources-api-client.gemspec +39 -0
  59. data/spec/api/default_api_spec.rb +487 -0
  60. data/spec/api_client_spec.rb +226 -0
  61. data/spec/configuration_spec.rb +42 -0
  62. data/spec/models/application_spec.rb +83 -0
  63. data/spec/models/application_type_spec.rb +83 -0
  64. data/spec/models/application_types_collection_spec.rb +53 -0
  65. data/spec/models/applications_collection_spec.rb +53 -0
  66. data/spec/models/authentication_extra_azure_spec.rb +41 -0
  67. data/spec/models/authentication_extra_spec.rb +41 -0
  68. data/spec/models/authentication_spec.rb +113 -0
  69. data/spec/models/authentications_collection_spec.rb +53 -0
  70. data/spec/models/collection_links_spec.rb +59 -0
  71. data/spec/models/collection_metadata_spec.rb +53 -0
  72. data/spec/models/endpoint_spec.rb +131 -0
  73. data/spec/models/endpoints_collection_spec.rb +53 -0
  74. data/spec/models/error_not_found_errors_spec.rb +47 -0
  75. data/spec/models/error_not_found_spec.rb +41 -0
  76. data/spec/models/graph_ql_request_spec.rb +53 -0
  77. data/spec/models/graph_ql_response_spec.rb +47 -0
  78. data/spec/models/source_spec.rb +101 -0
  79. data/spec/models/source_type_spec.rb +83 -0
  80. data/spec/models/source_types_collection_spec.rb +53 -0
  81. data/spec/models/sources_collection_spec.rb +53 -0
  82. data/spec/models/tenant_spec.rb +53 -0
  83. data/spec/spec_helper.rb +111 -0
  84. metadata +210 -0
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Sources
3
+
4
+ #Sources
5
+
6
+ The version of the OpenAPI document: 1.0.0
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 SourcesApiClient
16
+ class CollectionMetadata
17
+ attr_accessor :count
18
+
19
+ attr_accessor :limit
20
+
21
+ attr_accessor :offset
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'count' => :'count',
27
+ :'limit' => :'limit',
28
+ :'offset' => :'offset'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'count' => :'Integer',
36
+ :'limit' => :'Integer',
37
+ :'offset' => :'Integer'
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 `SourcesApiClient::CollectionMetadata` 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 `SourcesApiClient::CollectionMetadata`. 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?(:'count')
63
+ self.count = attributes[:'count']
64
+ end
65
+
66
+ if attributes.key?(:'limit')
67
+ self.limit = attributes[:'limit']
68
+ end
69
+
70
+ if attributes.key?(:'offset')
71
+ self.offset = attributes[:'offset']
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
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ count == o.count &&
94
+ limit == o.limit &&
95
+ offset == o.offset
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Integer] Hash code
106
+ def hash
107
+ [count, limit, offset].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def self.build_from_hash(attributes)
114
+ new.build_from_hash(attributes)
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ SourcesApiClient.const_get(type).build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ if value.nil?
197
+ is_nullable = self.class.openapi_nullable.include?(attr)
198
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
199
+ end
200
+
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,384 @@
1
+ =begin
2
+ #Sources
3
+
4
+ #Sources
5
+
6
+ The version of the OpenAPI document: 1.0.0
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 SourcesApiClient
16
+ class Endpoint
17
+ attr_accessor :availability_status
18
+
19
+ attr_accessor :availability_status_error
20
+
21
+ # Optional X.509 Certificate Authority
22
+ attr_accessor :certificate_authority
23
+
24
+ attr_accessor :created_at
25
+
26
+ attr_accessor :default
27
+
28
+ # URI host component
29
+ attr_accessor :host
30
+
31
+ # ID of the resource
32
+ attr_accessor :id
33
+
34
+ # URI path component
35
+ attr_accessor :path
36
+
37
+ # URI port component
38
+ attr_accessor :port
39
+
40
+ # Identifier of a receptor node
41
+ attr_accessor :receptor_node
42
+
43
+ attr_accessor :role
44
+
45
+ # URI scheme component
46
+ attr_accessor :scheme
47
+
48
+ # ID of the resource
49
+ attr_accessor :source_id
50
+
51
+ attr_accessor :tenant
52
+
53
+ attr_accessor :updated_at
54
+
55
+ # Should SSL be verified
56
+ attr_accessor :verify_ssl
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'availability_status' => :'availability_status',
62
+ :'availability_status_error' => :'availability_status_error',
63
+ :'certificate_authority' => :'certificate_authority',
64
+ :'created_at' => :'created_at',
65
+ :'default' => :'default',
66
+ :'host' => :'host',
67
+ :'id' => :'id',
68
+ :'path' => :'path',
69
+ :'port' => :'port',
70
+ :'receptor_node' => :'receptor_node',
71
+ :'role' => :'role',
72
+ :'scheme' => :'scheme',
73
+ :'source_id' => :'source_id',
74
+ :'tenant' => :'tenant',
75
+ :'updated_at' => :'updated_at',
76
+ :'verify_ssl' => :'verify_ssl'
77
+ }
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'availability_status' => :'String',
84
+ :'availability_status_error' => :'String',
85
+ :'certificate_authority' => :'String',
86
+ :'created_at' => :'DateTime',
87
+ :'default' => :'Boolean',
88
+ :'host' => :'String',
89
+ :'id' => :'String',
90
+ :'path' => :'String',
91
+ :'port' => :'Integer',
92
+ :'receptor_node' => :'String',
93
+ :'role' => :'String',
94
+ :'scheme' => :'String',
95
+ :'source_id' => :'String',
96
+ :'tenant' => :'String',
97
+ :'updated_at' => :'DateTime',
98
+ :'verify_ssl' => :'Boolean'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SourcesApiClient::Endpoint` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SourcesApiClient::Endpoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'availability_status')
124
+ self.availability_status = attributes[:'availability_status']
125
+ end
126
+
127
+ if attributes.key?(:'availability_status_error')
128
+ self.availability_status_error = attributes[:'availability_status_error']
129
+ end
130
+
131
+ if attributes.key?(:'certificate_authority')
132
+ self.certificate_authority = attributes[:'certificate_authority']
133
+ end
134
+
135
+ if attributes.key?(:'created_at')
136
+ self.created_at = attributes[:'created_at']
137
+ end
138
+
139
+ if attributes.key?(:'default')
140
+ self.default = attributes[:'default']
141
+ end
142
+
143
+ if attributes.key?(:'host')
144
+ self.host = attributes[:'host']
145
+ end
146
+
147
+ if attributes.key?(:'id')
148
+ self.id = attributes[:'id']
149
+ end
150
+
151
+ if attributes.key?(:'path')
152
+ self.path = attributes[:'path']
153
+ end
154
+
155
+ if attributes.key?(:'port')
156
+ self.port = attributes[:'port']
157
+ end
158
+
159
+ if attributes.key?(:'receptor_node')
160
+ self.receptor_node = attributes[:'receptor_node']
161
+ end
162
+
163
+ if attributes.key?(:'role')
164
+ self.role = attributes[:'role']
165
+ end
166
+
167
+ if attributes.key?(:'scheme')
168
+ self.scheme = attributes[:'scheme']
169
+ end
170
+
171
+ if attributes.key?(:'source_id')
172
+ self.source_id = attributes[:'source_id']
173
+ end
174
+
175
+ if attributes.key?(:'tenant')
176
+ self.tenant = attributes[:'tenant']
177
+ end
178
+
179
+ if attributes.key?(:'updated_at')
180
+ self.updated_at = attributes[:'updated_at']
181
+ end
182
+
183
+ if attributes.key?(:'verify_ssl')
184
+ self.verify_ssl = attributes[:'verify_ssl']
185
+ end
186
+ end
187
+
188
+ # Show invalid properties with the reasons. Usually used together with valid?
189
+ # @return Array for valid properties with the reasons
190
+ def list_invalid_properties
191
+ invalid_properties = Array.new
192
+ pattern = Regexp.new(/^\d+$/)
193
+ if !@id.nil? && @id !~ pattern
194
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
195
+ end
196
+
197
+ pattern = Regexp.new(/^\d+$/)
198
+ if !@source_id.nil? && @source_id !~ pattern
199
+ invalid_properties.push("invalid value for \"source_id\", must conform to the pattern #{pattern}.")
200
+ end
201
+
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ return false if !@id.nil? && @id !~ Regexp.new(/^\d+$/)
209
+ return false if !@source_id.nil? && @source_id !~ Regexp.new(/^\d+$/)
210
+ true
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] id Value to be assigned
215
+ def id=(id)
216
+ pattern = Regexp.new(/^\d+$/)
217
+ if !id.nil? && id !~ pattern
218
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
219
+ end
220
+
221
+ @id = id
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] source_id Value to be assigned
226
+ def source_id=(source_id)
227
+ pattern = Regexp.new(/^\d+$/)
228
+ if !source_id.nil? && source_id !~ pattern
229
+ fail ArgumentError, "invalid value for \"source_id\", must conform to the pattern #{pattern}."
230
+ end
231
+
232
+ @source_id = source_id
233
+ end
234
+
235
+ # Checks equality by comparing each attribute.
236
+ # @param [Object] Object to be compared
237
+ def ==(o)
238
+ return true if self.equal?(o)
239
+ self.class == o.class &&
240
+ availability_status == o.availability_status &&
241
+ availability_status_error == o.availability_status_error &&
242
+ certificate_authority == o.certificate_authority &&
243
+ created_at == o.created_at &&
244
+ default == o.default &&
245
+ host == o.host &&
246
+ id == o.id &&
247
+ path == o.path &&
248
+ port == o.port &&
249
+ receptor_node == o.receptor_node &&
250
+ role == o.role &&
251
+ scheme == o.scheme &&
252
+ source_id == o.source_id &&
253
+ tenant == o.tenant &&
254
+ updated_at == o.updated_at &&
255
+ verify_ssl == o.verify_ssl
256
+ end
257
+
258
+ # @see the `==` method
259
+ # @param [Object] Object to be compared
260
+ def eql?(o)
261
+ self == o
262
+ end
263
+
264
+ # Calculates hash code according to all attributes.
265
+ # @return [Integer] Hash code
266
+ def hash
267
+ [availability_status, availability_status_error, certificate_authority, created_at, default, host, id, path, port, receptor_node, role, scheme, source_id, tenant, updated_at, verify_ssl].hash
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def self.build_from_hash(attributes)
274
+ new.build_from_hash(attributes)
275
+ end
276
+
277
+ # Builds the object from hash
278
+ # @param [Hash] attributes Model attributes in the form of hash
279
+ # @return [Object] Returns the model itself
280
+ def build_from_hash(attributes)
281
+ return nil unless attributes.is_a?(Hash)
282
+ self.class.openapi_types.each_pair do |key, type|
283
+ if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
304
+ DateTime.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
+ SourcesApiClient.const_get(type).build_from_hash(value)
335
+ end
336
+ end
337
+
338
+ # Returns the string representation of the object
339
+ # @return [String] String presentation of the object
340
+ def to_s
341
+ to_hash.to_s
342
+ end
343
+
344
+ # to_body is an alias to to_hash (backward compatibility)
345
+ # @return [Hash] Returns the object in the form of hash
346
+ def to_body
347
+ to_hash
348
+ end
349
+
350
+ # Returns the object in the form of hash
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_hash
353
+ hash = {}
354
+ self.class.attribute_map.each_pair do |attr, param|
355
+ value = self.send(attr)
356
+ if value.nil?
357
+ is_nullable = self.class.openapi_nullable.include?(attr)
358
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
359
+ end
360
+
361
+ hash[param] = _to_hash(value)
362
+ end
363
+ hash
364
+ end
365
+
366
+ # Outputs non-array value in the form of hash
367
+ # For object, use to_hash. Otherwise, just return the value
368
+ # @param [Object] value Any valid value
369
+ # @return [Hash] Returns the value in the form of hash
370
+ def _to_hash(value)
371
+ if value.is_a?(Array)
372
+ value.compact.map { |v| _to_hash(v) }
373
+ elsif value.is_a?(Hash)
374
+ {}.tap do |hash|
375
+ value.each { |k, v| hash[k] = _to_hash(v) }
376
+ end
377
+ elsif value.respond_to? :to_hash
378
+ value.to_hash
379
+ else
380
+ value
381
+ end
382
+ end
383
+ end
384
+ end