bandwidth-sdk 17.0.1 → 17.1.0

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 (229) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +18 -0
  4. data/bandwidth-sdk.gemspec +1 -2
  5. data/bandwidth.yml +7 -0
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +198 -387
  8. data/coverage/index.html +5842 -7703
  9. data/custom_templates/README.mustache +4 -1
  10. data/custom_templates/api_client.mustache +254 -0
  11. data/custom_templates/configuration.mustache +545 -0
  12. data/custom_templates/gem.mustache +2 -0
  13. data/docs/CallsApi.md +20 -5
  14. data/docs/ConferencesApi.md +36 -9
  15. data/docs/MFAApi.md +12 -3
  16. data/docs/MediaApi.md +16 -4
  17. data/docs/MessagesApi.md +8 -2
  18. data/docs/MultiChannelApi.md +4 -1
  19. data/docs/PhoneNumberLookupApi.md +12 -3
  20. data/docs/RecordingsApi.md +40 -10
  21. data/docs/StatisticsApi.md +4 -1
  22. data/docs/TollFreeVerificationApi.md +36 -9
  23. data/docs/TranscriptionsApi.md +12 -3
  24. data/lib/bandwidth-sdk/api/calls_api.rb +6 -6
  25. data/lib/bandwidth-sdk/api/conferences_api.rb +10 -10
  26. data/lib/bandwidth-sdk/api/media_api.rb +5 -5
  27. data/lib/bandwidth-sdk/api/messages_api.rb +3 -3
  28. data/lib/bandwidth-sdk/api/mfa_api.rb +4 -4
  29. data/lib/bandwidth-sdk/api/multi_channel_api.rb +2 -2
  30. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +4 -4
  31. data/lib/bandwidth-sdk/api/recordings_api.rb +11 -11
  32. data/lib/bandwidth-sdk/api/statistics_api.rb +2 -2
  33. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +13 -13
  34. data/lib/bandwidth-sdk/api/transcriptions_api.rb +4 -4
  35. data/lib/bandwidth-sdk/api_client.rb +9 -5
  36. data/lib/bandwidth-sdk/api_error.rb +1 -1
  37. data/lib/bandwidth-sdk/api_model_base.rb +88 -0
  38. data/lib/bandwidth-sdk/configuration.rb +50 -1
  39. data/lib/bandwidth-sdk/models/account_statistics.rb +11 -78
  40. data/lib/bandwidth-sdk/models/additional_denial_reason.rb +41 -78
  41. data/lib/bandwidth-sdk/models/address.rb +23 -90
  42. data/lib/bandwidth-sdk/models/answer_callback.rb +11 -78
  43. data/lib/bandwidth-sdk/models/async_lookup_request.rb +11 -78
  44. data/lib/bandwidth-sdk/models/blocked_webhook.rb +13 -80
  45. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +11 -78
  46. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +11 -78
  47. data/lib/bandwidth-sdk/models/business_entity_type_enum.rb +1 -1
  48. data/lib/bandwidth-sdk/models/business_registration_type_enum.rb +1 -1
  49. data/lib/bandwidth-sdk/models/call_direction_enum.rb +1 -1
  50. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +11 -78
  51. data/lib/bandwidth-sdk/models/call_state.rb +11 -78
  52. data/lib/bandwidth-sdk/models/call_state_enum.rb +1 -1
  53. data/lib/bandwidth-sdk/models/call_transcription.rb +11 -78
  54. data/lib/bandwidth-sdk/models/call_transcription_detected_language_enum.rb +1 -1
  55. data/lib/bandwidth-sdk/models/call_transcription_metadata.rb +11 -78
  56. data/lib/bandwidth-sdk/models/call_transcription_response.rb +11 -78
  57. data/lib/bandwidth-sdk/models/call_transcription_track_enum.rb +1 -1
  58. data/lib/bandwidth-sdk/models/callback.rb +1 -1
  59. data/lib/bandwidth-sdk/models/callback_method_enum.rb +1 -1
  60. data/lib/bandwidth-sdk/models/card_width_enum.rb +1 -1
  61. data/lib/bandwidth-sdk/models/code_request.rb +11 -78
  62. data/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb +1 -1
  63. data/lib/bandwidth-sdk/models/conference.rb +11 -78
  64. data/lib/bandwidth-sdk/models/conference_completed_callback.rb +11 -78
  65. data/lib/bandwidth-sdk/models/conference_created_callback.rb +11 -78
  66. data/lib/bandwidth-sdk/models/conference_member.rb +11 -78
  67. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +11 -78
  68. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +11 -78
  69. data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +11 -78
  70. data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +11 -78
  71. data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +11 -78
  72. data/lib/bandwidth-sdk/models/conference_state_enum.rb +1 -1
  73. data/lib/bandwidth-sdk/models/contact.rb +19 -86
  74. data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +11 -78
  75. data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response_data.rb +11 -78
  76. data/lib/bandwidth-sdk/models/create_call.rb +41 -78
  77. data/lib/bandwidth-sdk/models/create_call_response.rb +81 -78
  78. data/lib/bandwidth-sdk/models/create_message_request_error.rb +31 -78
  79. data/lib/bandwidth-sdk/models/create_multi_channel_message_response.rb +11 -78
  80. data/lib/bandwidth-sdk/models/create_sync_lookup_response.rb +11 -78
  81. data/lib/bandwidth-sdk/models/create_sync_lookup_response_data.rb +11 -78
  82. data/lib/bandwidth-sdk/models/deactivation_event_enum.rb +1 -1
  83. data/lib/bandwidth-sdk/models/disconnect_callback.rb +11 -78
  84. data/lib/bandwidth-sdk/models/diversion.rb +11 -78
  85. data/lib/bandwidth-sdk/models/dtmf_callback.rb +11 -78
  86. data/lib/bandwidth-sdk/models/error.rb +11 -78
  87. data/lib/bandwidth-sdk/models/error_object.rb +41 -78
  88. data/lib/bandwidth-sdk/models/error_source.rb +11 -78
  89. data/lib/bandwidth-sdk/models/failure_webhook.rb +13 -80
  90. data/lib/bandwidth-sdk/models/field_error.rb +11 -78
  91. data/lib/bandwidth-sdk/models/file_format_enum.rb +1 -1
  92. data/lib/bandwidth-sdk/models/gather_callback.rb +11 -78
  93. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +11 -78
  94. data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +11 -78
  95. data/lib/bandwidth-sdk/models/in_progress_lookup_status_enum.rb +1 -1
  96. data/lib/bandwidth-sdk/models/inbound_callback.rb +61 -78
  97. data/lib/bandwidth-sdk/models/inbound_callback_message.rb +81 -78
  98. data/lib/bandwidth-sdk/models/inbound_callback_type_enum.rb +1 -1
  99. data/lib/bandwidth-sdk/models/initiate_callback.rb +11 -78
  100. data/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +1 -1
  101. data/lib/bandwidth-sdk/models/line_type_enum.rb +1 -1
  102. data/lib/bandwidth-sdk/models/link.rb +11 -78
  103. data/lib/bandwidth-sdk/models/link_schema.rb +11 -78
  104. data/lib/bandwidth-sdk/models/links_object.rb +11 -78
  105. data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +1 -1
  106. data/lib/bandwidth-sdk/models/list_message_item.rb +11 -78
  107. data/lib/bandwidth-sdk/models/lookup_error_response.rb +11 -78
  108. data/lib/bandwidth-sdk/models/lookup_error_schema.rb +11 -78
  109. data/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb +11 -78
  110. data/lib/bandwidth-sdk/models/lookup_result.rb +11 -78
  111. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +11 -78
  112. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +11 -78
  113. data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +1 -1
  114. data/lib/bandwidth-sdk/models/machine_detection_result.rb +11 -78
  115. data/lib/bandwidth-sdk/models/media.rb +11 -78
  116. data/lib/bandwidth-sdk/models/message.rb +11 -78
  117. data/lib/bandwidth-sdk/models/message_direction_enum.rb +1 -1
  118. data/lib/bandwidth-sdk/models/message_request.rb +31 -78
  119. data/lib/bandwidth-sdk/models/message_status_enum.rb +1 -1
  120. data/lib/bandwidth-sdk/models/message_type_enum.rb +1 -1
  121. data/lib/bandwidth-sdk/models/messages_list.rb +11 -78
  122. data/lib/bandwidth-sdk/models/messaging_code_response.rb +11 -78
  123. data/lib/bandwidth-sdk/models/messaging_request_error.rb +31 -78
  124. data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +11 -78
  125. data/lib/bandwidth-sdk/models/mfa_request_error.rb +11 -78
  126. data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +11 -78
  127. data/lib/bandwidth-sdk/models/mms_message_content.rb +11 -78
  128. data/lib/bandwidth-sdk/models/mms_message_content_file.rb +11 -78
  129. data/lib/bandwidth-sdk/models/multi_channel_action.rb +3 -4
  130. data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +41 -78
  131. data/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_object.rb +51 -78
  132. data/lib/bandwidth-sdk/models/multi_channel_channel_list_mms_response_object.rb +61 -78
  133. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb +41 -78
  134. data/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb +21 -78
  135. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb +51 -78
  136. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content.rb +3 -4
  137. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb +61 -78
  138. data/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb +3 -4
  139. data/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb +3 -4
  140. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb +51 -78
  141. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb +61 -78
  142. data/lib/bandwidth-sdk/models/multi_channel_error.rb +11 -78
  143. data/lib/bandwidth-sdk/models/multi_channel_message_channel_enum.rb +1 -1
  144. data/lib/bandwidth-sdk/models/multi_channel_message_content.rb +11 -78
  145. data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +21 -78
  146. data/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +41 -78
  147. data/lib/bandwidth-sdk/models/opt_in_workflow.rb +25 -82
  148. data/lib/bandwidth-sdk/models/page_info.rb +11 -78
  149. data/lib/bandwidth-sdk/models/priority_enum.rb +1 -1
  150. data/lib/bandwidth-sdk/models/product_type_enum.rb +1 -1
  151. data/lib/bandwidth-sdk/models/rbm_action_base.rb +21 -78
  152. data/lib/bandwidth-sdk/models/rbm_action_dial.rb +31 -78
  153. data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +21 -78
  154. data/lib/bandwidth-sdk/models/rbm_action_type_enum.rb +1 -1
  155. data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +41 -78
  156. data/lib/bandwidth-sdk/models/rbm_card_content.rb +11 -78
  157. data/lib/bandwidth-sdk/models/rbm_card_content_media.rb +21 -78
  158. data/lib/bandwidth-sdk/models/rbm_location_response.rb +11 -78
  159. data/lib/bandwidth-sdk/models/rbm_media_height_enum.rb +1 -1
  160. data/lib/bandwidth-sdk/models/rbm_message_carousel_card.rb +21 -78
  161. data/lib/bandwidth-sdk/models/rbm_message_content_file.rb +11 -78
  162. data/lib/bandwidth-sdk/models/rbm_message_content_rich_card.rb +3 -4
  163. data/lib/bandwidth-sdk/models/rbm_message_content_text.rb +11 -78
  164. data/lib/bandwidth-sdk/models/rbm_message_media.rb +21 -78
  165. data/lib/bandwidth-sdk/models/rbm_standalone_card.rb +41 -78
  166. data/lib/bandwidth-sdk/models/rbm_suggestion_response.rb +11 -78
  167. data/lib/bandwidth-sdk/models/recording_available_callback.rb +11 -78
  168. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +11 -78
  169. data/lib/bandwidth-sdk/models/recording_state_enum.rb +1 -1
  170. data/lib/bandwidth-sdk/models/recording_transcription_metadata.rb +11 -78
  171. data/lib/bandwidth-sdk/models/recording_transcriptions.rb +11 -78
  172. data/lib/bandwidth-sdk/models/redirect_callback.rb +11 -78
  173. data/lib/bandwidth-sdk/models/redirect_method_enum.rb +1 -1
  174. data/lib/bandwidth-sdk/models/sms_message_content.rb +11 -78
  175. data/lib/bandwidth-sdk/models/standalone_card_orientation_enum.rb +1 -1
  176. data/lib/bandwidth-sdk/models/status_callback.rb +61 -78
  177. data/lib/bandwidth-sdk/models/status_callback_message.rb +81 -78
  178. data/lib/bandwidth-sdk/models/status_callback_type_enum.rb +6 -6
  179. data/lib/bandwidth-sdk/models/stir_shaken.rb +11 -78
  180. data/lib/bandwidth-sdk/models/sync_lookup_request.rb +11 -78
  181. data/lib/bandwidth-sdk/models/telephone_number.rb +11 -78
  182. data/lib/bandwidth-sdk/models/tfv_basic_authentication.rb +11 -78
  183. data/lib/bandwidth-sdk/models/tfv_callback_status_enum.rb +1 -1
  184. data/lib/bandwidth-sdk/models/tfv_error.rb +11 -78
  185. data/lib/bandwidth-sdk/models/tfv_status.rb +13 -80
  186. data/lib/bandwidth-sdk/models/tfv_status_enum.rb +1 -1
  187. data/lib/bandwidth-sdk/models/tfv_submission_info.rb +21 -88
  188. data/lib/bandwidth-sdk/models/tfv_submission_wrapper.rb +11 -78
  189. data/lib/bandwidth-sdk/models/thumbnail_alignment_enum.rb +1 -1
  190. data/lib/bandwidth-sdk/models/transcribe_recording.rb +11 -78
  191. data/lib/bandwidth-sdk/models/transcription.rb +11 -78
  192. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +11 -78
  193. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +11 -78
  194. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +11 -78
  195. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +11 -78
  196. data/lib/bandwidth-sdk/models/update_call.rb +11 -78
  197. data/lib/bandwidth-sdk/models/update_call_recording.rb +21 -78
  198. data/lib/bandwidth-sdk/models/update_conference.rb +11 -78
  199. data/lib/bandwidth-sdk/models/update_conference_member.rb +11 -78
  200. data/lib/bandwidth-sdk/models/verification_denial_webhook.rb +13 -80
  201. data/lib/bandwidth-sdk/models/verification_request.rb +51 -88
  202. data/lib/bandwidth-sdk/models/verification_update_request.rb +51 -88
  203. data/lib/bandwidth-sdk/models/verification_webhook.rb +13 -80
  204. data/lib/bandwidth-sdk/models/verify_code_request.rb +13 -80
  205. data/lib/bandwidth-sdk/models/verify_code_response.rb +11 -78
  206. data/lib/bandwidth-sdk/models/voice_api_error.rb +11 -78
  207. data/lib/bandwidth-sdk/models/voice_code_response.rb +11 -78
  208. data/lib/bandwidth-sdk/models/webhook_subscription.rb +13 -80
  209. data/lib/bandwidth-sdk/models/webhook_subscription_basic_authentication.rb +11 -78
  210. data/lib/bandwidth-sdk/models/webhook_subscription_request_schema.rb +15 -82
  211. data/lib/bandwidth-sdk/models/webhook_subscription_type_enum.rb +1 -1
  212. data/lib/bandwidth-sdk/models/webhook_subscriptions_list_body.rb +21 -78
  213. data/lib/bandwidth-sdk/version.rb +2 -2
  214. data/lib/bandwidth-sdk.rb +2 -1
  215. data/openapitools.json +1 -1
  216. data/spec/smoke/calls_api_spec.rb +50 -76
  217. data/spec/smoke/conferences_api_spec.rb +7 -5
  218. data/spec/smoke/media_api_spec.rb +4 -2
  219. data/spec/smoke/messages_api_spec.rb +9 -4
  220. data/spec/smoke/mfa_api_spec.rb +9 -4
  221. data/spec/smoke/multi_channel_api_spec.rb +4 -2
  222. data/spec/smoke/phone_number_lookup_api_spec.rb +6 -4
  223. data/spec/smoke/recordings_api_spec.rb +7 -33
  224. data/spec/smoke/statistics_api_spec.rb +16 -8
  225. data/spec/smoke/toll_free_verification_api_spec.rb +6 -4
  226. data/spec/smoke/transcriptions_api_spec.rb +7 -5
  227. data/spec/spec_helper.rb +2 -0
  228. data/spec/unit/models/verify_code_request_spec.rb +1 -1
  229. metadata +5 -2
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -74,7 +74,7 @@ module Bandwidth
74
74
  return_type = opts[:debug_return_type] || 'WebhookSubscription'
75
75
 
76
76
  # auth_names
77
- auth_names = opts[:debug_auth_names] || ['Basic']
77
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
78
78
 
79
79
  new_options = opts.merge(
80
80
  :operation => :"TollFreeVerificationApi.create_webhook_subscription",
@@ -127,7 +127,7 @@ module Bandwidth
127
127
  end
128
128
 
129
129
  if @api_client.config.client_side_validation && phone_number.to_s.length < 12
130
- fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be great than or equal to 12.'
130
+ fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.delete_verification_request, the character length must be greater than or equal to 12.'
131
131
  end
132
132
 
133
133
  pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
@@ -156,7 +156,7 @@ module Bandwidth
156
156
  return_type = opts[:debug_return_type]
157
157
 
158
158
  # auth_names
159
- auth_names = opts[:debug_auth_names] || ['Basic']
159
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
160
160
 
161
161
  new_options = opts.merge(
162
162
  :operation => :"TollFreeVerificationApi.delete_verification_request",
@@ -225,7 +225,7 @@ module Bandwidth
225
225
  return_type = opts[:debug_return_type]
226
226
 
227
227
  # auth_names
228
- auth_names = opts[:debug_auth_names] || ['Basic']
228
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
229
229
 
230
230
  new_options = opts.merge(
231
231
  :operation => :"TollFreeVerificationApi.delete_webhook_subscription",
@@ -278,7 +278,7 @@ module Bandwidth
278
278
  end
279
279
 
280
280
  if @api_client.config.client_side_validation && phone_number.to_s.length < 12
281
- fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be great than or equal to 12.'
281
+ fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.get_toll_free_verification_status, the character length must be greater than or equal to 12.'
282
282
  end
283
283
 
284
284
  pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
@@ -307,7 +307,7 @@ module Bandwidth
307
307
  return_type = opts[:debug_return_type] || 'TfvStatus'
308
308
 
309
309
  # auth_names
310
- auth_names = opts[:debug_auth_names] || ['Basic']
310
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
311
311
 
312
312
  new_options = opts.merge(
313
313
  :operation => :"TollFreeVerificationApi.get_toll_free_verification_status",
@@ -364,7 +364,7 @@ module Bandwidth
364
364
  return_type = opts[:debug_return_type] || 'Array<String>'
365
365
 
366
366
  # auth_names
367
- auth_names = opts[:debug_auth_names] || ['Basic']
367
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
368
368
 
369
369
  new_options = opts.merge(
370
370
  :operation => :"TollFreeVerificationApi.list_toll_free_use_cases",
@@ -427,7 +427,7 @@ module Bandwidth
427
427
  return_type = opts[:debug_return_type] || 'WebhookSubscriptionsListBody'
428
428
 
429
429
  # auth_names
430
- auth_names = opts[:debug_auth_names] || ['Basic']
430
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
431
431
 
432
432
  new_options = opts.merge(
433
433
  :operation => :"TollFreeVerificationApi.list_webhook_subscriptions",
@@ -501,7 +501,7 @@ module Bandwidth
501
501
  return_type = opts[:debug_return_type]
502
502
 
503
503
  # auth_names
504
- auth_names = opts[:debug_auth_names] || ['Basic']
504
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
505
505
 
506
506
  new_options = opts.merge(
507
507
  :operation => :"TollFreeVerificationApi.request_toll_free_verification",
@@ -556,7 +556,7 @@ module Bandwidth
556
556
  end
557
557
 
558
558
  if @api_client.config.client_side_validation && phone_number.to_s.length < 12
559
- fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be great than or equal to 12.'
559
+ fail ArgumentError, 'invalid value for "phone_number" when calling TollFreeVerificationApi.update_toll_free_verification_request, the character length must be greater than or equal to 12.'
560
560
  end
561
561
 
562
562
  pattern = Regexp.new(/^\+1(800|833|844|855|866|877|888)[2-9]\d{6}$/)
@@ -594,7 +594,7 @@ module Bandwidth
594
594
  return_type = opts[:debug_return_type]
595
595
 
596
596
  # auth_names
597
- auth_names = opts[:debug_auth_names] || ['Basic']
597
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
598
598
 
599
599
  new_options = opts.merge(
600
600
  :operation => :"TollFreeVerificationApi.update_toll_free_verification_request",
@@ -674,7 +674,7 @@ module Bandwidth
674
674
  return_type = opts[:debug_return_type] || 'WebhookSubscription'
675
675
 
676
676
  # auth_names
677
- auth_names = opts[:debug_auth_names] || ['Basic']
677
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
678
678
 
679
679
  new_options = opts.merge(
680
680
  :operation => :"TollFreeVerificationApi.update_webhook_subscription",
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -75,7 +75,7 @@ module Bandwidth
75
75
  return_type = opts[:debug_return_type]
76
76
 
77
77
  # auth_names
78
- auth_names = opts[:debug_auth_names] || ['Basic']
78
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
79
79
 
80
80
  new_options = opts.merge(
81
81
  :operation => :"TranscriptionsApi.delete_real_time_transcription",
@@ -150,7 +150,7 @@ module Bandwidth
150
150
  return_type = opts[:debug_return_type] || 'CallTranscriptionResponse'
151
151
 
152
152
  # auth_names
153
- auth_names = opts[:debug_auth_names] || ['Basic']
153
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
154
154
 
155
155
  new_options = opts.merge(
156
156
  :operation => :"TranscriptionsApi.get_real_time_transcription",
@@ -219,7 +219,7 @@ module Bandwidth
219
219
  return_type = opts[:debug_return_type] || 'Array<CallTranscriptionMetadata>'
220
220
 
221
221
  # auth_names
222
- auth_names = opts[:debug_auth_names] || ['Basic']
222
+ auth_names = opts[:debug_auth_names] || ['Basic', 'OAuth2']
223
223
 
224
224
  new_options = opts.merge(
225
225
  :operation => :"TranscriptionsApi.list_real_time_transcriptions",
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -322,9 +322,13 @@ module Bandwidth
322
322
  data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
323
323
  end
324
324
  else
325
- # models (e.g. Pet) or oneOf
325
+ # models (e.g. Pet) or oneOf/anyOf
326
326
  klass = Bandwidth.const_get(return_type)
327
- klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
327
+ if klass.respond_to?(:openapi_one_of) || klass.respond_to?(:openapi_any_of)
328
+ klass.build(data)
329
+ else
330
+ klass.build_from_hash(data)
331
+ end
328
332
  end
329
333
  end
330
334
 
@@ -353,8 +357,8 @@ module Bandwidth
353
357
  auth_setting = @config.auth_settings[auth_name]
354
358
  next unless auth_setting
355
359
  case auth_setting[:in]
356
- when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
357
- when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
360
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil?
361
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] unless auth_setting[:value].nil?
358
362
  else fail ArgumentError, 'Authentication token must be in `query` or `header`'
359
363
  end
360
364
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -0,0 +1,88 @@
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.17.0
10
+
11
+ =end
12
+
13
+ module Bandwidth
14
+ class ApiModelBase
15
+ # Deserializes the data based on type
16
+ # @param string type Data type
17
+ # @param string value Value to be deserialized
18
+ # @return [Object] Deserialized data
19
+ def self._deserialize(type, value)
20
+ case type.to_sym
21
+ when :Time
22
+ Time.parse(value)
23
+ when :Date
24
+ Date.parse(value)
25
+ when :String
26
+ value.to_s
27
+ when :Integer
28
+ value.to_i
29
+ when :Float
30
+ value.to_f
31
+ when :Boolean
32
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
33
+ true
34
+ else
35
+ false
36
+ end
37
+ when :Object
38
+ # generic object (usually a Hash), return directly
39
+ value
40
+ when /\AArray<(?<inner_type>.+)>\z/
41
+ inner_type = Regexp.last_match[:inner_type]
42
+ value.map { |v| _deserialize(inner_type, v) }
43
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
44
+ k_type = Regexp.last_match[:k_type]
45
+ v_type = Regexp.last_match[:v_type]
46
+ {}.tap do |hash|
47
+ value.each do |k, v|
48
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
49
+ end
50
+ end
51
+ else # model
52
+ # models (e.g. Pet) or oneOf
53
+ klass = Bandwidth.const_get(type)
54
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
55
+ end
56
+ end
57
+
58
+ # Returns the string representation of the object
59
+ # @return [String] String presentation of the object
60
+ def to_s
61
+ to_hash.to_s
62
+ end
63
+
64
+ # to_body is an alias to to_hash (backward compatibility)
65
+ # @return [Hash] Returns the object in the form of hash
66
+ def to_body
67
+ to_hash
68
+ end
69
+
70
+ # Outputs non-array value in the form of hash
71
+ # For object, use to_hash. Otherwise, just return the value
72
+ # @param [Object] value Any valid value
73
+ # @return [Hash] Returns the value in the form of hash
74
+ def _to_hash(value)
75
+ if value.is_a?(Array)
76
+ value.compact.map { |v| _to_hash(v) }
77
+ elsif value.is_a?(Hash)
78
+ {}.tap do |hash|
79
+ value.each { |k, v| hash[k] = _to_hash(v) }
80
+ end
81
+ elsif value.respond_to? :to_hash
82
+ value.to_hash
83
+ else
84
+ value
85
+ end
86
+ end
87
+ end
88
+ end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -59,6 +59,16 @@ module Bandwidth
59
59
  # @return [String]
60
60
  attr_accessor :password
61
61
 
62
+ # Defines the client ID used with OAuth2.
63
+ #
64
+ # @return [String]
65
+ attr_accessor :client_id
66
+
67
+ # Defines the client secret used with OAuth2.
68
+ #
69
+ # @return [String]
70
+ attr_accessor :client_secret
71
+
62
72
  # Defines the access token (Bearer) used with OAuth2.
63
73
  attr_accessor :access_token
64
74
 
@@ -182,6 +192,32 @@ module Bandwidth
182
192
  @inject_format = false
183
193
  @force_ending_format = false
184
194
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
195
+ @access_token_expiration = nil
196
+ @access_token_getter = Proc.new {
197
+ access_token_valid = @access_token && (@access_token_expiration.nil? || @access_token_expiration > Time.now + 60)
198
+ next @access_token if access_token_valid
199
+ next unless @client_id && @client_secret
200
+
201
+ puts "Refreshing access token..." if @debugging
202
+ # obtain new access token using client credentials
203
+ token_url = 'https://api.bandwidth.com/api/v1/oauth2/token'
204
+ auth_header = 'Basic ' + ["#{@client_id}:#{@client_secret}"].pack('m').delete("\r\n")
205
+ conn = Faraday.new(url: token_url) do |faraday|
206
+ faraday.request :url_encoded
207
+ faraday.adapter Faraday.default_adapter
208
+ end
209
+ response = conn.post do |req|
210
+ req.headers['Authorization'] = auth_header
211
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
212
+ req.body = 'grant_type=client_credentials'
213
+ end
214
+ if response.status != 200
215
+ raise "Failed to obtain access token: #{response.status} #{response.body}"
216
+ end
217
+ body = JSON.parse(response.body)
218
+ @access_token = body['access_token']
219
+ @access_token_expiration = Time.now + body['expires_in']
220
+ }
185
221
 
186
222
  yield(self) if block_given?
187
223
  end
@@ -245,6 +281,12 @@ module Bandwidth
245
281
  'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
246
282
  end
247
283
 
284
+ # Gets Bearer auth token string
285
+ def oauth_bearer_token
286
+ "Bearer #{access_token_with_refresh}" unless access_token_with_refresh.nil?
287
+ end
288
+
289
+
248
290
  # Returns Auth Settings hash for api client.
249
291
  def auth_settings
250
292
  {
@@ -255,6 +297,13 @@ module Bandwidth
255
297
  key: 'Authorization',
256
298
  value: basic_auth_token
257
299
  },
300
+ 'OAuth2' =>
301
+ {
302
+ type: 'oauth2',
303
+ in: 'header',
304
+ key: 'Authorization',
305
+ value: oauth_bearer_token
306
+ },
258
307
  }
259
308
  end
260
309
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- class AccountStatistics
17
+ class AccountStatistics < ApiModelBase
18
18
  # The number of calls currently enqueued.
19
19
  attr_accessor :current_call_queue_size
20
20
 
@@ -29,9 +29,14 @@ module Bandwidth
29
29
  }
30
30
  end
31
31
 
32
+ # Returns attribute mapping this model knows about
33
+ def self.acceptable_attribute_map
34
+ attribute_map
35
+ end
36
+
32
37
  # Returns all the JSON keys this model knows about
33
38
  def self.acceptable_attributes
34
- attribute_map.values
39
+ acceptable_attribute_map.values
35
40
  end
36
41
 
37
42
  # Attribute type mapping.
@@ -56,9 +61,10 @@ module Bandwidth
56
61
  end
57
62
 
58
63
  # check to see if the attribute exists and convert string to symbol for hash key
64
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
65
  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 `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ if (!acceptable_attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AccountStatistics`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
68
  end
63
69
  h[k.to_sym] = v
64
70
  }
@@ -131,61 +137,6 @@ module Bandwidth
131
137
  new(transformed_hash)
132
138
  end
133
139
 
134
- # Deserializes the data based on type
135
- # @param string type Data type
136
- # @param string value Value to be deserialized
137
- # @return [Object] Deserialized data
138
- def self._deserialize(type, value)
139
- case type.to_sym
140
- when :Time
141
- Time.parse(value)
142
- when :Date
143
- Date.parse(value)
144
- when :String
145
- value.to_s
146
- when :Integer
147
- value.to_i
148
- when :Float
149
- value.to_f
150
- when :Boolean
151
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
- true
153
- else
154
- false
155
- end
156
- when :Object
157
- # generic object (usually a Hash), return directly
158
- value
159
- when /\AArray<(?<inner_type>.+)>\z/
160
- inner_type = Regexp.last_match[:inner_type]
161
- value.map { |v| _deserialize(inner_type, v) }
162
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
- k_type = Regexp.last_match[:k_type]
164
- v_type = Regexp.last_match[:v_type]
165
- {}.tap do |hash|
166
- value.each do |k, v|
167
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
- end
169
- end
170
- else # model
171
- # models (e.g. Pet) or oneOf
172
- klass = Bandwidth.const_get(type)
173
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
- end
175
- end
176
-
177
- # Returns the string representation of the object
178
- # @return [String] String presentation of the object
179
- def to_s
180
- to_hash.to_s
181
- end
182
-
183
- # to_body is an alias to to_hash (backward compatibility)
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_body
186
- to_hash
187
- end
188
-
189
140
  # Returns the object in the form of hash
190
141
  # @return [Hash] Returns the object in the form of hash
191
142
  def to_hash
@@ -201,23 +152,5 @@ module Bandwidth
201
152
  end
202
153
  hash
203
154
  end
204
-
205
- # Outputs non-array value in the form of hash
206
- # For object, use to_hash. Otherwise, just return the value
207
- # @param [Object] value Any valid value
208
- # @return [Hash] Returns the value in the form of hash
209
- def _to_hash(value)
210
- if value.is_a?(Array)
211
- value.compact.map { |v| _to_hash(v) }
212
- elsif value.is_a?(Hash)
213
- {}.tap do |hash|
214
- value.each { |k, v| hash[k] = _to_hash(v) }
215
- end
216
- elsif value.respond_to? :to_hash
217
- value.to_hash
218
- else
219
- value
220
- end
221
- end
222
155
  end
223
156
  end
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: letstalk@bandwidth.com
8
8
  Generated by: https://openapi-generator.tech
9
- Generator version: 7.8.0
9
+ Generator version: 7.17.0
10
10
 
11
11
  =end
12
12
 
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Bandwidth
17
- class AdditionalDenialReason
17
+ class AdditionalDenialReason < ApiModelBase
18
18
  # Reason code for denial.
19
19
  attr_accessor :status_code
20
20
 
@@ -33,9 +33,14 @@ module Bandwidth
33
33
  }
34
34
  end
35
35
 
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
36
41
  # Returns all the JSON keys this model knows about
37
42
  def self.acceptable_attributes
38
- attribute_map.values
43
+ acceptable_attribute_map.values
39
44
  end
40
45
 
41
46
  # Attribute type mapping.
@@ -61,9 +66,10 @@ module Bandwidth
61
66
  end
62
67
 
63
68
  # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
64
70
  attributes = attributes.each_with_object({}) { |(k, v), h|
65
- if (!self.class.attribute_map.key?(k.to_sym))
66
- fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::AdditionalDenialReason`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
73
  end
68
74
  h[k.to_sym] = v
69
75
  }
@@ -117,6 +123,36 @@ module Bandwidth
117
123
  true
118
124
  end
119
125
 
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] status_code Value to be assigned
128
+ def status_code=(status_code)
129
+ if status_code.nil?
130
+ fail ArgumentError, 'status_code cannot be nil'
131
+ end
132
+
133
+ @status_code = status_code
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] reason Value to be assigned
138
+ def reason=(reason)
139
+ if reason.nil?
140
+ fail ArgumentError, 'reason cannot be nil'
141
+ end
142
+
143
+ @reason = reason
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] resubmit_allowed Value to be assigned
148
+ def resubmit_allowed=(resubmit_allowed)
149
+ if resubmit_allowed.nil?
150
+ fail ArgumentError, 'resubmit_allowed cannot be nil'
151
+ end
152
+
153
+ @resubmit_allowed = resubmit_allowed
154
+ end
155
+
120
156
  # Checks equality by comparing each attribute.
121
157
  # @param [Object] Object to be compared
122
158
  def ==(o)
@@ -162,61 +198,6 @@ module Bandwidth
162
198
  new(transformed_hash)
163
199
  end
164
200
 
165
- # Deserializes the data based on type
166
- # @param string type Data type
167
- # @param string value Value to be deserialized
168
- # @return [Object] Deserialized data
169
- def self._deserialize(type, value)
170
- case type.to_sym
171
- when :Time
172
- Time.parse(value)
173
- when :Date
174
- Date.parse(value)
175
- when :String
176
- value.to_s
177
- when :Integer
178
- value.to_i
179
- when :Float
180
- value.to_f
181
- when :Boolean
182
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
- true
184
- else
185
- false
186
- end
187
- when :Object
188
- # generic object (usually a Hash), return directly
189
- value
190
- when /\AArray<(?<inner_type>.+)>\z/
191
- inner_type = Regexp.last_match[:inner_type]
192
- value.map { |v| _deserialize(inner_type, v) }
193
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
- k_type = Regexp.last_match[:k_type]
195
- v_type = Regexp.last_match[:v_type]
196
- {}.tap do |hash|
197
- value.each do |k, v|
198
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
- end
200
- end
201
- else # model
202
- # models (e.g. Pet) or oneOf
203
- klass = Bandwidth.const_get(type)
204
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
- end
206
- end
207
-
208
- # Returns the string representation of the object
209
- # @return [String] String presentation of the object
210
- def to_s
211
- to_hash.to_s
212
- end
213
-
214
- # to_body is an alias to to_hash (backward compatibility)
215
- # @return [Hash] Returns the object in the form of hash
216
- def to_body
217
- to_hash
218
- end
219
-
220
201
  # Returns the object in the form of hash
221
202
  # @return [Hash] Returns the object in the form of hash
222
203
  def to_hash
@@ -232,23 +213,5 @@ module Bandwidth
232
213
  end
233
214
  hash
234
215
  end
235
-
236
- # Outputs non-array value in the form of hash
237
- # For object, use to_hash. Otherwise, just return the value
238
- # @param [Object] value Any valid value
239
- # @return [Hash] Returns the value in the form of hash
240
- def _to_hash(value)
241
- if value.is_a?(Array)
242
- value.compact.map { |v| _to_hash(v) }
243
- elsif value.is_a?(Hash)
244
- {}.tap do |hash|
245
- value.each { |k, v| hash[k] = _to_hash(v) }
246
- end
247
- elsif value.respond_to? :to_hash
248
- value.to_hash
249
- else
250
- value
251
- end
252
- end
253
216
  end
254
217
  end