bandwidth-sdk 14.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +9 -9
  3. data/README.md +42 -10
  4. data/bandwidth.yml +1102 -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/LinksObject.md +24 -0
  15. data/docs/OptInWorkflow.md +20 -0
  16. data/docs/TelephoneNumber.md +18 -0
  17. data/docs/TfvBasicAuthentication.md +20 -0
  18. data/docs/TfvCallbackStatusEnum.md +15 -0
  19. data/docs/TfvError.md +22 -0
  20. data/docs/TfvStatus.md +32 -0
  21. data/docs/TfvStatusEnum.md +15 -0
  22. data/docs/TfvSubmissionInfo.md +34 -0
  23. data/docs/TfvSubmissionWrapper.md +18 -0
  24. data/docs/TollFreeVerificationApi.md +585 -0
  25. data/docs/VerificationDenialWebhook.md +32 -0
  26. data/docs/VerificationRequest.md +36 -0
  27. data/docs/VerificationUpdateRequest.md +34 -0
  28. data/docs/VerificationWebhook.md +24 -0
  29. data/docs/WebhookSubscription.md +30 -0
  30. data/docs/WebhookSubscriptionBasicAuthentication.md +20 -0
  31. data/docs/WebhookSubscriptionRequestSchema.md +22 -0
  32. data/docs/WebhookSubscriptionTypeEnum.md +15 -0
  33. data/docs/WebhookSubscriptionsListBody.md +22 -0
  34. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +614 -0
  35. data/lib/bandwidth-sdk/configuration.rb +48 -0
  36. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +254 -0
  37. data/lib/bandwidth-sdk/models/address.rb +501 -0
  38. data/lib/bandwidth-sdk/models/contact.rb +393 -0
  39. data/lib/bandwidth-sdk/models/error.rb +232 -0
  40. data/lib/bandwidth-sdk/models/failure_webhook.rb +304 -0
  41. data/lib/bandwidth-sdk/models/links_object.rb +243 -0
  42. data/lib/bandwidth-sdk/models/opt_in_workflow.rb +265 -0
  43. data/lib/bandwidth-sdk/models/telephone_number.rb +213 -0
  44. data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +273 -0
  45. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +40 -0
  46. data/lib/bandwidth-sdk/models/tfv_error.rb +232 -0
  47. data/lib/bandwidth-sdk/models/tfv_status.rb +342 -0
  48. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +43 -0
  49. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +452 -0
  50. data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +212 -0
  51. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +325 -0
  52. data/lib/bandwidth-sdk/models/verification_request.rb +547 -0
  53. data/lib/bandwidth-sdk/models/verification_update_request.rb +501 -0
  54. data/lib/bandwidth-sdk/models/verification_webhook.rb +303 -0
  55. data/lib/bandwidth-sdk/models/webhook_subscription.rb +328 -0
  56. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +274 -0
  57. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +306 -0
  58. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +40 -0
  59. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +242 -0
  60. data/lib/bandwidth-sdk/version.rb +1 -1
  61. data/lib/bandwidth-sdk.rb +25 -0
  62. data/openapi-config.yml +1 -1
  63. data/spec/call_utils.rb +2 -2
  64. data/spec/smoke/toll_free_verification_api_spec.rb +69 -0
  65. data/spec/spec_helper.rb +1 -1
  66. data/spec/unit/api/mfa_api_spec.rb +1 -1
  67. data/spec/unit/api/toll_free_verification_api_spec.rb +278 -0
  68. data/spec/unit/client/api_client_spec.rb +1 -1
  69. metadata +100 -46
@@ -0,0 +1,547 @@
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 VerificationRequest
18
+ attr_accessor :business_address
19
+
20
+ attr_accessor :business_contact
21
+
22
+ # Estimated monthly volume of messages from the toll-free number.
23
+ attr_accessor :message_volume
24
+
25
+ attr_accessor :phone_numbers
26
+
27
+ # The category of the use case.
28
+ attr_accessor :use_case
29
+
30
+ # A general idea of the use case and customer.
31
+ attr_accessor :use_case_summary
32
+
33
+ # Example of message content.
34
+ attr_accessor :production_message_content
35
+
36
+ attr_accessor :opt_in_workflow
37
+
38
+ # Any additional information.
39
+ attr_accessor :additional_information
40
+
41
+ # ISV name.
42
+ attr_accessor :isv_reseller
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'business_address' => :'businessAddress',
48
+ :'business_contact' => :'businessContact',
49
+ :'message_volume' => :'messageVolume',
50
+ :'phone_numbers' => :'phoneNumbers',
51
+ :'use_case' => :'useCase',
52
+ :'use_case_summary' => :'useCaseSummary',
53
+ :'production_message_content' => :'productionMessageContent',
54
+ :'opt_in_workflow' => :'optInWorkflow',
55
+ :'additional_information' => :'additionalInformation',
56
+ :'isv_reseller' => :'isvReseller'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'business_address' => :'Address',
69
+ :'business_contact' => :'Contact',
70
+ :'message_volume' => :'Integer',
71
+ :'phone_numbers' => :'Array<String>',
72
+ :'use_case' => :'String',
73
+ :'use_case_summary' => :'String',
74
+ :'production_message_content' => :'String',
75
+ :'opt_in_workflow' => :'OptInWorkflow',
76
+ :'additional_information' => :'String',
77
+ :'isv_reseller' => :'String'
78
+ }
79
+ end
80
+
81
+ # List of attributes with nullable: true
82
+ def self.openapi_nullable
83
+ Set.new([
84
+ :'additional_information',
85
+ :'isv_reseller'
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::VerificationRequest` initialize method'
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::VerificationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'business_address')
105
+ self.business_address = attributes[:'business_address']
106
+ else
107
+ self.business_address = nil
108
+ end
109
+
110
+ if attributes.key?(:'business_contact')
111
+ self.business_contact = attributes[:'business_contact']
112
+ else
113
+ self.business_contact = nil
114
+ end
115
+
116
+ if attributes.key?(:'message_volume')
117
+ self.message_volume = attributes[:'message_volume']
118
+ else
119
+ self.message_volume = nil
120
+ end
121
+
122
+ if attributes.key?(:'phone_numbers')
123
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
124
+ self.phone_numbers = value
125
+ end
126
+ else
127
+ self.phone_numbers = nil
128
+ end
129
+
130
+ if attributes.key?(:'use_case')
131
+ self.use_case = attributes[:'use_case']
132
+ else
133
+ self.use_case = nil
134
+ end
135
+
136
+ if attributes.key?(:'use_case_summary')
137
+ self.use_case_summary = attributes[:'use_case_summary']
138
+ else
139
+ self.use_case_summary = nil
140
+ end
141
+
142
+ if attributes.key?(:'production_message_content')
143
+ self.production_message_content = attributes[:'production_message_content']
144
+ else
145
+ self.production_message_content = nil
146
+ end
147
+
148
+ if attributes.key?(:'opt_in_workflow')
149
+ self.opt_in_workflow = attributes[:'opt_in_workflow']
150
+ else
151
+ self.opt_in_workflow = nil
152
+ end
153
+
154
+ if attributes.key?(:'additional_information')
155
+ self.additional_information = attributes[:'additional_information']
156
+ end
157
+
158
+ if attributes.key?(:'isv_reseller')
159
+ self.isv_reseller = attributes[:'isv_reseller']
160
+ end
161
+ end
162
+
163
+ # Show invalid properties with the reasons. Usually used together with valid?
164
+ # @return Array for valid properties with the reasons
165
+ def list_invalid_properties
166
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
167
+ invalid_properties = Array.new
168
+ if @business_address.nil?
169
+ invalid_properties.push('invalid value for "business_address", business_address cannot be nil.')
170
+ end
171
+
172
+ if @business_contact.nil?
173
+ invalid_properties.push('invalid value for "business_contact", business_contact cannot be nil.')
174
+ end
175
+
176
+ if @message_volume.nil?
177
+ invalid_properties.push('invalid value for "message_volume", message_volume cannot be nil.')
178
+ end
179
+
180
+ if @message_volume > 10000000
181
+ invalid_properties.push('invalid value for "message_volume", must be smaller than or equal to 10000000.')
182
+ end
183
+
184
+ if @message_volume < 10
185
+ invalid_properties.push('invalid value for "message_volume", must be greater than or equal to 10.')
186
+ end
187
+
188
+ if @phone_numbers.nil?
189
+ invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
190
+ end
191
+
192
+ if @phone_numbers.length > 10
193
+ invalid_properties.push('invalid value for "phone_numbers", number of items must be less than or equal to 10.')
194
+ end
195
+
196
+ if @phone_numbers.length < 1
197
+ invalid_properties.push('invalid value for "phone_numbers", number of items must be greater than or equal to 1.')
198
+ end
199
+
200
+ if @use_case.nil?
201
+ invalid_properties.push('invalid value for "use_case", use_case cannot be nil.')
202
+ end
203
+
204
+ if @use_case.to_s.length > 500
205
+ invalid_properties.push('invalid value for "use_case", the character length must be smaller than or equal to 500.')
206
+ end
207
+
208
+ if @use_case.to_s.length < 0
209
+ invalid_properties.push('invalid value for "use_case", the character length must be great than or equal to 0.')
210
+ end
211
+
212
+ if @use_case_summary.nil?
213
+ invalid_properties.push('invalid value for "use_case_summary", use_case_summary cannot be nil.')
214
+ end
215
+
216
+ if @use_case_summary.to_s.length > 500
217
+ invalid_properties.push('invalid value for "use_case_summary", the character length must be smaller than or equal to 500.')
218
+ end
219
+
220
+ if @use_case_summary.to_s.length < 1
221
+ invalid_properties.push('invalid value for "use_case_summary", the character length must be great than or equal to 1.')
222
+ end
223
+
224
+ if @production_message_content.nil?
225
+ invalid_properties.push('invalid value for "production_message_content", production_message_content cannot be nil.')
226
+ end
227
+
228
+ if @production_message_content.to_s.length > 500
229
+ invalid_properties.push('invalid value for "production_message_content", the character length must be smaller than or equal to 500.')
230
+ end
231
+
232
+ if @production_message_content.to_s.length < 1
233
+ invalid_properties.push('invalid value for "production_message_content", the character length must be great than or equal to 1.')
234
+ end
235
+
236
+ if @opt_in_workflow.nil?
237
+ invalid_properties.push('invalid value for "opt_in_workflow", opt_in_workflow cannot be nil.')
238
+ end
239
+
240
+ if !@additional_information.nil? && @additional_information.to_s.length > 500
241
+ invalid_properties.push('invalid value for "additional_information", the character length must be smaller than or equal to 500.')
242
+ end
243
+
244
+ if !@additional_information.nil? && @additional_information.to_s.length < 0
245
+ invalid_properties.push('invalid value for "additional_information", the character length must be great than or equal to 0.')
246
+ end
247
+
248
+ if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
249
+ invalid_properties.push('invalid value for "isv_reseller", the character length must be smaller than or equal to 500.')
250
+ end
251
+
252
+ if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
253
+ invalid_properties.push('invalid value for "isv_reseller", the character length must be great than or equal to 0.')
254
+ end
255
+
256
+ invalid_properties
257
+ end
258
+
259
+ # Check to see if the all the properties in the model are valid
260
+ # @return true if the model is valid
261
+ def valid?
262
+ warn '[DEPRECATED] the `valid?` method is obsolete'
263
+ return false if @business_address.nil?
264
+ return false if @business_contact.nil?
265
+ return false if @message_volume.nil?
266
+ return false if @message_volume > 10000000
267
+ return false if @message_volume < 10
268
+ return false if @phone_numbers.nil?
269
+ return false if @phone_numbers.length > 10
270
+ return false if @phone_numbers.length < 1
271
+ return false if @use_case.nil?
272
+ return false if @use_case.to_s.length > 500
273
+ return false if @use_case.to_s.length < 0
274
+ return false if @use_case_summary.nil?
275
+ return false if @use_case_summary.to_s.length > 500
276
+ return false if @use_case_summary.to_s.length < 1
277
+ return false if @production_message_content.nil?
278
+ return false if @production_message_content.to_s.length > 500
279
+ return false if @production_message_content.to_s.length < 1
280
+ return false if @opt_in_workflow.nil?
281
+ return false if !@additional_information.nil? && @additional_information.to_s.length > 500
282
+ return false if !@additional_information.nil? && @additional_information.to_s.length < 0
283
+ return false if !@isv_reseller.nil? && @isv_reseller.to_s.length > 500
284
+ return false if !@isv_reseller.nil? && @isv_reseller.to_s.length < 0
285
+ true
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] message_volume Value to be assigned
290
+ def message_volume=(message_volume)
291
+ if message_volume.nil?
292
+ fail ArgumentError, 'message_volume cannot be nil'
293
+ end
294
+
295
+ if message_volume > 10000000
296
+ fail ArgumentError, 'invalid value for "message_volume", must be smaller than or equal to 10000000.'
297
+ end
298
+
299
+ if message_volume < 10
300
+ fail ArgumentError, 'invalid value for "message_volume", must be greater than or equal to 10.'
301
+ end
302
+
303
+ @message_volume = message_volume
304
+ end
305
+
306
+ # Custom attribute writer method with validation
307
+ # @param [Object] phone_numbers Value to be assigned
308
+ def phone_numbers=(phone_numbers)
309
+ if phone_numbers.nil?
310
+ fail ArgumentError, 'phone_numbers cannot be nil'
311
+ end
312
+
313
+ if phone_numbers.length > 10
314
+ fail ArgumentError, 'invalid value for "phone_numbers", number of items must be less than or equal to 10.'
315
+ end
316
+
317
+ if phone_numbers.length < 1
318
+ fail ArgumentError, 'invalid value for "phone_numbers", number of items must be greater than or equal to 1.'
319
+ end
320
+
321
+ @phone_numbers = phone_numbers
322
+ end
323
+
324
+ # Custom attribute writer method with validation
325
+ # @param [Object] use_case Value to be assigned
326
+ def use_case=(use_case)
327
+ if use_case.nil?
328
+ fail ArgumentError, 'use_case cannot be nil'
329
+ end
330
+
331
+ if use_case.to_s.length > 500
332
+ fail ArgumentError, 'invalid value for "use_case", the character length must be smaller than or equal to 500.'
333
+ end
334
+
335
+ if use_case.to_s.length < 0
336
+ fail ArgumentError, 'invalid value for "use_case", the character length must be great than or equal to 0.'
337
+ end
338
+
339
+ @use_case = use_case
340
+ end
341
+
342
+ # Custom attribute writer method with validation
343
+ # @param [Object] use_case_summary Value to be assigned
344
+ def use_case_summary=(use_case_summary)
345
+ if use_case_summary.nil?
346
+ fail ArgumentError, 'use_case_summary cannot be nil'
347
+ end
348
+
349
+ if use_case_summary.to_s.length > 500
350
+ fail ArgumentError, 'invalid value for "use_case_summary", the character length must be smaller than or equal to 500.'
351
+ end
352
+
353
+ if use_case_summary.to_s.length < 1
354
+ fail ArgumentError, 'invalid value for "use_case_summary", the character length must be great than or equal to 1.'
355
+ end
356
+
357
+ @use_case_summary = use_case_summary
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] production_message_content Value to be assigned
362
+ def production_message_content=(production_message_content)
363
+ if production_message_content.nil?
364
+ fail ArgumentError, 'production_message_content cannot be nil'
365
+ end
366
+
367
+ if production_message_content.to_s.length > 500
368
+ fail ArgumentError, 'invalid value for "production_message_content", the character length must be smaller than or equal to 500.'
369
+ end
370
+
371
+ if production_message_content.to_s.length < 1
372
+ fail ArgumentError, 'invalid value for "production_message_content", the character length must be great than or equal to 1.'
373
+ end
374
+
375
+ @production_message_content = production_message_content
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] additional_information Value to be assigned
380
+ def additional_information=(additional_information)
381
+ if !additional_information.nil? && additional_information.to_s.length > 500
382
+ fail ArgumentError, 'invalid value for "additional_information", the character length must be smaller than or equal to 500.'
383
+ end
384
+
385
+ if !additional_information.nil? && additional_information.to_s.length < 0
386
+ fail ArgumentError, 'invalid value for "additional_information", the character length must be great than or equal to 0.'
387
+ end
388
+
389
+ @additional_information = additional_information
390
+ end
391
+
392
+ # Custom attribute writer method with validation
393
+ # @param [Object] isv_reseller Value to be assigned
394
+ def isv_reseller=(isv_reseller)
395
+ if !isv_reseller.nil? && isv_reseller.to_s.length > 500
396
+ fail ArgumentError, 'invalid value for "isv_reseller", the character length must be smaller than or equal to 500.'
397
+ end
398
+
399
+ if !isv_reseller.nil? && isv_reseller.to_s.length < 0
400
+ fail ArgumentError, 'invalid value for "isv_reseller", the character length must be great than or equal to 0.'
401
+ end
402
+
403
+ @isv_reseller = isv_reseller
404
+ end
405
+
406
+ # Checks equality by comparing each attribute.
407
+ # @param [Object] Object to be compared
408
+ def ==(o)
409
+ return true if self.equal?(o)
410
+ self.class == o.class &&
411
+ business_address == o.business_address &&
412
+ business_contact == o.business_contact &&
413
+ message_volume == o.message_volume &&
414
+ phone_numbers == o.phone_numbers &&
415
+ use_case == o.use_case &&
416
+ use_case_summary == o.use_case_summary &&
417
+ production_message_content == o.production_message_content &&
418
+ opt_in_workflow == o.opt_in_workflow &&
419
+ additional_information == o.additional_information &&
420
+ isv_reseller == o.isv_reseller
421
+ end
422
+
423
+ # @see the `==` method
424
+ # @param [Object] Object to be compared
425
+ def eql?(o)
426
+ self == o
427
+ end
428
+
429
+ # Calculates hash code according to all attributes.
430
+ # @return [Integer] Hash code
431
+ def hash
432
+ [business_address, business_contact, message_volume, phone_numbers, use_case, use_case_summary, production_message_content, opt_in_workflow, additional_information, isv_reseller].hash
433
+ end
434
+
435
+ # Builds the object from hash
436
+ # @param [Hash] attributes Model attributes in the form of hash
437
+ # @return [Object] Returns the model itself
438
+ def self.build_from_hash(attributes)
439
+ return nil unless attributes.is_a?(Hash)
440
+ attributes = attributes.transform_keys(&:to_sym)
441
+ transformed_hash = {}
442
+ openapi_types.each_pair do |key, type|
443
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
444
+ transformed_hash["#{key}"] = nil
445
+ elsif type =~ /\AArray<(.*)>/i
446
+ # check to ensure the input is an array given that the attribute
447
+ # is documented as an array but the input is not
448
+ if attributes[attribute_map[key]].is_a?(Array)
449
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
450
+ end
451
+ elsif !attributes[attribute_map[key]].nil?
452
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
453
+ end
454
+ end
455
+ new(transformed_hash)
456
+ end
457
+
458
+ # Deserializes the data based on type
459
+ # @param string type Data type
460
+ # @param string value Value to be deserialized
461
+ # @return [Object] Deserialized data
462
+ def self._deserialize(type, value)
463
+ case type.to_sym
464
+ when :Time
465
+ Time.parse(value)
466
+ when :Date
467
+ Date.parse(value)
468
+ when :String
469
+ value.to_s
470
+ when :Integer
471
+ value.to_i
472
+ when :Float
473
+ value.to_f
474
+ when :Boolean
475
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
476
+ true
477
+ else
478
+ false
479
+ end
480
+ when :Object
481
+ # generic object (usually a Hash), return directly
482
+ value
483
+ when /\AArray<(?<inner_type>.+)>\z/
484
+ inner_type = Regexp.last_match[:inner_type]
485
+ value.map { |v| _deserialize(inner_type, v) }
486
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
487
+ k_type = Regexp.last_match[:k_type]
488
+ v_type = Regexp.last_match[:v_type]
489
+ {}.tap do |hash|
490
+ value.each do |k, v|
491
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
492
+ end
493
+ end
494
+ else # model
495
+ # models (e.g. Pet) or oneOf
496
+ klass = Bandwidth.const_get(type)
497
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
498
+ end
499
+ end
500
+
501
+ # Returns the string representation of the object
502
+ # @return [String] String presentation of the object
503
+ def to_s
504
+ to_hash.to_s
505
+ end
506
+
507
+ # to_body is an alias to to_hash (backward compatibility)
508
+ # @return [Hash] Returns the object in the form of hash
509
+ def to_body
510
+ to_hash
511
+ end
512
+
513
+ # Returns the object in the form of hash
514
+ # @return [Hash] Returns the object in the form of hash
515
+ def to_hash
516
+ hash = {}
517
+ self.class.attribute_map.each_pair do |attr, param|
518
+ value = self.send(attr)
519
+ if value.nil?
520
+ is_nullable = self.class.openapi_nullable.include?(attr)
521
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
522
+ end
523
+
524
+ hash[param] = _to_hash(value)
525
+ end
526
+ hash
527
+ end
528
+
529
+ # Outputs non-array value in the form of hash
530
+ # For object, use to_hash. Otherwise, just return the value
531
+ # @param [Object] value Any valid value
532
+ # @return [Hash] Returns the value in the form of hash
533
+ def _to_hash(value)
534
+ if value.is_a?(Array)
535
+ value.compact.map { |v| _to_hash(v) }
536
+ elsif value.is_a?(Hash)
537
+ {}.tap do |hash|
538
+ value.each { |k, v| hash[k] = _to_hash(v) }
539
+ end
540
+ elsif value.respond_to? :to_hash
541
+ value.to_hash
542
+ else
543
+ value
544
+ end
545
+ end
546
+ end
547
+ end