ibm_cloud_iam 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +131 -0
  4. data/Rakefile +10 -0
  5. data/docs/ApiKey.md +43 -0
  6. data/docs/ApiKeyInsideCreateServiceIdRequest.md +23 -0
  7. data/docs/ApiKeyList.md +29 -0
  8. data/docs/CreateApiKeyRequest.md +27 -0
  9. data/docs/CreateServiceIdRequest.md +25 -0
  10. data/docs/EnityHistoryRecord.md +27 -0
  11. data/docs/Error.md +23 -0
  12. data/docs/ExceptionResponse.md +23 -0
  13. data/docs/ExceptionResponseContext.md +39 -0
  14. data/docs/IdentityOperationsApi.md +828 -0
  15. data/docs/InlineObject.md +19 -0
  16. data/docs/InlineObject1.md +23 -0
  17. data/docs/InlineObject2.md +21 -0
  18. data/docs/InlineObject3.md +25 -0
  19. data/docs/MFARequirementsResponse.md +21 -0
  20. data/docs/OidcExceptionResponse.md +25 -0
  21. data/docs/ResponseContext.md +37 -0
  22. data/docs/ServiceId.md +43 -0
  23. data/docs/ServiceIdList.md +29 -0
  24. data/docs/TokenOperationsApi.md +226 -0
  25. data/docs/TokenResponse.md +27 -0
  26. data/docs/UpdateApiKeyRequest.md +19 -0
  27. data/docs/UpdateServiceIdRequest.md +21 -0
  28. data/git_push.sh +58 -0
  29. data/ibm_cloud_iam-1.0.0.gem +0 -0
  30. data/ibm_cloud_iam.gemspec +38 -0
  31. data/lib/ibm_cloud_iam.rb +62 -0
  32. data/lib/ibm_cloud_iam/api/identity_operations_api.rb +1083 -0
  33. data/lib/ibm_cloud_iam/api/token_operations_api.rb +351 -0
  34. data/lib/ibm_cloud_iam/api_client.rb +387 -0
  35. data/lib/ibm_cloud_iam/api_error.rb +57 -0
  36. data/lib/ibm_cloud_iam/configuration.rb +241 -0
  37. data/lib/ibm_cloud_iam/models/api_key.rb +381 -0
  38. data/lib/ibm_cloud_iam/models/api_key_inside_create_service_id_request.rb +245 -0
  39. data/lib/ibm_cloud_iam/models/api_key_list.rb +276 -0
  40. data/lib/ibm_cloud_iam/models/create_api_key_request.rb +270 -0
  41. data/lib/ibm_cloud_iam/models/create_service_id_request.rb +261 -0
  42. data/lib/ibm_cloud_iam/models/enity_history_record.rb +292 -0
  43. data/lib/ibm_cloud_iam/models/error.rb +255 -0
  44. data/lib/ibm_cloud_iam/models/exception_response.rb +251 -0
  45. data/lib/ibm_cloud_iam/models/exception_response_context.rb +320 -0
  46. data/lib/ibm_cloud_iam/models/inline_object.rb +229 -0
  47. data/lib/ibm_cloud_iam/models/inline_object1.rb +254 -0
  48. data/lib/ibm_cloud_iam/models/inline_object2.rb +244 -0
  49. data/lib/ibm_cloud_iam/models/inline_object3.rb +269 -0
  50. data/lib/ibm_cloud_iam/models/mfa_requirements_response.rb +245 -0
  51. data/lib/ibm_cloud_iam/models/oidc_exception_response.rb +258 -0
  52. data/lib/ibm_cloud_iam/models/response_context.rb +310 -0
  53. data/lib/ibm_cloud_iam/models/service_id.rb +377 -0
  54. data/lib/ibm_cloud_iam/models/service_id_list.rb +276 -0
  55. data/lib/ibm_cloud_iam/models/token_response.rb +260 -0
  56. data/lib/ibm_cloud_iam/models/update_api_key_request.rb +220 -0
  57. data/lib/ibm_cloud_iam/models/update_service_id_request.rb +232 -0
  58. data/lib/ibm_cloud_iam/version.rb +15 -0
  59. data/spec/api/identity_operations_api_spec.rb +253 -0
  60. data/spec/api/token_operations_api_spec.rb +94 -0
  61. data/spec/api_client_spec.rb +226 -0
  62. data/spec/configuration_spec.rb +42 -0
  63. data/spec/models/api_key_inside_create_service_id_request_spec.rb +59 -0
  64. data/spec/models/api_key_list_spec.rb +77 -0
  65. data/spec/models/api_key_spec.rb +119 -0
  66. data/spec/models/create_api_key_request_spec.rb +71 -0
  67. data/spec/models/create_service_id_request_spec.rb +65 -0
  68. data/spec/models/enity_history_record_spec.rb +71 -0
  69. data/spec/models/error_spec.rb +59 -0
  70. data/spec/models/exception_response_context_spec.rb +107 -0
  71. data/spec/models/exception_response_spec.rb +59 -0
  72. data/spec/models/inline_object1_spec.rb +59 -0
  73. data/spec/models/inline_object2_spec.rb +53 -0
  74. data/spec/models/inline_object3_spec.rb +65 -0
  75. data/spec/models/inline_object_spec.rb +47 -0
  76. data/spec/models/mfa_requirements_response_spec.rb +53 -0
  77. data/spec/models/oidc_exception_response_spec.rb +65 -0
  78. data/spec/models/response_context_spec.rb +101 -0
  79. data/spec/models/service_id_list_spec.rb +77 -0
  80. data/spec/models/service_id_spec.rb +119 -0
  81. data/spec/models/token_response_spec.rb +71 -0
  82. data/spec/models/update_api_key_request_spec.rb +47 -0
  83. data/spec/models/update_service_id_request_spec.rb +53 -0
  84. data/spec/spec_helper.rb +111 -0
  85. metadata +192 -0
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #IAM Identity Services API
3
+
4
+ #The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module IbmCloudIam
16
+ # Response body parameters in case of error situations.
17
+ class ExceptionResponse
18
+ attr_accessor :context
19
+
20
+ # Error message code of the REST Exception.
21
+ attr_accessor :status_code
22
+
23
+ # List of errors that occured.
24
+ attr_accessor :errors
25
+
26
+ # Unique ID of the requst.
27
+ attr_accessor :trace
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'context' => :'context',
33
+ :'status_code' => :'status_code',
34
+ :'errors' => :'errors',
35
+ :'trace' => :'trace'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'context' => :'ResponseContext',
43
+ :'status_code' => :'String',
44
+ :'errors' => :'Array<Error>',
45
+ :'trace' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudIam::ExceptionResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudIam::ExceptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'context')
71
+ self.context = attributes[:'context']
72
+ end
73
+
74
+ if attributes.key?(:'status_code')
75
+ self.status_code = attributes[:'status_code']
76
+ end
77
+
78
+ if attributes.key?(:'errors')
79
+ if (value = attributes[:'errors']).is_a?(Array)
80
+ self.errors = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'trace')
85
+ self.trace = attributes[:'trace']
86
+ end
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properties with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ if @status_code.nil?
94
+ invalid_properties.push('invalid value for "status_code", status_code cannot be nil.')
95
+ end
96
+
97
+ if @errors.nil?
98
+ invalid_properties.push('invalid value for "errors", errors cannot be nil.')
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 @status_code.nil?
108
+ return false if @errors.nil?
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ context == o.context &&
118
+ status_code == o.status_code &&
119
+ errors == o.errors &&
120
+ trace == o.trace
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [context, status_code, errors, trace].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.openapi_types.each_pair do |key, type|
148
+ if type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
157
+ self.send("#{key}=", nil)
158
+ end
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :DateTime
171
+ DateTime.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :Boolean
181
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ IbmCloudIam.const_get(type).build_from_hash(value)
202
+ end
203
+ end
204
+
205
+ # Returns the string representation of the object
206
+ # @return [String] String presentation of the object
207
+ def to_s
208
+ to_hash.to_s
209
+ end
210
+
211
+ # to_body is an alias to to_hash (backward compatibility)
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_body
214
+ to_hash
215
+ end
216
+
217
+ # Returns the object in the form of hash
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #IAM Identity Services API
3
+
4
+ #The IAM Identity Service API allows for the management of Identities (Service IDs, ApiKeys).
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-beta2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module IbmCloudIam
16
+ # Context fill with key properties for problem determination.
17
+ class ExceptionResponseContext
18
+ # The request ID of the inbound REST request.
19
+ attr_accessor :request_id
20
+
21
+ # The request type of the inbound REST request.
22
+ attr_accessor :request_type
23
+
24
+ # The user agent of the inbound REST request.
25
+ attr_accessor :user_agent
26
+
27
+ # The URL of that cluster.
28
+ attr_accessor :url
29
+
30
+ # The instance ID of the server instance processing the request.
31
+ attr_accessor :instance_id
32
+
33
+ # The thread ID of the server instance processing the request.
34
+ attr_accessor :thread_id
35
+
36
+ # The host of the server instance processing the request.
37
+ attr_accessor :host
38
+
39
+ # The start time of the request.
40
+ attr_accessor :start_time
41
+
42
+ # The finish time of the request.
43
+ attr_accessor :end_time
44
+
45
+ # The elapsed time in msec.
46
+ attr_accessor :elapsed_time
47
+
48
+ # The language used to present the error message.
49
+ attr_accessor :locale
50
+
51
+ # The cluster name.
52
+ attr_accessor :cluster_name
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'request_id' => :'requestId',
58
+ :'request_type' => :'requestType',
59
+ :'user_agent' => :'userAgent',
60
+ :'url' => :'url',
61
+ :'instance_id' => :'instanceId',
62
+ :'thread_id' => :'threadId',
63
+ :'host' => :'host',
64
+ :'start_time' => :'startTime',
65
+ :'end_time' => :'endTime',
66
+ :'elapsed_time' => :'elapsedTime',
67
+ :'locale' => :'locale',
68
+ :'cluster_name' => :'clusterName'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.openapi_types
74
+ {
75
+ :'request_id' => :'String',
76
+ :'request_type' => :'String',
77
+ :'user_agent' => :'String',
78
+ :'url' => :'String',
79
+ :'instance_id' => :'String',
80
+ :'thread_id' => :'String',
81
+ :'host' => :'String',
82
+ :'start_time' => :'String',
83
+ :'end_time' => :'String',
84
+ :'elapsed_time' => :'String',
85
+ :'locale' => :'String',
86
+ :'cluster_name' => :'String'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IbmCloudIam::ExceptionResponseContext` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IbmCloudIam::ExceptionResponseContext`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'request_id')
112
+ self.request_id = attributes[:'request_id']
113
+ end
114
+
115
+ if attributes.key?(:'request_type')
116
+ self.request_type = attributes[:'request_type']
117
+ end
118
+
119
+ if attributes.key?(:'user_agent')
120
+ self.user_agent = attributes[:'user_agent']
121
+ end
122
+
123
+ if attributes.key?(:'url')
124
+ self.url = attributes[:'url']
125
+ end
126
+
127
+ if attributes.key?(:'instance_id')
128
+ self.instance_id = attributes[:'instance_id']
129
+ end
130
+
131
+ if attributes.key?(:'thread_id')
132
+ self.thread_id = attributes[:'thread_id']
133
+ end
134
+
135
+ if attributes.key?(:'host')
136
+ self.host = attributes[:'host']
137
+ end
138
+
139
+ if attributes.key?(:'start_time')
140
+ self.start_time = attributes[:'start_time']
141
+ end
142
+
143
+ if attributes.key?(:'end_time')
144
+ self.end_time = attributes[:'end_time']
145
+ end
146
+
147
+ if attributes.key?(:'elapsed_time')
148
+ self.elapsed_time = attributes[:'elapsed_time']
149
+ end
150
+
151
+ if attributes.key?(:'locale')
152
+ self.locale = attributes[:'locale']
153
+ end
154
+
155
+ if attributes.key?(:'cluster_name')
156
+ self.cluster_name = attributes[:'cluster_name']
157
+ end
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properties with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = Array.new
164
+ invalid_properties
165
+ end
166
+
167
+ # Check to see if the all the properties in the model are valid
168
+ # @return true if the model is valid
169
+ def valid?
170
+ true
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ request_id == o.request_id &&
179
+ request_type == o.request_type &&
180
+ user_agent == o.user_agent &&
181
+ url == o.url &&
182
+ instance_id == o.instance_id &&
183
+ thread_id == o.thread_id &&
184
+ host == o.host &&
185
+ start_time == o.start_time &&
186
+ end_time == o.end_time &&
187
+ elapsed_time == o.elapsed_time &&
188
+ locale == o.locale &&
189
+ cluster_name == o.cluster_name
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [request_id, request_type, user_agent, url, instance_id, thread_id, host, start_time, end_time, elapsed_time, locale, cluster_name].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ new.build_from_hash(attributes)
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ self.class.openapi_types.each_pair do |key, type|
217
+ if type =~ /\AArray<(.*)>/i
218
+ # check to ensure the input is an array given that the attribute
219
+ # is documented as an array but the input is not
220
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
221
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
226
+ self.send("#{key}=", nil)
227
+ end
228
+ end
229
+
230
+ self
231
+ end
232
+
233
+ # Deserializes the data based on type
234
+ # @param string type Data type
235
+ # @param string value Value to be deserialized
236
+ # @return [Object] Deserialized data
237
+ def _deserialize(type, value)
238
+ case type.to_sym
239
+ when :DateTime
240
+ DateTime.parse(value)
241
+ when :Date
242
+ Date.parse(value)
243
+ when :String
244
+ value.to_s
245
+ when :Integer
246
+ value.to_i
247
+ when :Float
248
+ value.to_f
249
+ when :Boolean
250
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
251
+ true
252
+ else
253
+ false
254
+ end
255
+ when :Object
256
+ # generic object (usually a Hash), return directly
257
+ value
258
+ when /\AArray<(?<inner_type>.+)>\z/
259
+ inner_type = Regexp.last_match[:inner_type]
260
+ value.map { |v| _deserialize(inner_type, v) }
261
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
262
+ k_type = Regexp.last_match[:k_type]
263
+ v_type = Regexp.last_match[:v_type]
264
+ {}.tap do |hash|
265
+ value.each do |k, v|
266
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
267
+ end
268
+ end
269
+ else # model
270
+ IbmCloudIam.const_get(type).build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ if value.nil?
293
+ is_nullable = self.class.openapi_nullable.include?(attr)
294
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
295
+ end
296
+
297
+ hash[param] = _to_hash(value)
298
+ end
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to? :to_hash
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+ end
320
+ end