bandwidth-sdk 14.0.0 → 14.1.1

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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +10 -10
  3. data/README.md +42 -10
  4. data/bandwidth.yml +1113 -0
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +1204 -231
  7. data/coverage/index.html +20499 -10053
  8. data/custom_templates/README.mustache +6 -6
  9. data/docs/AdditionalDenialReason.md +22 -0
  10. data/docs/Address.md +30 -0
  11. data/docs/Contact.md +24 -0
  12. data/docs/Error.md +22 -0
  13. data/docs/FailureWebhook.md +28 -0
  14. data/docs/InitiateCallback.md +3 -1
  15. data/docs/LinksObject.md +24 -0
  16. data/docs/OptInWorkflow.md +20 -0
  17. data/docs/TelephoneNumber.md +18 -0
  18. data/docs/TfvBasicAuthentication.md +20 -0
  19. data/docs/{PublishPermissionsEnum.md → TfvCallbackStatusEnum.md} +2 -2
  20. data/docs/TfvError.md +22 -0
  21. data/docs/TfvStatus.md +32 -0
  22. data/docs/{DeviceApiVersionEnum.md → TfvStatusEnum.md} +2 -2
  23. data/docs/TfvSubmissionInfo.md +34 -0
  24. data/docs/TfvSubmissionWrapper.md +18 -0
  25. data/docs/TollFreeVerificationApi.md +585 -0
  26. data/docs/VerificationDenialWebhook.md +32 -0
  27. data/docs/VerificationRequest.md +36 -0
  28. data/docs/VerificationUpdateRequest.md +34 -0
  29. data/docs/VerificationWebhook.md +24 -0
  30. data/docs/WebhookSubscription.md +30 -0
  31. data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
  32. data/docs/WebhookSubscriptionRequestSchema.md +22 -0
  33. data/docs/WebhookSubscriptionTypeEnum.md +15 -0
  34. data/docs/WebhookSubscriptionsListBody.md +22 -0
  35. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
  36. data/lib/bandwidth-sdk/configuration.rb +48 -0
  37. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
  38. data/lib/bandwidth-sdk/models/address.rb +501 -0
  39. data/lib/bandwidth-sdk/models/contact.rb +393 -0
  40. data/lib/bandwidth-sdk/models/error.rb +232 -0
  41. data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
  42. data/lib/bandwidth-sdk/models/initiate_callback.rb +33 -4
  43. data/lib/bandwidth-sdk/models/links_object.rb +243 -0
  44. data/lib/bandwidth-sdk/models/opt_in_workflow.rb +265 -0
  45. data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
  46. data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +273 -0
  47. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
  48. data/lib/bandwidth-sdk/models/tfv_error.rb +232 -0
  49. data/lib/bandwidth-sdk/models/tfv_status.rb +342 -0
  50. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
  51. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
  52. data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +212 -0
  53. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
  54. data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
  55. data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
  56. data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
  57. data/lib/bandwidth-sdk/models/webhook_subscription.rb +328 -0
  58. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
  59. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
  60. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
  61. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
  62. data/lib/bandwidth-sdk/version.rb +1 -1
  63. data/lib/bandwidth-sdk.rb +25 -0
  64. data/openapi-config.yml +1 -1
  65. data/spec/call_utils.rb +2 -2
  66. data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
  67. data/spec/spec_helper.rb +1 -1
  68. data/spec/unit/api/mfa_api_spec.rb +1 -1
  69. data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
  70. data/spec/unit/client/api_client_spec.rb +1 -1
  71. metadata +91 -61
  72. data/docs/CreateParticipantRequest.md +0 -24
  73. data/docs/CreateParticipantResponse.md +0 -20
  74. data/docs/DisconenctCallback.md +0 -50
  75. data/docs/ForbiddenRequest.md +0 -18
  76. data/docs/InboundMessageCallback.md +0 -26
  77. data/docs/InboundMessageCallbackMessage.md +0 -40
  78. data/docs/MessageDeliveredCallback.md +0 -26
  79. data/docs/MessageDeliveredCallbackMessage.md +0 -40
  80. data/docs/MessageFailedCallback.md +0 -28
  81. data/docs/MessageFailedCallbackMessage.md +0 -40
  82. data/docs/MessageSendingCallback.md +0 -26
  83. data/docs/MessageSendingCallbackMessage.md +0 -40
  84. data/docs/Participant.md +0 -30
  85. data/docs/ParticipantSubscription.md +0 -20
  86. data/docs/ParticipantsApi.md +0 -227
  87. data/docs/RequestError.md +0 -20
  88. data/docs/Session.md +0 -20
  89. data/docs/SessionsApi.md +0 -605
  90. data/docs/Subscriptions.md +0 -20
  91. data/docs/TranscriptionList.md +0 -18
  92. data/docs/TranscriptionMetadata.md +0 -24
  93. data/docs/UnauthorizedRequest.md +0 -18
@@ -0,0 +1,273 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class TfvBasicAuthentication
18
+ attr_accessor :username
19
+
20
+ attr_accessor :password
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'username' => :'username',
26
+ :'password' => :'password'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'username' => :'String',
39
+ :'password' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::TfvBasicAuthentication` initialize method'
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::TfvBasicAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'username')
65
+ self.username = attributes[:'username']
66
+ else
67
+ self.username = nil
68
+ end
69
+
70
+ if attributes.key?(:'password')
71
+ self.password = attributes[:'password']
72
+ else
73
+ self.password = nil
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @username.nil?
83
+ invalid_properties.push('invalid value for "username", username cannot be nil.')
84
+ end
85
+
86
+ if @username.to_s.length > 100
87
+ invalid_properties.push('invalid value for "username", the character length must be smaller than or equal to 100.')
88
+ end
89
+
90
+ if @password.nil?
91
+ invalid_properties.push('invalid value for "password", password cannot be nil.')
92
+ end
93
+
94
+ if @password.to_s.length > 200
95
+ invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 200.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ return false if @username.nil?
106
+ return false if @username.to_s.length > 100
107
+ return false if @password.nil?
108
+ return false if @password.to_s.length > 200
109
+ true
110
+ end
111
+
112
+ # Custom attribute writer method with validation
113
+ # @param [Object] username Value to be assigned
114
+ def username=(username)
115
+ if username.nil?
116
+ fail ArgumentError, 'username cannot be nil'
117
+ end
118
+
119
+ if username.to_s.length > 100
120
+ fail ArgumentError, 'invalid value for "username", the character length must be smaller than or equal to 100.'
121
+ end
122
+
123
+ @username = username
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] password Value to be assigned
128
+ def password=(password)
129
+ if password.nil?
130
+ fail ArgumentError, 'password cannot be nil'
131
+ end
132
+
133
+ if password.to_s.length > 200
134
+ fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 200.'
135
+ end
136
+
137
+ @password = password
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ username == o.username &&
146
+ password == o.password
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [username, password].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ transformed_hash = {}
168
+ openapi_types.each_pair do |key, type|
169
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = nil
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[attribute_map[key]].is_a?(Array)
175
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
176
+ end
177
+ elsif !attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
179
+ end
180
+ end
181
+ new(transformed_hash)
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def self._deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Bandwidth.const_get(type)
223
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+ end
273
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class TfvCallbackStatusEnum
18
+ VERIFIED = 'VERIFIED'.freeze
19
+ UNVERIFIED = 'UNVERIFIED'.freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [VERIFIED, UNVERIFIED].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if TfvCallbackStatusEnum.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #TfvCallbackStatusEnum"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,232 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ # A generic error object.
18
+ class TfvError
19
+ attr_accessor :type
20
+
21
+ attr_accessor :description
22
+
23
+ # Each key of this errors object refers to a field of the submitted object (using dot notation for nested objects), with the field being a key to an array of one or more errors for that field.
24
+ attr_accessor :errors
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'type' => :'type',
30
+ :'description' => :'description',
31
+ :'errors' => :'errors'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'type' => :'String',
44
+ :'description' => :'String',
45
+ :'errors' => :'Object'
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 `Bandwidth::TfvError` 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 `Bandwidth::TfvError`. 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?(:'type')
71
+ self.type = attributes[:'type']
72
+ end
73
+
74
+ if attributes.key?(:'description')
75
+ self.description = attributes[:'description']
76
+ end
77
+
78
+ if attributes.key?(:'errors')
79
+ self.errors = attributes[:'errors']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ warn '[DEPRECATED] the `valid?` method is obsolete'
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
+ type == o.type &&
104
+ description == o.description &&
105
+ errors == o.errors
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [type, description, errors].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ transformed_hash = {}
127
+ openapi_types.each_pair do |key, type|
128
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
129
+ transformed_hash["#{key}"] = nil
130
+ elsif type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[attribute_map[key]].is_a?(Array)
134
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
135
+ end
136
+ elsif !attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
138
+ end
139
+ end
140
+ new(transformed_hash)
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def self._deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Bandwidth.const_get(type)
182
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+ end
232
+ end