bandwidth-sdk 10.4.0 → 11.0.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (526) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +77 -0
  4. data/README.md +198 -140
  5. data/Rakefile +22 -0
  6. data/bandwidth-sdk.gemspec +40 -0
  7. data/bandwidth.yml +5544 -0
  8. data/docs/AccountStatistics.md +20 -0
  9. data/docs/AnswerCallback.md +44 -0
  10. data/docs/BridgeCompleteCallback.md +48 -0
  11. data/docs/BridgeTargetCompleteCallback.md +42 -0
  12. data/docs/CallDirectionEnum.md +15 -0
  13. data/docs/CallRecordingMetadata.md +52 -0
  14. data/docs/CallState.md +52 -0
  15. data/docs/CallStateEnum.md +15 -0
  16. data/docs/CallbackMethodEnum.md +15 -0
  17. data/docs/CallsApi.md +304 -0
  18. data/docs/CodeRequest.md +28 -0
  19. data/docs/Conference.md +32 -0
  20. data/docs/ConferenceCompletedCallback.md +26 -0
  21. data/docs/ConferenceCreatedCallback.md +26 -0
  22. data/docs/ConferenceMember.md +28 -0
  23. data/docs/ConferenceMemberExitCallback.md +32 -0
  24. data/docs/ConferenceMemberJoinCallback.md +32 -0
  25. data/docs/ConferenceRecordingAvailableCallback.md +44 -0
  26. data/docs/ConferenceRecordingMetadata.md +38 -0
  27. data/docs/ConferenceRedirectCallback.md +26 -0
  28. data/docs/ConferenceStateEnum.md +15 -0
  29. data/docs/ConferencesApi.md +688 -0
  30. data/docs/CreateCall.md +54 -0
  31. data/docs/CreateCallResponse.md +58 -0
  32. data/docs/CreateLookupResponse.md +20 -0
  33. data/docs/CreateMessageRequestError.md +22 -0
  34. data/docs/CreateParticipantRequest.md +24 -0
  35. data/docs/CreateParticipantResponse.md +20 -0
  36. data/docs/DeferredResult.md +20 -0
  37. data/docs/DeviceApiVersionEnum.md +15 -0
  38. data/docs/DisconenctCallback.md +50 -0
  39. data/docs/DisconnectCallback.md +50 -0
  40. data/docs/Diversion.md +30 -0
  41. data/docs/DtmfCallback.md +50 -0
  42. data/docs/FieldError.md +20 -0
  43. data/docs/FileFormatEnum.md +15 -0
  44. data/docs/ForbiddenRequest.md +18 -0
  45. data/docs/GatherCallback.md +52 -0
  46. data/docs/InboundMessageCallback.md +26 -0
  47. data/docs/InboundMessageCallbackMessage.md +40 -0
  48. data/docs/InitiateCallback.md +40 -0
  49. data/docs/ListMessageDirectionEnum.md +15 -0
  50. data/docs/ListMessageItem.md +48 -0
  51. data/docs/LookupRequest.md +18 -0
  52. data/docs/LookupResult.md +34 -0
  53. data/docs/LookupStatus.md +24 -0
  54. data/docs/LookupStatusEnum.md +15 -0
  55. data/docs/MFAApi.md +226 -0
  56. data/docs/MachineDetectionCompleteCallback.md +44 -0
  57. data/docs/MachineDetectionConfiguration.md +46 -0
  58. data/docs/MachineDetectionModeEnum.md +15 -0
  59. data/docs/Media.md +22 -0
  60. data/docs/MediaApi.md +307 -0
  61. data/docs/Message.md +40 -0
  62. data/docs/MessageDeliveredCallback.md +26 -0
  63. data/docs/MessageDeliveredCallbackMessage.md +40 -0
  64. data/docs/MessageDirectionEnum.md +15 -0
  65. data/docs/MessageFailedCallback.md +28 -0
  66. data/docs/MessageFailedCallbackMessage.md +40 -0
  67. data/docs/MessageRequest.md +32 -0
  68. data/docs/MessageSendingCallback.md +26 -0
  69. data/docs/MessageSendingCallbackMessage.md +40 -0
  70. data/docs/MessageStatusEnum.md +15 -0
  71. data/docs/MessageTypeEnum.md +15 -0
  72. data/docs/MessagesApi.md +179 -0
  73. data/docs/MessagesList.md +22 -0
  74. data/docs/MessagingCodeResponse.md +18 -0
  75. data/docs/MessagingRequestError.md +20 -0
  76. data/docs/MfaForbiddenRequestError.md +18 -0
  77. data/docs/MfaRequestError.md +20 -0
  78. data/docs/MfaUnauthorizedRequestError.md +18 -0
  79. data/docs/PageInfo.md +24 -0
  80. data/docs/Participant.md +30 -0
  81. data/docs/ParticipantSubscription.md +20 -0
  82. data/docs/ParticipantsApi.md +227 -0
  83. data/docs/PhoneNumberLookupApi.md +153 -0
  84. data/docs/PriorityEnum.md +15 -0
  85. data/docs/PublishPermissionsEnum.md +15 -0
  86. data/docs/RecordingAvailableCallback.md +60 -0
  87. data/docs/RecordingCompleteCallback.md +60 -0
  88. data/docs/RecordingStateEnum.md +15 -0
  89. data/docs/RecordingsApi.md +758 -0
  90. data/docs/RedirectCallback.md +48 -0
  91. data/docs/RedirectMethodEnum.md +15 -0
  92. data/docs/RequestError.md +20 -0
  93. data/docs/Session.md +20 -0
  94. data/docs/SessionsApi.md +605 -0
  95. data/docs/StatisticsApi.md +78 -0
  96. data/docs/StirShaken.md +22 -0
  97. data/docs/Subscriptions.md +20 -0
  98. data/docs/Tag.md +20 -0
  99. data/docs/TnLookupRequestError.md +18 -0
  100. data/docs/TranscribeRecording.md +28 -0
  101. data/docs/Transcription.md +20 -0
  102. data/docs/TranscriptionAvailableCallback.md +58 -0
  103. data/docs/TranscriptionList.md +18 -0
  104. data/docs/TranscriptionMetadata.md +24 -0
  105. data/docs/TransferAnswerCallback.md +46 -0
  106. data/docs/TransferCompleteCallback.md +52 -0
  107. data/docs/TransferDisconnectCallback.md +56 -0
  108. data/docs/UnauthorizedRequest.md +18 -0
  109. data/docs/UpdateCall.md +36 -0
  110. data/docs/UpdateCallRecording.md +18 -0
  111. data/docs/UpdateConference.md +34 -0
  112. data/docs/UpdateConferenceMember.md +22 -0
  113. data/docs/VerifyCodeRequest.md +24 -0
  114. data/docs/VerifyCodeResponse.md +18 -0
  115. data/docs/VoiceApiError.md +22 -0
  116. data/docs/VoiceCodeResponse.md +18 -0
  117. data/git_push.sh +57 -0
  118. data/lib/bandwidth-sdk/api/calls_api.rb +325 -0
  119. data/lib/bandwidth-sdk/api/conferences_api.rb +717 -0
  120. data/lib/bandwidth-sdk/api/media_api.rb +312 -0
  121. data/lib/bandwidth-sdk/api/messages_api.rb +198 -0
  122. data/lib/bandwidth-sdk/api/mfa_api.rb +244 -0
  123. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +165 -0
  124. data/lib/bandwidth-sdk/api/recordings_api.rb +782 -0
  125. data/lib/bandwidth-sdk/api/statistics_api.rb +85 -0
  126. data/lib/bandwidth-sdk/api_client.rb +428 -0
  127. data/lib/bandwidth-sdk/api_error.rb +58 -0
  128. data/lib/bandwidth-sdk/configuration.rb +589 -0
  129. data/lib/bandwidth-sdk/models/account_statistics.rb +230 -0
  130. data/lib/bandwidth-sdk/models/answer_callback.rb +376 -0
  131. data/lib/bandwidth-sdk/models/bridge_complete_callback.rb +397 -0
  132. data/lib/bandwidth-sdk/models/bridge_target_complete_callback.rb +365 -0
  133. data/lib/bandwidth-sdk/models/bxml/bxml.rb +13 -0
  134. data/lib/bandwidth-sdk/models/bxml/nestable_verb.rb +50 -0
  135. data/lib/bandwidth-sdk/models/bxml/response.rb +13 -0
  136. data/lib/bandwidth-sdk/models/bxml/root.rb +47 -0
  137. data/lib/bandwidth-sdk/models/bxml/verb.rb +51 -0
  138. data/lib/bandwidth-sdk/models/bxml/verbs/bridge.rb +30 -0
  139. data/lib/bandwidth-sdk/models/bxml/verbs/conference.rb +31 -0
  140. data/lib/bandwidth-sdk/models/bxml/verbs/forward.rb +22 -0
  141. data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +44 -0
  142. data/lib/bandwidth-sdk/models/bxml/verbs/hangup.rb +12 -0
  143. data/lib/bandwidth-sdk/models/bxml/verbs/pause.rb +17 -0
  144. data/lib/bandwidth-sdk/models/bxml/verbs/pause_recording.rb +12 -0
  145. data/lib/bandwidth-sdk/models/bxml/verbs/phone_number.rb +28 -0
  146. data/lib/bandwidth-sdk/models/bxml/verbs/play_audio.rb +19 -0
  147. data/lib/bandwidth-sdk/models/bxml/verbs/record.rb +34 -0
  148. data/lib/bandwidth-sdk/models/bxml/verbs/redirect.rb +25 -0
  149. data/lib/bandwidth-sdk/models/bxml/verbs/resume_recording.rb +12 -0
  150. data/lib/bandwidth-sdk/models/bxml/verbs/ring.rb +18 -0
  151. data/lib/bandwidth-sdk/models/bxml/verbs/send_dtmf.rb +19 -0
  152. data/lib/bandwidth-sdk/models/bxml/verbs/sip_uri.rb +29 -0
  153. data/lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb +27 -0
  154. data/lib/bandwidth-sdk/models/bxml/verbs/start_gather.rb +21 -0
  155. data/lib/bandwidth-sdk/models/bxml/verbs/start_recording.rb +26 -0
  156. data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +30 -0
  157. data/lib/bandwidth-sdk/models/bxml/verbs/stop_gather.rb +12 -0
  158. data/lib/bandwidth-sdk/models/bxml/verbs/stop_recording.rb +12 -0
  159. data/lib/bandwidth-sdk/models/bxml/verbs/stop_stream.rb +17 -0
  160. data/lib/bandwidth-sdk/models/bxml/verbs/stream_param.rb +18 -0
  161. data/lib/bandwidth-sdk/models/bxml/verbs/tag.rb +13 -0
  162. data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +36 -0
  163. data/lib/bandwidth-sdk/models/call_direction_enum.rb +40 -0
  164. data/lib/bandwidth-sdk/models/call_recording_metadata.rb +411 -0
  165. data/lib/bandwidth-sdk/models/call_state.rb +423 -0
  166. data/lib/bandwidth-sdk/models/call_state_enum.rb +40 -0
  167. data/lib/bandwidth-sdk/models/callback_method_enum.rb +40 -0
  168. data/lib/bandwidth-sdk/models/code_request.rb +427 -0
  169. data/lib/bandwidth-sdk/models/conference.rb +320 -0
  170. data/lib/bandwidth-sdk/models/conference_completed_callback.rb +262 -0
  171. data/lib/bandwidth-sdk/models/conference_created_callback.rb +262 -0
  172. data/lib/bandwidth-sdk/models/conference_member.rb +273 -0
  173. data/lib/bandwidth-sdk/models/conference_member_exit_callback.rb +292 -0
  174. data/lib/bandwidth-sdk/models/conference_member_join_callback.rb +292 -0
  175. data/lib/bandwidth-sdk/models/conference_recording_available_callback.rb +374 -0
  176. data/lib/bandwidth-sdk/models/conference_recording_metadata.rb +342 -0
  177. data/lib/bandwidth-sdk/models/conference_redirect_callback.rb +262 -0
  178. data/lib/bandwidth-sdk/models/conference_state_enum.rb +40 -0
  179. data/lib/bandwidth-sdk/models/create_call.rb +651 -0
  180. data/lib/bandwidth-sdk/models/create_call_response.rb +552 -0
  181. data/lib/bandwidth-sdk/models/create_lookup_response.rb +252 -0
  182. data/lib/bandwidth-sdk/models/create_message_request_error.rb +249 -0
  183. data/lib/bandwidth-sdk/models/deferred_result.rb +228 -0
  184. data/lib/bandwidth-sdk/models/disconenct_callback.rb +407 -0
  185. data/lib/bandwidth-sdk/models/disconnect_callback.rb +407 -0
  186. data/lib/bandwidth-sdk/models/diversion.rb +280 -0
  187. data/lib/bandwidth-sdk/models/dtmf_callback.rb +405 -0
  188. data/lib/bandwidth-sdk/models/field_error.rb +230 -0
  189. data/lib/bandwidth-sdk/models/file_format_enum.rb +40 -0
  190. data/lib/bandwidth-sdk/models/gather_callback.rb +415 -0
  191. data/lib/bandwidth-sdk/models/inbound_message_callback.rb +281 -0
  192. data/lib/bandwidth-sdk/models/inbound_message_callback_message.rb +399 -0
  193. data/lib/bandwidth-sdk/models/initiate_callback.rb +350 -0
  194. data/lib/bandwidth-sdk/models/list_message_direction_enum.rb +40 -0
  195. data/lib/bandwidth-sdk/models/list_message_item.rb +394 -0
  196. data/lib/bandwidth-sdk/models/lookup_request.rb +227 -0
  197. data/lib/bandwidth-sdk/models/lookup_result.rb +301 -0
  198. data/lib/bandwidth-sdk/models/lookup_status.rb +276 -0
  199. data/lib/bandwidth-sdk/models/lookup_status_enum.rb +42 -0
  200. data/lib/bandwidth-sdk/models/machine_detection_complete_callback.rb +376 -0
  201. data/lib/bandwidth-sdk/models/machine_detection_configuration.rb +500 -0
  202. data/lib/bandwidth-sdk/models/machine_detection_mode_enum.rb +40 -0
  203. data/lib/bandwidth-sdk/models/media.rb +237 -0
  204. data/lib/bandwidth-sdk/models/message.rb +366 -0
  205. data/lib/bandwidth-sdk/models/message_delivered_callback.rb +281 -0
  206. data/lib/bandwidth-sdk/models/message_delivered_callback_message.rb +404 -0
  207. data/lib/bandwidth-sdk/models/message_direction_enum.rb +40 -0
  208. data/lib/bandwidth-sdk/models/message_failed_callback.rb +295 -0
  209. data/lib/bandwidth-sdk/models/message_failed_callback_message.rb +409 -0
  210. data/lib/bandwidth-sdk/models/message_request.rb +355 -0
  211. data/lib/bandwidth-sdk/models/message_sending_callback.rb +281 -0
  212. data/lib/bandwidth-sdk/models/message_sending_callback_message.rb +409 -0
  213. data/lib/bandwidth-sdk/models/message_status_enum.rb +46 -0
  214. data/lib/bandwidth-sdk/models/message_type_enum.rb +40 -0
  215. data/lib/bandwidth-sdk/models/messages_list.rb +240 -0
  216. data/lib/bandwidth-sdk/models/messaging_code_response.rb +220 -0
  217. data/lib/bandwidth-sdk/models/messaging_request_error.rb +238 -0
  218. data/lib/bandwidth-sdk/models/mfa_forbidden_request_error.rb +220 -0
  219. data/lib/bandwidth-sdk/models/mfa_request_error.rb +230 -0
  220. data/lib/bandwidth-sdk/models/mfa_unauthorized_request_error.rb +220 -0
  221. data/lib/bandwidth-sdk/models/page_info.rb +250 -0
  222. data/lib/bandwidth-sdk/models/priority_enum.rb +40 -0
  223. data/lib/bandwidth-sdk/models/recording_available_callback.rb +454 -0
  224. data/lib/bandwidth-sdk/models/recording_complete_callback.rb +455 -0
  225. data/lib/bandwidth-sdk/models/recording_state_enum.rb +40 -0
  226. data/lib/bandwidth-sdk/models/redirect_callback.rb +395 -0
  227. data/lib/bandwidth-sdk/models/redirect_method_enum.rb +40 -0
  228. data/lib/bandwidth-sdk/models/stir_shaken.rb +240 -0
  229. data/lib/bandwidth-sdk/models/tag.rb +228 -0
  230. data/lib/bandwidth-sdk/models/tn_lookup_request_error.rb +220 -0
  231. data/lib/bandwidth-sdk/models/transcribe_recording.rb +354 -0
  232. data/lib/bandwidth-sdk/models/transcription.rb +230 -0
  233. data/lib/bandwidth-sdk/models/transcription_available_callback.rb +443 -0
  234. data/lib/bandwidth-sdk/models/transcription_list.rb +221 -0
  235. data/lib/bandwidth-sdk/models/transcription_metadata.rb +251 -0
  236. data/lib/bandwidth-sdk/models/transfer_answer_callback.rb +385 -0
  237. data/lib/bandwidth-sdk/models/transfer_complete_callback.rb +417 -0
  238. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +437 -0
  239. data/lib/bandwidth-sdk/models/update_call.rb +411 -0
  240. data/lib/bandwidth-sdk/models/update_call_recording.rb +246 -0
  241. data/lib/bandwidth-sdk/models/update_conference.rb +394 -0
  242. data/lib/bandwidth-sdk/models/update_conference_member.rb +243 -0
  243. data/lib/bandwidth-sdk/models/verify_code_request.rb +342 -0
  244. data/lib/bandwidth-sdk/models/verify_code_response.rb +220 -0
  245. data/lib/bandwidth-sdk/models/voice_api_error.rb +238 -0
  246. data/lib/bandwidth-sdk/models/voice_code_response.rb +220 -0
  247. data/lib/bandwidth-sdk/version.rb +15 -0
  248. data/lib/bandwidth-sdk.rb +166 -0
  249. data/openapi-config.yml +11 -0
  250. data/ruby-notes.md +64 -0
  251. data/spec/call_utils.rb +74 -0
  252. data/spec/fixtures/ruby_cat.jpeg +0 -0
  253. data/spec/integration/calls_api_integration_spec.rb +181 -0
  254. data/spec/integration/conferences_api_integration_spec.rb +163 -0
  255. data/spec/integration/media_api_integration_spec.rb +86 -0
  256. data/spec/integration/messages_api_integration_spec.rb +97 -0
  257. data/spec/integration/mfa_api_integration_spec.rb +109 -0
  258. data/spec/integration/phone_number_lookup_api_integration_spec.rb +92 -0
  259. data/spec/integration/recordings_api_integration_spec.rb +219 -0
  260. data/spec/integration/statistics_api_integration_spec.rb +57 -0
  261. data/spec/spec_helper.rb +154 -0
  262. data/spec/unit/api/calls_api_spec.rb +89 -0
  263. data/spec/unit/api/conferences_api_spec.rb +163 -0
  264. data/spec/unit/api/media_api_spec.rb +90 -0
  265. data/spec/unit/api/messages_api_spec.rb +73 -0
  266. data/spec/unit/api/mfa_api_spec.rb +74 -0
  267. data/spec/unit/api/phone_number_lookup_api_spec.rb +61 -0
  268. data/spec/unit/api/recordings_api_spec.rb +177 -0
  269. data/spec/unit/api/statistics_api_spec.rb +47 -0
  270. data/spec/unit/models/account_statistics_spec.rb +40 -0
  271. data/spec/unit/models/answer_callback_spec.rb +112 -0
  272. data/spec/unit/models/bridge_complete_callback_spec.rb +124 -0
  273. data/spec/unit/models/bridge_target_complete_callback_spec.rb +106 -0
  274. data/spec/unit/models/bxml/bxml_spec.rb +18 -0
  275. data/spec/unit/models/bxml/nestable_verb_spec.rb +13 -0
  276. data/spec/unit/models/bxml/response_spec.rb +18 -0
  277. data/spec/unit/models/bxml/verb_spec.rb +28 -0
  278. data/spec/unit/models/bxml/verbs/bridge_spec.rb +60 -0
  279. data/spec/unit/models/bxml/verbs/conference_spec.rb +60 -0
  280. data/spec/unit/models/bxml/verbs/forward_spec.rb +46 -0
  281. data/spec/unit/models/bxml/verbs/gather_spec.rb +88 -0
  282. data/spec/unit/models/bxml/verbs/hangup_spec.rb +18 -0
  283. data/spec/unit/models/bxml/verbs/pause_recording_spec.rb +18 -0
  284. data/spec/unit/models/bxml/verbs/pause_spec.rb +36 -0
  285. data/spec/unit/models/bxml/verbs/phone_number_spec.rb +56 -0
  286. data/spec/unit/models/bxml/verbs/play_audio_spec.rb +38 -0
  287. data/spec/unit/models/bxml/verbs/record_spec.rb +70 -0
  288. data/spec/unit/models/bxml/verbs/redirect_spec.rb +52 -0
  289. data/spec/unit/models/bxml/verbs/resume_recording_spec.rb +18 -0
  290. data/spec/unit/models/bxml/verbs/ring_spec.rb +38 -0
  291. data/spec/unit/models/bxml/verbs/send_dtmf_spec.rb +38 -0
  292. data/spec/unit/models/bxml/verbs/sip_uri_spec.rb +58 -0
  293. data/spec/unit/models/bxml/verbs/speak_sentence_spec.rb +40 -0
  294. data/spec/unit/models/bxml/verbs/start_gather_spec.rb +44 -0
  295. data/spec/unit/models/bxml/verbs/start_recording_spec.rb +54 -0
  296. data/spec/unit/models/bxml/verbs/start_stream_spec.rb +74 -0
  297. data/spec/unit/models/bxml/verbs/stop_gather_spec.rb +18 -0
  298. data/spec/unit/models/bxml/verbs/stop_recording_spec.rb +18 -0
  299. data/spec/unit/models/bxml/verbs/stop_stream_spec.rb +36 -0
  300. data/spec/unit/models/bxml/verbs/stream_param_spec.rb +38 -0
  301. data/spec/unit/models/bxml/verbs/tag_spec.rb +18 -0
  302. data/spec/unit/models/bxml/verbs/transfer_spec.rb +86 -0
  303. data/spec/unit/models/call_direction_enum_spec.rb +28 -0
  304. data/spec/unit/models/call_recording_metadata_spec.rb +136 -0
  305. data/spec/unit/models/call_state_enum_spec.rb +28 -0
  306. data/spec/unit/models/call_state_spec.rb +136 -0
  307. data/spec/unit/models/callback_method_enum_spec.rb +28 -0
  308. data/spec/unit/models/code_request_spec.rb +64 -0
  309. data/spec/unit/models/conference_completed_callback_spec.rb +58 -0
  310. data/spec/unit/models/conference_created_callback_spec.rb +58 -0
  311. data/spec/unit/models/conference_member_exit_callback_spec.rb +76 -0
  312. data/spec/unit/models/conference_member_join_callback_spec.rb +76 -0
  313. data/spec/unit/models/conference_member_spec.rb +64 -0
  314. data/spec/unit/models/conference_recording_available_callback_spec.rb +112 -0
  315. data/spec/unit/models/conference_recording_metadata_spec.rb +94 -0
  316. data/spec/unit/models/conference_redirect_callback_spec.rb +58 -0
  317. data/spec/unit/models/conference_spec.rb +76 -0
  318. data/spec/unit/models/conference_state_enum_spec.rb +28 -0
  319. data/spec/unit/models/create_call_response_spec.rb +154 -0
  320. data/spec/unit/models/create_call_spec.rb +142 -0
  321. data/spec/unit/models/create_lookup_response_spec.rb +40 -0
  322. data/spec/unit/models/create_message_request_error_spec.rb +46 -0
  323. data/spec/unit/models/deferred_result_spec.rb +40 -0
  324. data/spec/unit/models/disconnect_callback_spec.rb +130 -0
  325. data/spec/unit/models/diversion_spec.rb +70 -0
  326. data/spec/unit/models/dtmf_callback_spec.rb +130 -0
  327. data/spec/unit/models/field_error_spec.rb +40 -0
  328. data/spec/unit/models/file_format_enum_spec.rb +28 -0
  329. data/spec/unit/models/gather_callback_spec.rb +136 -0
  330. data/spec/unit/models/inbound_message_callback_message_spec.rb +100 -0
  331. data/spec/unit/models/inbound_message_callback_spec.rb +58 -0
  332. data/spec/unit/models/initiate_callback_spec.rb +100 -0
  333. data/spec/unit/models/list_message_direction_enum_spec.rb +28 -0
  334. data/spec/unit/models/list_message_item_spec.rb +124 -0
  335. data/spec/unit/models/lookup_request_spec.rb +34 -0
  336. data/spec/unit/models/lookup_result_spec.rb +82 -0
  337. data/spec/unit/models/lookup_status_enum_spec.rb +28 -0
  338. data/spec/unit/models/lookup_status_spec.rb +52 -0
  339. data/spec/unit/models/machine_detection_complete_callback_spec.rb +112 -0
  340. data/spec/unit/models/machine_detection_configuration_spec.rb +118 -0
  341. data/spec/unit/models/machine_detection_mode_enum_spec.rb +28 -0
  342. data/spec/unit/models/media_spec.rb +46 -0
  343. data/spec/unit/models/message_delivered_callback_message_spec.rb +100 -0
  344. data/spec/unit/models/message_delivered_callback_spec.rb +58 -0
  345. data/spec/unit/models/message_direction_enum_spec.rb +28 -0
  346. data/spec/unit/models/message_failed_callback_message_spec.rb +100 -0
  347. data/spec/unit/models/message_failed_callback_spec.rb +64 -0
  348. data/spec/unit/models/message_request_spec.rb +76 -0
  349. data/spec/unit/models/message_sending_callback_message_spec.rb +100 -0
  350. data/spec/unit/models/message_sending_callback_spec.rb +58 -0
  351. data/spec/unit/models/message_spec.rb +100 -0
  352. data/spec/unit/models/message_status_enum_spec.rb +28 -0
  353. data/spec/unit/models/message_type_enum_spec.rb +28 -0
  354. data/spec/unit/models/messages_list_spec.rb +46 -0
  355. data/spec/unit/models/messaging_code_response_spec.rb +34 -0
  356. data/spec/unit/models/messaging_request_error_spec.rb +40 -0
  357. data/spec/unit/models/mfa_forbidden_request_error_spec.rb +34 -0
  358. data/spec/unit/models/mfa_request_error_spec.rb +40 -0
  359. data/spec/unit/models/mfa_unauthorized_request_error_spec.rb +34 -0
  360. data/spec/unit/models/page_info_spec.rb +52 -0
  361. data/spec/unit/models/priority_enum_spec.rb +28 -0
  362. data/spec/unit/models/recording_available_callback_spec.rb +160 -0
  363. data/spec/unit/models/recording_complete_callback_spec.rb +160 -0
  364. data/spec/unit/models/recording_state_enum_spec.rb +28 -0
  365. data/spec/unit/models/redirect_callback_spec.rb +124 -0
  366. data/spec/unit/models/redirect_method_enum_spec.rb +28 -0
  367. data/spec/unit/models/stir_shaken_spec.rb +46 -0
  368. data/spec/unit/models/tag_spec.rb +40 -0
  369. data/spec/unit/models/tn_lookup_request_error_spec.rb +34 -0
  370. data/spec/unit/models/transcribe_recording_spec.rb +64 -0
  371. data/spec/unit/models/transcription_available_callback_spec.rb +154 -0
  372. data/spec/unit/models/transcription_list_spec.rb +34 -0
  373. data/spec/unit/models/transcription_metadata_spec.rb +52 -0
  374. data/spec/unit/models/transcription_spec.rb +40 -0
  375. data/spec/unit/models/transfer_answer_callback_spec.rb +118 -0
  376. data/spec/unit/models/transfer_complete_callback_spec.rb +136 -0
  377. data/spec/unit/models/transfer_disconnect_callback_spec.rb +148 -0
  378. data/spec/unit/models/update_call_recording_spec.rb +34 -0
  379. data/spec/unit/models/update_call_spec.rb +88 -0
  380. data/spec/unit/models/update_conference_member_spec.rb +46 -0
  381. data/spec/unit/models/update_conference_spec.rb +82 -0
  382. data/spec/unit/models/verify_code_request_spec.rb +52 -0
  383. data/spec/unit/models/verify_code_response_spec.rb +34 -0
  384. data/spec/unit/models/voice_api_error_spec.rb +46 -0
  385. data/spec/unit/models/voice_code_response_spec.rb +34 -0
  386. metadata +544 -249
  387. data/LICENSE +0 -28
  388. data/lib/bandwidth/api_helper.rb +0 -280
  389. data/lib/bandwidth/client.rb +0 -75
  390. data/lib/bandwidth/configuration.rb +0 -209
  391. data/lib/bandwidth/exceptions/api_exception.rb +0 -20
  392. data/lib/bandwidth/http/api_response.rb +0 -38
  393. data/lib/bandwidth/http/auth/messaging_basic_auth.rb +0 -22
  394. data/lib/bandwidth/http/auth/multi_factor_auth_basic_auth.rb +0 -22
  395. data/lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb +0 -22
  396. data/lib/bandwidth/http/auth/voice_basic_auth.rb +0 -22
  397. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +0 -22
  398. data/lib/bandwidth/http/faraday_client.rb +0 -70
  399. data/lib/bandwidth/http/http_call_back.rb +0 -24
  400. data/lib/bandwidth/http/http_client.rb +0 -104
  401. data/lib/bandwidth/http/http_method_enum.rb +0 -13
  402. data/lib/bandwidth/http/http_request.rb +0 -50
  403. data/lib/bandwidth/http/http_response.rb +0 -29
  404. data/lib/bandwidth/messaging_lib/messaging/client.rb +0 -60
  405. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +0 -491
  406. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +0 -47
  407. data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +0 -37
  408. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +0 -100
  409. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +0 -174
  410. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +0 -203
  411. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +0 -79
  412. data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +0 -60
  413. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +0 -70
  414. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +0 -122
  415. data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +0 -82
  416. data/lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb +0 -19
  417. data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +0 -60
  418. data/lib/bandwidth/messaging_lib/messaging.rb +0 -25
  419. data/lib/bandwidth/models/base_model.rb +0 -58
  420. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/client.rb +0 -60
  421. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +0 -47
  422. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +0 -214
  423. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +0 -37
  424. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +0 -32
  425. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +0 -32
  426. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +0 -103
  427. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +0 -50
  428. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +0 -50
  429. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +0 -94
  430. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +0 -50
  431. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +0 -23
  432. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/client.rb +0 -60
  433. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +0 -1553
  434. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +0 -47
  435. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +0 -32
  436. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +0 -50
  437. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +0 -61
  438. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +0 -95
  439. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +0 -132
  440. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb +0 -20
  441. data/lib/bandwidth/utilities/date_time_helper.rb +0 -156
  442. data/lib/bandwidth/utilities/file_wrapper.rb +0 -16
  443. data/lib/bandwidth/voice_lib/bxml/bxml.rb +0 -36
  444. data/lib/bandwidth/voice_lib/bxml/response.rb +0 -39
  445. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +0 -28
  446. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +0 -32
  447. data/lib/bandwidth/voice_lib/bxml/verbs/forward.rb +0 -18
  448. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +0 -49
  449. data/lib/bandwidth/voice_lib/bxml/verbs/hangup.rb +0 -14
  450. data/lib/bandwidth/voice_lib/bxml/verbs/pause.rb +0 -15
  451. data/lib/bandwidth/voice_lib/bxml/verbs/pause_recording.rb +0 -14
  452. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +0 -24
  453. data/lib/bandwidth/voice_lib/bxml/verbs/play_audio.rb +0 -17
  454. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +0 -34
  455. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +0 -24
  456. data/lib/bandwidth/voice_lib/bxml/verbs/resume_recording.rb +0 -14
  457. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +0 -16
  458. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +0 -16
  459. data/lib/bandwidth/voice_lib/bxml/verbs/sip_uri.rb +0 -25
  460. data/lib/bandwidth/voice_lib/bxml/verbs/speak_sentence.rb +0 -18
  461. data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +0 -20
  462. data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +0 -26
  463. data/lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb +0 -41
  464. data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +0 -14
  465. data/lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb +0 -14
  466. data/lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb +0 -16
  467. data/lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb +0 -17
  468. data/lib/bandwidth/voice_lib/bxml/verbs/tag.rb +0 -13
  469. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +0 -48
  470. data/lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb +0 -26
  471. data/lib/bandwidth/voice_lib/voice/client.rb +0 -60
  472. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +0 -1820
  473. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +0 -47
  474. data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +0 -42
  475. data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +0 -17
  476. data/lib/bandwidth/voice_lib/voice/models/answer_method_enum.rb +0 -17
  477. data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +0 -343
  478. data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +0 -250
  479. data/lib/bandwidth/voice_lib/voice/models/call_state.rb +0 -301
  480. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +0 -17
  481. data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +0 -211
  482. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +0 -17
  483. data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +0 -103
  484. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +0 -173
  485. data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +0 -153
  486. data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +0 -236
  487. data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +0 -266
  488. data/lib/bandwidth/voice_lib/voice/models/direction_enum.rb +0 -17
  489. data/lib/bandwidth/voice_lib/voice/models/disconnect_method_enum.rb +0 -17
  490. data/lib/bandwidth/voice_lib/voice/models/diversion.rb +0 -80
  491. data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +0 -17
  492. data/lib/bandwidth/voice_lib/voice/models/file_format_enum.rb +0 -17
  493. data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +0 -231
  494. data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +0 -20
  495. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +0 -48
  496. data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +0 -156
  497. data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +0 -144
  498. data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +0 -17
  499. data/lib/bandwidth/voice_lib/voice/models/redirect_method_enum.rb +0 -17
  500. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +0 -20
  501. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +0 -17
  502. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +0 -17
  503. data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +0 -120
  504. data/lib/bandwidth/voice_lib/voice/models/transcript.rb +0 -60
  505. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +0 -80
  506. data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +0 -89
  507. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +0 -59
  508. data/lib/bandwidth/voice_lib/voice.rb +0 -48
  509. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +0 -18
  510. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +0 -60
  511. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +0 -703
  512. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +0 -47
  513. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +0 -37
  514. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +0 -62
  515. data/lib/bandwidth/web_rtc_lib/web_rtc/models/device_api_version_enum.rb +0 -17
  516. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +0 -115
  517. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +0 -48
  518. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +0 -17
  519. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +0 -60
  520. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +0 -71
  521. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +0 -22
  522. data/lib/bandwidth.rb +0 -72
  523. data/test/controllers/controller_test_base.rb +0 -21
  524. data/test/http_response_catcher.rb +0 -19
  525. data/test/integration/test_integration.rb +0 -769
  526. data/test/test_helper.rb +0 -94
@@ -1,1820 +0,0 @@
1
- # bandwidth
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Bandwidth
7
- module Voice
8
- # APIController
9
- class APIController < BaseController
10
- def initialize(config, http_call_back: nil)
11
- super(config, http_call_back: http_call_back)
12
- end
13
-
14
- # Creates an outbound phone call.
15
- # @param [String] account_id Required parameter: Example:
16
- # @param [CreateCallRequest] body Required parameter: Example:
17
- # @return [CreateCallResponse] response from the API call
18
- def create_call(account_id,
19
- body)
20
- # Prepare query url.
21
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
22
- _query_builder << '/api/v2/accounts/{accountId}/calls'
23
- _query_builder = APIHelper.append_url_with_template_parameters(
24
- _query_builder,
25
- 'accountId' => { 'value' => account_id, 'encode' => false }
26
- )
27
- _query_url = APIHelper.clean_url _query_builder
28
-
29
- # Prepare headers.
30
- _headers = {
31
- 'accept' => 'application/json',
32
- 'content-type' => 'application/json; charset=utf-8'
33
- }
34
-
35
- # Prepare and execute HttpRequest.
36
- _request = config.http_client.post(
37
- _query_url,
38
- headers: _headers,
39
- parameters: body.to_json
40
- )
41
- VoiceBasicAuth.apply(config, _request)
42
- _response = execute_request(_request)
43
-
44
- # Validate response against endpoint and global error codes.
45
- case _response.status_code
46
- when 400
47
- raise ApiErrorException.new(
48
- 'Something\'s not quite right... Your request is invalid. Please' \
49
- ' fix it before trying again.',
50
- _response
51
- )
52
- when 401
53
- raise APIException.new(
54
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
55
- ' credentials to authenticate to the API.',
56
- _response
57
- )
58
- when 403
59
- raise ApiErrorException.new(
60
- 'User unauthorized to perform this action.',
61
- _response
62
- )
63
- when 404
64
- raise ApiErrorException.new(
65
- 'The resource specified cannot be found or does not belong to you.',
66
- _response
67
- )
68
- when 415
69
- raise ApiErrorException.new(
70
- 'We don\'t support that media type. If a request body is required,' \
71
- ' please send it to us as `application/json`.',
72
- _response
73
- )
74
- when 429
75
- raise ApiErrorException.new(
76
- 'You\'re sending requests to this endpoint too frequently. Please' \
77
- ' slow your request rate down and try again.',
78
- _response
79
- )
80
- when 500
81
- raise ApiErrorException.new(
82
- 'Something unexpected happened. Please try again.',
83
- _response
84
- )
85
- end
86
- validate_response(_response)
87
-
88
- # Return appropriate response type.
89
- decoded = APIHelper.json_deserialize(_response.raw_body)
90
- ApiResponse.new(
91
- _response, data: CreateCallResponse.from_hash(decoded)
92
- )
93
- end
94
-
95
- # Returns near-realtime metadata about the specified call.
96
- # @param [String] account_id Required parameter: Example:
97
- # @param [String] call_id Required parameter: Example:
98
- # @return [CallState] response from the API call
99
- def get_call(account_id,
100
- call_id)
101
- # Prepare query url.
102
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
103
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
104
- _query_builder = APIHelper.append_url_with_template_parameters(
105
- _query_builder,
106
- 'accountId' => { 'value' => account_id, 'encode' => false },
107
- 'callId' => { 'value' => call_id, 'encode' => false }
108
- )
109
- _query_url = APIHelper.clean_url _query_builder
110
-
111
- # Prepare headers.
112
- _headers = {
113
- 'accept' => 'application/json'
114
- }
115
-
116
- # Prepare and execute HttpRequest.
117
- _request = config.http_client.get(
118
- _query_url,
119
- headers: _headers
120
- )
121
- VoiceBasicAuth.apply(config, _request)
122
- _response = execute_request(_request)
123
-
124
- # Validate response against endpoint and global error codes.
125
- case _response.status_code
126
- when 400
127
- raise ApiErrorException.new(
128
- 'Something\'s not quite right... Your request is invalid. Please' \
129
- ' fix it before trying again.',
130
- _response
131
- )
132
- when 401
133
- raise APIException.new(
134
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
135
- ' credentials to authenticate to the API.',
136
- _response
137
- )
138
- when 403
139
- raise ApiErrorException.new(
140
- 'User unauthorized to perform this action.',
141
- _response
142
- )
143
- when 404
144
- raise ApiErrorException.new(
145
- 'The resource specified cannot be found or does not belong to you.',
146
- _response
147
- )
148
- when 415
149
- raise ApiErrorException.new(
150
- 'We don\'t support that media type. If a request body is required,' \
151
- ' please send it to us as `application/json`.',
152
- _response
153
- )
154
- when 429
155
- raise ApiErrorException.new(
156
- 'You\'re sending requests to this endpoint too frequently. Please' \
157
- ' slow your request rate down and try again.',
158
- _response
159
- )
160
- when 500
161
- raise ApiErrorException.new(
162
- 'Something unexpected happened. Please try again.',
163
- _response
164
- )
165
- end
166
- validate_response(_response)
167
-
168
- # Return appropriate response type.
169
- decoded = APIHelper.json_deserialize(_response.raw_body)
170
- ApiResponse.new(
171
- _response, data: CallState.from_hash(decoded)
172
- )
173
- end
174
-
175
- # Interrupts and replaces an active call's BXML document.
176
- # @param [String] account_id Required parameter: Example:
177
- # @param [String] call_id Required parameter: Example:
178
- # @param [ModifyCallRequest] body Required parameter: Example:
179
- # @return [void] response from the API call
180
- def modify_call(account_id,
181
- call_id,
182
- body)
183
- # Prepare query url.
184
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
185
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
186
- _query_builder = APIHelper.append_url_with_template_parameters(
187
- _query_builder,
188
- 'accountId' => { 'value' => account_id, 'encode' => false },
189
- 'callId' => { 'value' => call_id, 'encode' => false }
190
- )
191
- _query_url = APIHelper.clean_url _query_builder
192
-
193
- # Prepare headers.
194
- _headers = {
195
- 'content-type' => 'application/json; charset=utf-8'
196
- }
197
-
198
- # Prepare and execute HttpRequest.
199
- _request = config.http_client.post(
200
- _query_url,
201
- headers: _headers,
202
- parameters: body.to_json
203
- )
204
- VoiceBasicAuth.apply(config, _request)
205
- _response = execute_request(_request)
206
-
207
- # Validate response against endpoint and global error codes.
208
- case _response.status_code
209
- when 400
210
- raise ApiErrorException.new(
211
- 'Something\'s not quite right... Your request is invalid. Please' \
212
- ' fix it before trying again.',
213
- _response
214
- )
215
- when 401
216
- raise APIException.new(
217
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
218
- ' credentials to authenticate to the API.',
219
- _response
220
- )
221
- when 403
222
- raise ApiErrorException.new(
223
- 'User unauthorized to perform this action.',
224
- _response
225
- )
226
- when 404
227
- raise ApiErrorException.new(
228
- 'The resource specified cannot be found or does not belong to you.',
229
- _response
230
- )
231
- when 415
232
- raise ApiErrorException.new(
233
- 'We don\'t support that media type. If a request body is required,' \
234
- ' please send it to us as `application/json`.',
235
- _response
236
- )
237
- when 429
238
- raise ApiErrorException.new(
239
- 'You\'re sending requests to this endpoint too frequently. Please' \
240
- ' slow your request rate down and try again.',
241
- _response
242
- )
243
- when 500
244
- raise ApiErrorException.new(
245
- 'Something unexpected happened. Please try again.',
246
- _response
247
- )
248
- end
249
- validate_response(_response)
250
-
251
- # Return appropriate response type.
252
- ApiResponse.new(_response)
253
- end
254
-
255
- # Makes a PUT request to /api/v2/accounts/{accountId}/calls/{callId}/bxml
256
- # @param [String] account_id Required parameter: Example:
257
- # @param [String] call_id Required parameter: Example:
258
- # @param [String] body Required parameter: Example:
259
- # @return [void] response from the API call
260
- def modify_call_bxml(account_id,
261
- call_id,
262
- body
263
- )
264
- # Prepare query url.
265
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
266
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/bxml'
267
- _query_builder = APIHelper.append_url_with_template_parameters(
268
- _query_builder,
269
- 'accountId' => { 'value' => account_id, 'encode' => false },
270
- 'callId' => { 'value' => call_id, 'encode' => false }
271
- )
272
- _query_url = APIHelper.clean_url _query_builder
273
-
274
- # Prepare headers.
275
- _headers = {
276
- 'content-type' => 'application/xml; charset=utf-8'
277
- }
278
-
279
- # Prepare and execute HttpRequest.
280
- _request = config.http_client.put(
281
- _query_url,
282
- headers: _headers,
283
- parameters: body.to_json
284
- )
285
- VoiceBasicAuth.apply(config, _request)
286
- _response = execute_request(_request)
287
-
288
- # Validate response against endpoint and global error codes.
289
- case _response.status_code
290
- when 400
291
- raise ApiErrorException.new(
292
- 'Something\'s not quite right... Your request is invalid. Please' \
293
- ' fix it before trying again.',
294
- _response
295
- )
296
- when 401
297
- raise APIException.new(
298
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
299
- ' credentials to authenticate to the API.',
300
- _response
301
- )
302
- when 403
303
- raise ApiErrorException.new(
304
- 'User unauthorized to perform this action.',
305
- _response
306
- )
307
- when 404
308
- raise ApiErrorException.new(
309
- 'The resource specified cannot be found or does not belong to you.',
310
- _response
311
- )
312
- when 415
313
- raise ApiErrorException.new(
314
- 'We don\'t support that media type. If a request body is required,' \
315
- ' please send it to us as `application/xml`.',
316
- _response
317
- )
318
- when 429
319
- raise ApiErrorException.new(
320
- 'You\'re sending requests to this endpoint too frequently. Please' \
321
- ' slow your request rate down and try again.',
322
- _response
323
- )
324
- when 500
325
- raise ApiErrorException.new(
326
- 'Something unexpected happened. Please try again.',
327
- _response
328
- )
329
- end
330
- validate_response(_response)
331
-
332
- # Return appropriate response type.
333
- ApiResponse.new(_response)
334
- end
335
-
336
- # Pauses or resumes a recording.
337
- # @param [String] account_id Required parameter: Example:
338
- # @param [String] call_id Required parameter: Example:
339
- # @param [ModifyCallRecordingRequest] body Required parameter: Example:
340
- # @return [void] response from the API call
341
- def modify_call_recording_state(account_id,
342
- call_id,
343
- body)
344
- # Prepare query url.
345
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
346
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
347
- _query_builder = APIHelper.append_url_with_template_parameters(
348
- _query_builder,
349
- 'accountId' => { 'value' => account_id, 'encode' => false },
350
- 'callId' => { 'value' => call_id, 'encode' => false }
351
- )
352
- _query_url = APIHelper.clean_url _query_builder
353
-
354
- # Prepare headers.
355
- _headers = {
356
- 'content-type' => 'application/json; charset=utf-8'
357
- }
358
-
359
- # Prepare and execute HttpRequest.
360
- _request = config.http_client.put(
361
- _query_url,
362
- headers: _headers,
363
- parameters: body.to_json
364
- )
365
- VoiceBasicAuth.apply(config, _request)
366
- _response = execute_request(_request)
367
-
368
- # Validate response against endpoint and global error codes.
369
- case _response.status_code
370
- when 400
371
- raise ApiErrorException.new(
372
- 'Something\'s not quite right... Your request is invalid. Please' \
373
- ' fix it before trying again.',
374
- _response
375
- )
376
- when 401
377
- raise APIException.new(
378
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
379
- ' credentials to authenticate to the API.',
380
- _response
381
- )
382
- when 403
383
- raise ApiErrorException.new(
384
- 'User unauthorized to perform this action.',
385
- _response
386
- )
387
- when 404
388
- raise ApiErrorException.new(
389
- 'The resource specified cannot be found or does not belong to you.',
390
- _response
391
- )
392
- when 415
393
- raise ApiErrorException.new(
394
- 'We don\'t support that media type. If a request body is required,' \
395
- ' please send it to us as `application/json`.',
396
- _response
397
- )
398
- when 429
399
- raise ApiErrorException.new(
400
- 'You\'re sending requests to this endpoint too frequently. Please' \
401
- ' slow your request rate down and try again.',
402
- _response
403
- )
404
- when 500
405
- raise ApiErrorException.new(
406
- 'Something unexpected happened. Please try again.',
407
- _response
408
- )
409
- end
410
- validate_response(_response)
411
-
412
- # Return appropriate response type.
413
- ApiResponse.new(_response)
414
- end
415
-
416
- # Returns a (potentially empty) list of metadata for the recordings that
417
- # took place during the specified call.
418
- # @param [String] account_id Required parameter: Example:
419
- # @param [String] call_id Required parameter: Example:
420
- # @return [List of CallRecordingMetadata] response from the API call
421
- def get_call_recordings(account_id,
422
- call_id)
423
- # Prepare query url.
424
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
425
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
426
- _query_builder = APIHelper.append_url_with_template_parameters(
427
- _query_builder,
428
- 'accountId' => { 'value' => account_id, 'encode' => false },
429
- 'callId' => { 'value' => call_id, 'encode' => false }
430
- )
431
- _query_url = APIHelper.clean_url _query_builder
432
-
433
- # Prepare headers.
434
- _headers = {
435
- 'accept' => 'application/json'
436
- }
437
-
438
- # Prepare and execute HttpRequest.
439
- _request = config.http_client.get(
440
- _query_url,
441
- headers: _headers
442
- )
443
- VoiceBasicAuth.apply(config, _request)
444
- _response = execute_request(_request)
445
-
446
- # Validate response against endpoint and global error codes.
447
- case _response.status_code
448
- when 400
449
- raise ApiErrorException.new(
450
- 'Something\'s not quite right... Your request is invalid. Please' \
451
- ' fix it before trying again.',
452
- _response
453
- )
454
- when 401
455
- raise APIException.new(
456
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
457
- ' credentials to authenticate to the API.',
458
- _response
459
- )
460
- when 403
461
- raise ApiErrorException.new(
462
- 'User unauthorized to perform this action.',
463
- _response
464
- )
465
- when 404
466
- raise ApiErrorException.new(
467
- 'The resource specified cannot be found or does not belong to you.',
468
- _response
469
- )
470
- when 415
471
- raise ApiErrorException.new(
472
- 'We don\'t support that media type. If a request body is required,' \
473
- ' please send it to us as `application/json`.',
474
- _response
475
- )
476
- when 429
477
- raise ApiErrorException.new(
478
- 'You\'re sending requests to this endpoint too frequently. Please' \
479
- ' slow your request rate down and try again.',
480
- _response
481
- )
482
- when 500
483
- raise ApiErrorException.new(
484
- 'Something unexpected happened. Please try again.',
485
- _response
486
- )
487
- end
488
- validate_response(_response)
489
-
490
- # Return appropriate response type.
491
- decoded = APIHelper.json_deserialize(_response.raw_body)
492
- ApiResponse.new(
493
- _response,
494
- data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
495
- )
496
- end
497
-
498
- # Returns metadata for the specified recording.
499
- # @param [String] account_id Required parameter: Example:
500
- # @param [String] call_id Required parameter: Example:
501
- # @param [String] recording_id Required parameter: Example:
502
- # @return [CallRecordingMetadata] response from the API call
503
- def get_call_recording(account_id,
504
- call_id,
505
- recording_id)
506
- # Prepare query url.
507
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
508
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
509
- _query_builder = APIHelper.append_url_with_template_parameters(
510
- _query_builder,
511
- 'accountId' => { 'value' => account_id, 'encode' => false },
512
- 'callId' => { 'value' => call_id, 'encode' => false },
513
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
514
- )
515
- _query_url = APIHelper.clean_url _query_builder
516
-
517
- # Prepare headers.
518
- _headers = {
519
- 'accept' => 'application/json'
520
- }
521
-
522
- # Prepare and execute HttpRequest.
523
- _request = config.http_client.get(
524
- _query_url,
525
- headers: _headers
526
- )
527
- VoiceBasicAuth.apply(config, _request)
528
- _response = execute_request(_request)
529
-
530
- # Validate response against endpoint and global error codes.
531
- case _response.status_code
532
- when 400
533
- raise ApiErrorException.new(
534
- 'Something\'s not quite right... Your request is invalid. Please' \
535
- ' fix it before trying again.',
536
- _response
537
- )
538
- when 401
539
- raise APIException.new(
540
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
541
- ' credentials to authenticate to the API.',
542
- _response
543
- )
544
- when 403
545
- raise ApiErrorException.new(
546
- 'User unauthorized to perform this action.',
547
- _response
548
- )
549
- when 404
550
- raise ApiErrorException.new(
551
- 'The resource specified cannot be found or does not belong to you.',
552
- _response
553
- )
554
- when 415
555
- raise ApiErrorException.new(
556
- 'We don\'t support that media type. If a request body is required,' \
557
- ' please send it to us as `application/json`.',
558
- _response
559
- )
560
- when 429
561
- raise ApiErrorException.new(
562
- 'You\'re sending requests to this endpoint too frequently. Please' \
563
- ' slow your request rate down and try again.',
564
- _response
565
- )
566
- when 500
567
- raise ApiErrorException.new(
568
- 'Something unexpected happened. Please try again.',
569
- _response
570
- )
571
- end
572
- validate_response(_response)
573
-
574
- # Return appropriate response type.
575
- decoded = APIHelper.json_deserialize(_response.raw_body)
576
- ApiResponse.new(
577
- _response, data: CallRecordingMetadata.from_hash(decoded)
578
- )
579
- end
580
-
581
- # Deletes the specified recording.
582
- # @param [String] account_id Required parameter: Example:
583
- # @param [String] call_id Required parameter: Example:
584
- # @param [String] recording_id Required parameter: Example:
585
- # @return [void] response from the API call
586
- def delete_recording(account_id,
587
- call_id,
588
- recording_id)
589
- # Prepare query url.
590
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
591
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
592
- _query_builder = APIHelper.append_url_with_template_parameters(
593
- _query_builder,
594
- 'accountId' => { 'value' => account_id, 'encode' => false },
595
- 'callId' => { 'value' => call_id, 'encode' => false },
596
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
597
- )
598
- _query_url = APIHelper.clean_url _query_builder
599
-
600
- # Prepare and execute HttpRequest.
601
- _request = config.http_client.delete(
602
- _query_url
603
- )
604
- VoiceBasicAuth.apply(config, _request)
605
- _response = execute_request(_request)
606
-
607
- # Validate response against endpoint and global error codes.
608
- case _response.status_code
609
- when 400
610
- raise ApiErrorException.new(
611
- 'Something\'s not quite right... Your request is invalid. Please' \
612
- ' fix it before trying again.',
613
- _response
614
- )
615
- when 401
616
- raise APIException.new(
617
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
618
- ' credentials to authenticate to the API.',
619
- _response
620
- )
621
- when 403
622
- raise ApiErrorException.new(
623
- 'User unauthorized to perform this action.',
624
- _response
625
- )
626
- when 404
627
- raise ApiErrorException.new(
628
- 'The resource specified cannot be found or does not belong to you.',
629
- _response
630
- )
631
- when 415
632
- raise ApiErrorException.new(
633
- 'We don\'t support that media type. If a request body is required,' \
634
- ' please send it to us as `application/json`.',
635
- _response
636
- )
637
- when 429
638
- raise ApiErrorException.new(
639
- 'You\'re sending requests to this endpoint too frequently. Please' \
640
- ' slow your request rate down and try again.',
641
- _response
642
- )
643
- when 500
644
- raise ApiErrorException.new(
645
- 'Something unexpected happened. Please try again.',
646
- _response
647
- )
648
- end
649
- validate_response(_response)
650
-
651
- # Return appropriate response type.
652
- ApiResponse.new(_response)
653
- end
654
-
655
- # Downloads the specified recording.
656
- # @param [String] account_id Required parameter: Example:
657
- # @param [String] call_id Required parameter: Example:
658
- # @param [String] recording_id Required parameter: Example:
659
- # @return [Mixed] response from the API call
660
- def get_download_call_recording(account_id,
661
- call_id,
662
- recording_id)
663
- # Prepare query url.
664
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
665
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
666
- _query_builder = APIHelper.append_url_with_template_parameters(
667
- _query_builder,
668
- 'accountId' => { 'value' => account_id, 'encode' => false },
669
- 'callId' => { 'value' => call_id, 'encode' => false },
670
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
671
- )
672
- _query_url = APIHelper.clean_url _query_builder
673
-
674
- # Prepare and execute HttpRequest.
675
- _request = config.http_client.get(
676
- _query_url
677
- )
678
- VoiceBasicAuth.apply(config, _request)
679
- _response = execute_request(_request)
680
-
681
- # Validate response against endpoint and global error codes.
682
- case _response.status_code
683
- when 400
684
- raise ApiErrorException.new(
685
- 'Something\'s not quite right... Your request is invalid. Please' \
686
- ' fix it before trying again.',
687
- _response
688
- )
689
- when 401
690
- raise APIException.new(
691
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
692
- ' credentials to authenticate to the API.',
693
- _response
694
- )
695
- when 403
696
- raise ApiErrorException.new(
697
- 'User unauthorized to perform this action.',
698
- _response
699
- )
700
- when 404
701
- raise ApiErrorException.new(
702
- 'The resource specified cannot be found or does not belong to you.',
703
- _response
704
- )
705
- when 415
706
- raise ApiErrorException.new(
707
- 'We don\'t support that media type. If a request body is required,' \
708
- ' please send it to us as `application/json`.',
709
- _response
710
- )
711
- when 429
712
- raise ApiErrorException.new(
713
- 'You\'re sending requests to this endpoint too frequently. Please' \
714
- ' slow your request rate down and try again.',
715
- _response
716
- )
717
- when 500
718
- raise ApiErrorException.new(
719
- 'Something unexpected happened. Please try again.',
720
- _response
721
- )
722
- end
723
- validate_response(_response)
724
-
725
- # Return appropriate response type.
726
- ApiResponse.new(
727
- _response, data: _response.raw_body
728
- )
729
- end
730
-
731
- # Deletes the specified recording's media.
732
- # @param [String] account_id Required parameter: Example:
733
- # @param [String] call_id Required parameter: Example:
734
- # @param [String] recording_id Required parameter: Example:
735
- # @return [void] response from the API call
736
- def delete_recording_media(account_id,
737
- call_id,
738
- recording_id)
739
- # Prepare query url.
740
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
741
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
742
- _query_builder = APIHelper.append_url_with_template_parameters(
743
- _query_builder,
744
- 'accountId' => { 'value' => account_id, 'encode' => false },
745
- 'callId' => { 'value' => call_id, 'encode' => false },
746
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
747
- )
748
- _query_url = APIHelper.clean_url _query_builder
749
-
750
- # Prepare and execute HttpRequest.
751
- _request = config.http_client.delete(
752
- _query_url
753
- )
754
- VoiceBasicAuth.apply(config, _request)
755
- _response = execute_request(_request)
756
-
757
- # Validate response against endpoint and global error codes.
758
- case _response.status_code
759
- when 400
760
- raise ApiErrorException.new(
761
- 'Something\'s not quite right... Your request is invalid. Please' \
762
- ' fix it before trying again.',
763
- _response
764
- )
765
- when 401
766
- raise APIException.new(
767
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
768
- ' credentials to authenticate to the API.',
769
- _response
770
- )
771
- when 403
772
- raise ApiErrorException.new(
773
- 'User unauthorized to perform this action.',
774
- _response
775
- )
776
- when 404
777
- raise ApiErrorException.new(
778
- 'The resource specified cannot be found or does not belong to you.',
779
- _response
780
- )
781
- when 415
782
- raise ApiErrorException.new(
783
- 'We don\'t support that media type. If a request body is required,' \
784
- ' please send it to us as `application/json`.',
785
- _response
786
- )
787
- when 429
788
- raise ApiErrorException.new(
789
- 'You\'re sending requests to this endpoint too frequently. Please' \
790
- ' slow your request rate down and try again.',
791
- _response
792
- )
793
- when 500
794
- raise ApiErrorException.new(
795
- 'Something unexpected happened. Please try again.',
796
- _response
797
- )
798
- end
799
- validate_response(_response)
800
-
801
- # Return appropriate response type.
802
- ApiResponse.new(_response)
803
- end
804
-
805
- # Downloads the specified transcription.
806
- # @param [String] account_id Required parameter: Example:
807
- # @param [String] call_id Required parameter: Example:
808
- # @param [String] recording_id Required parameter: Example:
809
- # @return [TranscriptionResponse] response from the API call
810
- def get_call_transcription(account_id,
811
- call_id,
812
- recording_id)
813
- # Prepare query url.
814
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
815
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
816
- _query_builder = APIHelper.append_url_with_template_parameters(
817
- _query_builder,
818
- 'accountId' => { 'value' => account_id, 'encode' => false },
819
- 'callId' => { 'value' => call_id, 'encode' => false },
820
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
821
- )
822
- _query_url = APIHelper.clean_url _query_builder
823
-
824
- # Prepare headers.
825
- _headers = {
826
- 'accept' => 'application/json'
827
- }
828
-
829
- # Prepare and execute HttpRequest.
830
- _request = config.http_client.get(
831
- _query_url,
832
- headers: _headers
833
- )
834
- VoiceBasicAuth.apply(config, _request)
835
- _response = execute_request(_request)
836
-
837
- # Validate response against endpoint and global error codes.
838
- case _response.status_code
839
- when 400
840
- raise ApiErrorException.new(
841
- 'Something\'s not quite right... Your request is invalid. Please' \
842
- ' fix it before trying again.',
843
- _response
844
- )
845
- when 401
846
- raise APIException.new(
847
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
848
- ' credentials to authenticate to the API.',
849
- _response
850
- )
851
- when 403
852
- raise ApiErrorException.new(
853
- 'User unauthorized to perform this action.',
854
- _response
855
- )
856
- when 404
857
- raise ApiErrorException.new(
858
- 'The resource specified cannot be found or does not belong to you.',
859
- _response
860
- )
861
- when 415
862
- raise ApiErrorException.new(
863
- 'We don\'t support that media type. If a request body is required,' \
864
- ' please send it to us as `application/json`.',
865
- _response
866
- )
867
- when 429
868
- raise ApiErrorException.new(
869
- 'You\'re sending requests to this endpoint too frequently. Please' \
870
- ' slow your request rate down and try again.',
871
- _response
872
- )
873
- when 500
874
- raise ApiErrorException.new(
875
- 'Something unexpected happened. Please try again.',
876
- _response
877
- )
878
- end
879
- validate_response(_response)
880
-
881
- # Return appropriate response type.
882
- decoded = APIHelper.json_deserialize(_response.raw_body)
883
- ApiResponse.new(
884
- _response, data: TranscriptionResponse.from_hash(decoded)
885
- )
886
- end
887
-
888
- # Requests that the specified recording be transcribed.
889
- # @param [String] account_id Required parameter: Example:
890
- # @param [String] call_id Required parameter: Example:
891
- # @param [String] recording_id Required parameter: Example:
892
- # @param [TranscribeRecordingRequest] body Required parameter: Example:
893
- # @return [void] response from the API call
894
- def create_transcribe_call_recording(account_id,
895
- call_id,
896
- recording_id,
897
- body)
898
- # Prepare query url.
899
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
900
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
901
- _query_builder = APIHelper.append_url_with_template_parameters(
902
- _query_builder,
903
- 'accountId' => { 'value' => account_id, 'encode' => false },
904
- 'callId' => { 'value' => call_id, 'encode' => false },
905
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
906
- )
907
- _query_url = APIHelper.clean_url _query_builder
908
-
909
- # Prepare headers.
910
- _headers = {
911
- 'content-type' => 'application/json; charset=utf-8'
912
- }
913
-
914
- # Prepare and execute HttpRequest.
915
- _request = config.http_client.post(
916
- _query_url,
917
- headers: _headers,
918
- parameters: body.to_json
919
- )
920
- VoiceBasicAuth.apply(config, _request)
921
- _response = execute_request(_request)
922
-
923
- # Validate response against endpoint and global error codes.
924
- case _response.status_code
925
- when 400
926
- raise ApiErrorException.new(
927
- 'Something\'s not quite right... Your request is invalid. Please' \
928
- ' fix it before trying again.',
929
- _response
930
- )
931
- when 401
932
- raise APIException.new(
933
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
934
- ' credentials to authenticate to the API.',
935
- _response
936
- )
937
- when 403
938
- raise ApiErrorException.new(
939
- 'User unauthorized to perform this action.',
940
- _response
941
- )
942
- when 404
943
- raise ApiErrorException.new(
944
- 'The resource specified cannot be found or does not belong to you.',
945
- _response
946
- )
947
- when 410
948
- raise ApiErrorException.new(
949
- 'The media for this recording has been deleted, so we can\'t' \
950
- ' transcribe it',
951
- _response
952
- )
953
- when 415
954
- raise ApiErrorException.new(
955
- 'We don\'t support that media type. If a request body is required,' \
956
- ' please send it to us as `application/json`.',
957
- _response
958
- )
959
- when 429
960
- raise ApiErrorException.new(
961
- 'You\'re sending requests to this endpoint too frequently. Please' \
962
- ' slow your request rate down and try again.',
963
- _response
964
- )
965
- when 500
966
- raise ApiErrorException.new(
967
- 'Something unexpected happened. Please try again.',
968
- _response
969
- )
970
- end
971
- validate_response(_response)
972
-
973
- # Return appropriate response type.
974
- ApiResponse.new(_response)
975
- end
976
-
977
- # Deletes the specified recording's transcription.
978
- # @param [String] account_id Required parameter: Example:
979
- # @param [String] call_id Required parameter: Example:
980
- # @param [String] recording_id Required parameter: Example:
981
- # @return [void] response from the API call
982
- def delete_call_transcription(account_id,
983
- call_id,
984
- recording_id)
985
- # Prepare query url.
986
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
987
- _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
988
- _query_builder = APIHelper.append_url_with_template_parameters(
989
- _query_builder,
990
- 'accountId' => { 'value' => account_id, 'encode' => false },
991
- 'callId' => { 'value' => call_id, 'encode' => false },
992
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
993
- )
994
- _query_url = APIHelper.clean_url _query_builder
995
-
996
- # Prepare and execute HttpRequest.
997
- _request = config.http_client.delete(
998
- _query_url
999
- )
1000
- VoiceBasicAuth.apply(config, _request)
1001
- _response = execute_request(_request)
1002
-
1003
- # Validate response against endpoint and global error codes.
1004
- case _response.status_code
1005
- when 400
1006
- raise ApiErrorException.new(
1007
- 'Something\'s not quite right... Your request is invalid. Please' \
1008
- ' fix it before trying again.',
1009
- _response
1010
- )
1011
- when 401
1012
- raise APIException.new(
1013
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1014
- ' credentials to authenticate to the API.',
1015
- _response
1016
- )
1017
- when 403
1018
- raise ApiErrorException.new(
1019
- 'User unauthorized to perform this action.',
1020
- _response
1021
- )
1022
- when 404
1023
- raise ApiErrorException.new(
1024
- 'The resource specified cannot be found or does not belong to you.',
1025
- _response
1026
- )
1027
- when 415
1028
- raise ApiErrorException.new(
1029
- 'We don\'t support that media type. If a request body is required,' \
1030
- ' please send it to us as `application/json`.',
1031
- _response
1032
- )
1033
- when 429
1034
- raise ApiErrorException.new(
1035
- 'You\'re sending requests to this endpoint too frequently. Please' \
1036
- ' slow your request rate down and try again.',
1037
- _response
1038
- )
1039
- when 500
1040
- raise ApiErrorException.new(
1041
- 'Something unexpected happened. Please try again.',
1042
- _response
1043
- )
1044
- end
1045
- validate_response(_response)
1046
-
1047
- # Return appropriate response type.
1048
- ApiResponse.new(_response)
1049
- end
1050
-
1051
- # Returns information about the conferences in the account.
1052
- # @param [String] account_id Required parameter: Example:
1053
- # @param [String] name Optional parameter: Example:
1054
- # @param [String] min_created_time Optional parameter: Example:
1055
- # @param [String] max_created_time Optional parameter: Example:
1056
- # @param [Integer] page_size Optional parameter: Example:1000
1057
- # @param [String] page_token Optional parameter: Example:
1058
- # @return [List of ConferenceState] response from the API call
1059
- def get_conferences(account_id,
1060
- name: nil,
1061
- min_created_time: nil,
1062
- max_created_time: nil,
1063
- page_size: 1000,
1064
- page_token: nil)
1065
- # Prepare query url.
1066
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1067
- _query_builder << '/api/v2/accounts/{accountId}/conferences'
1068
- _query_builder = APIHelper.append_url_with_template_parameters(
1069
- _query_builder,
1070
- 'accountId' => { 'value' => account_id, 'encode' => false }
1071
- )
1072
- _query_builder = APIHelper.append_url_with_query_parameters(
1073
- _query_builder,
1074
- 'name' => name,
1075
- 'minCreatedTime' => min_created_time,
1076
- 'maxCreatedTime' => max_created_time,
1077
- 'pageSize' => page_size,
1078
- 'pageToken' => page_token
1079
- )
1080
- _query_url = APIHelper.clean_url _query_builder
1081
-
1082
- # Prepare headers.
1083
- _headers = {
1084
- 'accept' => 'application/json'
1085
- }
1086
-
1087
- # Prepare and execute HttpRequest.
1088
- _request = config.http_client.get(
1089
- _query_url,
1090
- headers: _headers
1091
- )
1092
- VoiceBasicAuth.apply(config, _request)
1093
- _response = execute_request(_request)
1094
-
1095
- # Validate response against endpoint and global error codes.
1096
- case _response.status_code
1097
- when 400
1098
- raise ApiErrorException.new(
1099
- 'Something\'s not quite right... Your request is invalid. Please' \
1100
- ' fix it before trying again.',
1101
- _response
1102
- )
1103
- when 401
1104
- raise APIException.new(
1105
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1106
- ' credentials to authenticate to the API.',
1107
- _response
1108
- )
1109
- when 403
1110
- raise ApiErrorException.new(
1111
- 'User unauthorized to perform this action.',
1112
- _response
1113
- )
1114
- when 404
1115
- raise ApiErrorException.new(
1116
- 'The resource specified cannot be found or does not belong to you.',
1117
- _response
1118
- )
1119
- when 415
1120
- raise ApiErrorException.new(
1121
- 'We don\'t support that media type. If a request body is required,' \
1122
- ' please send it to us as `application/json`.',
1123
- _response
1124
- )
1125
- when 429
1126
- raise ApiErrorException.new(
1127
- 'You\'re sending requests to this endpoint too frequently. Please' \
1128
- ' slow your request rate down and try again.',
1129
- _response
1130
- )
1131
- when 500
1132
- raise ApiErrorException.new(
1133
- 'Something unexpected happened. Please try again.',
1134
- _response
1135
- )
1136
- end
1137
- validate_response(_response)
1138
-
1139
- # Return appropriate response type.
1140
- decoded = APIHelper.json_deserialize(_response.raw_body)
1141
- ApiResponse.new(
1142
- _response,
1143
- data: decoded.map { |element| ConferenceState.from_hash(element) }
1144
- )
1145
- end
1146
-
1147
- # Returns information about the specified conference.
1148
- # @param [String] account_id Required parameter: Example:
1149
- # @param [String] conference_id Required parameter: Example:
1150
- # @return [ConferenceState] response from the API call
1151
- def get_conference(account_id,
1152
- conference_id)
1153
- # Prepare query url.
1154
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1155
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
1156
- _query_builder = APIHelper.append_url_with_template_parameters(
1157
- _query_builder,
1158
- 'accountId' => { 'value' => account_id, 'encode' => false },
1159
- 'conferenceId' => { 'value' => conference_id, 'encode' => false }
1160
- )
1161
- _query_url = APIHelper.clean_url _query_builder
1162
-
1163
- # Prepare headers.
1164
- _headers = {
1165
- 'accept' => 'application/json'
1166
- }
1167
-
1168
- # Prepare and execute HttpRequest.
1169
- _request = config.http_client.get(
1170
- _query_url,
1171
- headers: _headers
1172
- )
1173
- VoiceBasicAuth.apply(config, _request)
1174
- _response = execute_request(_request)
1175
-
1176
- # Validate response against endpoint and global error codes.
1177
- case _response.status_code
1178
- when 400
1179
- raise ApiErrorException.new(
1180
- 'Something\'s not quite right... Your request is invalid. Please' \
1181
- ' fix it before trying again.',
1182
- _response
1183
- )
1184
- when 401
1185
- raise APIException.new(
1186
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1187
- ' credentials to authenticate to the API.',
1188
- _response
1189
- )
1190
- when 403
1191
- raise ApiErrorException.new(
1192
- 'User unauthorized to perform this action.',
1193
- _response
1194
- )
1195
- when 404
1196
- raise ApiErrorException.new(
1197
- 'The resource specified cannot be found or does not belong to you.',
1198
- _response
1199
- )
1200
- when 415
1201
- raise ApiErrorException.new(
1202
- 'We don\'t support that media type. If a request body is required,' \
1203
- ' please send it to us as `application/json`.',
1204
- _response
1205
- )
1206
- when 429
1207
- raise ApiErrorException.new(
1208
- 'You\'re sending requests to this endpoint too frequently. Please' \
1209
- ' slow your request rate down and try again.',
1210
- _response
1211
- )
1212
- when 500
1213
- raise ApiErrorException.new(
1214
- 'Something unexpected happened. Please try again.',
1215
- _response
1216
- )
1217
- end
1218
- validate_response(_response)
1219
-
1220
- # Return appropriate response type.
1221
- decoded = APIHelper.json_deserialize(_response.raw_body)
1222
- ApiResponse.new(
1223
- _response, data: ConferenceState.from_hash(decoded)
1224
- )
1225
- end
1226
-
1227
- # Modify the conference state.
1228
- # @param [String] account_id Required parameter: Example:
1229
- # @param [String] conference_id Required parameter: Example:
1230
- # @param [ModifyConferenceRequest] body Required parameter: Example:
1231
- # @return [void] response from the API call
1232
- def modify_conference(account_id,
1233
- conference_id,
1234
- body)
1235
- # Prepare query url.
1236
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1237
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
1238
- _query_builder = APIHelper.append_url_with_template_parameters(
1239
- _query_builder,
1240
- 'accountId' => { 'value' => account_id, 'encode' => false },
1241
- 'conferenceId' => { 'value' => conference_id, 'encode' => false }
1242
- )
1243
- _query_url = APIHelper.clean_url _query_builder
1244
-
1245
- # Prepare headers.
1246
- _headers = {
1247
- 'content-type' => 'application/json; charset=utf-8'
1248
- }
1249
-
1250
- # Prepare and execute HttpRequest.
1251
- _request = config.http_client.post(
1252
- _query_url,
1253
- headers: _headers,
1254
- parameters: body.to_json
1255
- )
1256
- VoiceBasicAuth.apply(config, _request)
1257
- _response = execute_request(_request)
1258
-
1259
- # Validate response against endpoint and global error codes.
1260
- case _response.status_code
1261
- when 400
1262
- raise ApiErrorException.new(
1263
- 'Something\'s not quite right... Your request is invalid. Please' \
1264
- ' fix it before trying again.',
1265
- _response
1266
- )
1267
- when 401
1268
- raise APIException.new(
1269
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1270
- ' credentials to authenticate to the API.',
1271
- _response
1272
- )
1273
- when 403
1274
- raise ApiErrorException.new(
1275
- 'User unauthorized to perform this action.',
1276
- _response
1277
- )
1278
- when 404
1279
- raise ApiErrorException.new(
1280
- 'The resource specified cannot be found or does not belong to you.',
1281
- _response
1282
- )
1283
- when 415
1284
- raise ApiErrorException.new(
1285
- 'We don\'t support that media type. If a request body is required,' \
1286
- ' please send it to us as `application/json`.',
1287
- _response
1288
- )
1289
- when 429
1290
- raise ApiErrorException.new(
1291
- 'You\'re sending requests to this endpoint too frequently. Please' \
1292
- ' slow your request rate down and try again.',
1293
- _response
1294
- )
1295
- when 500
1296
- raise ApiErrorException.new(
1297
- 'Something unexpected happened. Please try again.',
1298
- _response
1299
- )
1300
- end
1301
- validate_response(_response)
1302
-
1303
- # Return appropriate response type.
1304
- ApiResponse.new(_response)
1305
- end
1306
-
1307
- # Updates settings for a particular conference member.
1308
- # @param [String] account_id Required parameter: Example:
1309
- # @param [String] conference_id Required parameter: Example:
1310
- # @param [String] call_id Required parameter: Example:
1311
- # @param [ConferenceMemberState] body Required parameter: Example:
1312
- # @return [void] response from the API call
1313
- def modify_conference_member(account_id,
1314
- conference_id,
1315
- call_id,
1316
- body)
1317
- # Prepare query url.
1318
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1319
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
1320
- _query_builder = APIHelper.append_url_with_template_parameters(
1321
- _query_builder,
1322
- 'accountId' => { 'value' => account_id, 'encode' => false },
1323
- 'conferenceId' => { 'value' => conference_id, 'encode' => false },
1324
- 'callId' => { 'value' => call_id, 'encode' => false }
1325
- )
1326
- _query_url = APIHelper.clean_url _query_builder
1327
-
1328
- # Prepare headers.
1329
- _headers = {
1330
- 'content-type' => 'application/json; charset=utf-8'
1331
- }
1332
-
1333
- # Prepare and execute HttpRequest.
1334
- _request = config.http_client.put(
1335
- _query_url,
1336
- headers: _headers,
1337
- parameters: body.to_json
1338
- )
1339
- VoiceBasicAuth.apply(config, _request)
1340
- _response = execute_request(_request)
1341
-
1342
- # Validate response against endpoint and global error codes.
1343
- case _response.status_code
1344
- when 400
1345
- raise ApiErrorException.new(
1346
- 'Something\'s not quite right... Your request is invalid. Please' \
1347
- ' fix it before trying again.',
1348
- _response
1349
- )
1350
- when 401
1351
- raise APIException.new(
1352
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1353
- ' credentials to authenticate to the API.',
1354
- _response
1355
- )
1356
- when 403
1357
- raise ApiErrorException.new(
1358
- 'User unauthorized to perform this action.',
1359
- _response
1360
- )
1361
- when 404
1362
- raise ApiErrorException.new(
1363
- 'The resource specified cannot be found or does not belong to you.',
1364
- _response
1365
- )
1366
- when 415
1367
- raise ApiErrorException.new(
1368
- 'We don\'t support that media type. If a request body is required,' \
1369
- ' please send it to us as `application/json`.',
1370
- _response
1371
- )
1372
- when 429
1373
- raise ApiErrorException.new(
1374
- 'You\'re sending requests to this endpoint too frequently. Please' \
1375
- ' slow your request rate down and try again.',
1376
- _response
1377
- )
1378
- when 500
1379
- raise ApiErrorException.new(
1380
- 'Something unexpected happened. Please try again.',
1381
- _response
1382
- )
1383
- end
1384
- validate_response(_response)
1385
-
1386
- # Return appropriate response type.
1387
- ApiResponse.new(_response)
1388
- end
1389
-
1390
- # Returns information about the specified conference member.
1391
- # @param [String] account_id Required parameter: Example:
1392
- # @param [String] conference_id Required parameter: Example:
1393
- # @param [String] member_id Required parameter: Example:
1394
- # @return [ConferenceMemberState] response from the API call
1395
- def get_conference_member(account_id,
1396
- conference_id,
1397
- member_id)
1398
- # Prepare query url.
1399
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1400
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'
1401
- _query_builder = APIHelper.append_url_with_template_parameters(
1402
- _query_builder,
1403
- 'accountId' => { 'value' => account_id, 'encode' => false },
1404
- 'conferenceId' => { 'value' => conference_id, 'encode' => false },
1405
- 'memberId' => { 'value' => member_id, 'encode' => false }
1406
- )
1407
- _query_url = APIHelper.clean_url _query_builder
1408
-
1409
- # Prepare headers.
1410
- _headers = {
1411
- 'accept' => 'application/json'
1412
- }
1413
-
1414
- # Prepare and execute HttpRequest.
1415
- _request = config.http_client.get(
1416
- _query_url,
1417
- headers: _headers
1418
- )
1419
- VoiceBasicAuth.apply(config, _request)
1420
- _response = execute_request(_request)
1421
-
1422
- # Validate response against endpoint and global error codes.
1423
- case _response.status_code
1424
- when 400
1425
- raise ApiErrorException.new(
1426
- 'Something\'s not quite right... Your request is invalid. Please' \
1427
- ' fix it before trying again.',
1428
- _response
1429
- )
1430
- when 401
1431
- raise APIException.new(
1432
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1433
- ' credentials to authenticate to the API.',
1434
- _response
1435
- )
1436
- when 403
1437
- raise ApiErrorException.new(
1438
- 'User unauthorized to perform this action.',
1439
- _response
1440
- )
1441
- when 404
1442
- raise ApiErrorException.new(
1443
- 'The resource specified cannot be found or does not belong to you.',
1444
- _response
1445
- )
1446
- when 415
1447
- raise ApiErrorException.new(
1448
- 'We don\'t support that media type. If a request body is required,' \
1449
- ' please send it to us as `application/json`.',
1450
- _response
1451
- )
1452
- when 429
1453
- raise ApiErrorException.new(
1454
- 'You\'re sending requests to this endpoint too frequently. Please' \
1455
- ' slow your request rate down and try again.',
1456
- _response
1457
- )
1458
- when 500
1459
- raise ApiErrorException.new(
1460
- 'Something unexpected happened. Please try again.',
1461
- _response
1462
- )
1463
- end
1464
- validate_response(_response)
1465
-
1466
- # Return appropriate response type.
1467
- decoded = APIHelper.json_deserialize(_response.raw_body)
1468
- ApiResponse.new(
1469
- _response, data: ConferenceMemberState.from_hash(decoded)
1470
- )
1471
- end
1472
-
1473
- # Returns a (potentially empty) list of metadata for the recordings that
1474
- # took place during the specified conference
1475
- # @param [String] account_id Required parameter: Example:
1476
- # @param [String] conference_id Required parameter: Example:
1477
- # @return [List of ConferenceRecordingMetadata] response from the API call
1478
- def get_conference_recordings(account_id,
1479
- conference_id)
1480
- # Prepare query url.
1481
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1482
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
1483
- _query_builder = APIHelper.append_url_with_template_parameters(
1484
- _query_builder,
1485
- 'accountId' => { 'value' => account_id, 'encode' => false },
1486
- 'conferenceId' => { 'value' => conference_id, 'encode' => false }
1487
- )
1488
- _query_url = APIHelper.clean_url _query_builder
1489
-
1490
- # Prepare headers.
1491
- _headers = {
1492
- 'accept' => 'application/json'
1493
- }
1494
-
1495
- # Prepare and execute HttpRequest.
1496
- _request = config.http_client.get(
1497
- _query_url,
1498
- headers: _headers
1499
- )
1500
- VoiceBasicAuth.apply(config, _request)
1501
- _response = execute_request(_request)
1502
-
1503
- # Validate response against endpoint and global error codes.
1504
- case _response.status_code
1505
- when 400
1506
- raise ApiErrorException.new(
1507
- 'Something\'s not quite right... Your request is invalid. Please' \
1508
- ' fix it before trying again.',
1509
- _response
1510
- )
1511
- when 401
1512
- raise APIException.new(
1513
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1514
- ' credentials to authenticate to the API.',
1515
- _response
1516
- )
1517
- when 403
1518
- raise ApiErrorException.new(
1519
- 'User unauthorized to perform this action.',
1520
- _response
1521
- )
1522
- when 404
1523
- raise ApiErrorException.new(
1524
- 'The resource specified cannot be found or does not belong to you.',
1525
- _response
1526
- )
1527
- when 415
1528
- raise ApiErrorException.new(
1529
- 'We don\'t support that media type. If a request body is required,' \
1530
- ' please send it to us as `application/json`.',
1531
- _response
1532
- )
1533
- when 429
1534
- raise ApiErrorException.new(
1535
- 'You\'re sending requests to this endpoint too frequently. Please' \
1536
- ' slow your request rate down and try again.',
1537
- _response
1538
- )
1539
- when 500
1540
- raise ApiErrorException.new(
1541
- 'Something unexpected happened. Please try again.',
1542
- _response
1543
- )
1544
- end
1545
- validate_response(_response)
1546
-
1547
- # Return appropriate response type.
1548
- decoded = APIHelper.json_deserialize(_response.raw_body)
1549
- ApiResponse.new(
1550
- _response,
1551
- data: decoded.map { |element| ConferenceRecordingMetadata.from_hash(element) }
1552
- )
1553
- end
1554
-
1555
- # Returns metadata for the specified recording.
1556
- # @param [String] account_id Required parameter: Example:
1557
- # @param [String] conference_id Required parameter: Example:
1558
- # @param [String] recording_id Required parameter: Example:
1559
- # @return [CallRecordingMetadata] response from the API call
1560
- def get_conference_recording(account_id,
1561
- conference_id,
1562
- recording_id)
1563
- # Prepare query url.
1564
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1565
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
1566
- _query_builder = APIHelper.append_url_with_template_parameters(
1567
- _query_builder,
1568
- 'accountId' => { 'value' => account_id, 'encode' => false },
1569
- 'conferenceId' => { 'value' => conference_id, 'encode' => false },
1570
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
1571
- )
1572
- _query_url = APIHelper.clean_url _query_builder
1573
-
1574
- # Prepare headers.
1575
- _headers = {
1576
- 'accept' => 'application/json'
1577
- }
1578
-
1579
- # Prepare and execute HttpRequest.
1580
- _request = config.http_client.get(
1581
- _query_url,
1582
- headers: _headers
1583
- )
1584
- VoiceBasicAuth.apply(config, _request)
1585
- _response = execute_request(_request)
1586
-
1587
- # Validate response against endpoint and global error codes.
1588
- case _response.status_code
1589
- when 400
1590
- raise ApiErrorException.new(
1591
- 'Something\'s not quite right... Your request is invalid. Please' \
1592
- ' fix it before trying again.',
1593
- _response
1594
- )
1595
- when 401
1596
- raise APIException.new(
1597
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1598
- ' credentials to authenticate to the API.',
1599
- _response
1600
- )
1601
- when 403
1602
- raise ApiErrorException.new(
1603
- 'User unauthorized to perform this action.',
1604
- _response
1605
- )
1606
- when 404
1607
- raise ApiErrorException.new(
1608
- 'The resource specified cannot be found or does not belong to you.',
1609
- _response
1610
- )
1611
- when 415
1612
- raise ApiErrorException.new(
1613
- 'We don\'t support that media type. If a request body is required,' \
1614
- ' please send it to us as `application/json`.',
1615
- _response
1616
- )
1617
- when 429
1618
- raise ApiErrorException.new(
1619
- 'You\'re sending requests to this endpoint too frequently. Please' \
1620
- ' slow your request rate down and try again.',
1621
- _response
1622
- )
1623
- when 500
1624
- raise ApiErrorException.new(
1625
- 'Something unexpected happened. Please try again.',
1626
- _response
1627
- )
1628
- end
1629
- validate_response(_response)
1630
-
1631
- # Return appropriate response type.
1632
- decoded = APIHelper.json_deserialize(_response.raw_body)
1633
- ApiResponse.new(
1634
- _response, data: CallRecordingMetadata.from_hash(decoded)
1635
- )
1636
- end
1637
-
1638
- # Downloads the specified recording.
1639
- # @param [String] account_id Required parameter: Example:
1640
- # @param [String] conference_id Required parameter: Example:
1641
- # @param [String] recording_id Required parameter: Example:
1642
- # @return [Mixed] response from the API call
1643
- def get_download_conference_recording(account_id,
1644
- conference_id,
1645
- recording_id)
1646
- # Prepare query url.
1647
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1648
- _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
1649
- _query_builder = APIHelper.append_url_with_template_parameters(
1650
- _query_builder,
1651
- 'accountId' => { 'value' => account_id, 'encode' => false },
1652
- 'conferenceId' => { 'value' => conference_id, 'encode' => false },
1653
- 'recordingId' => { 'value' => recording_id, 'encode' => false }
1654
- )
1655
- _query_url = APIHelper.clean_url _query_builder
1656
-
1657
- # Prepare headers.
1658
- _headers = {
1659
- 'accept' => 'application/json'
1660
- }
1661
-
1662
- # Prepare and execute HttpRequest.
1663
- _request = config.http_client.get(
1664
- _query_url,
1665
- headers: _headers
1666
- )
1667
- VoiceBasicAuth.apply(config, _request)
1668
- _response = execute_request(_request)
1669
-
1670
- # Validate response against endpoint and global error codes.
1671
- case _response.status_code
1672
- when 400
1673
- raise ApiErrorException.new(
1674
- 'Something\'s not quite right... Your request is invalid. Please' \
1675
- ' fix it before trying again.',
1676
- _response
1677
- )
1678
- when 401
1679
- raise APIException.new(
1680
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1681
- ' credentials to authenticate to the API.',
1682
- _response
1683
- )
1684
- when 403
1685
- raise ApiErrorException.new(
1686
- 'User unauthorized to perform this action.',
1687
- _response
1688
- )
1689
- when 404
1690
- raise ApiErrorException.new(
1691
- 'The resource specified cannot be found or does not belong to you.',
1692
- _response
1693
- )
1694
- when 415
1695
- raise ApiErrorException.new(
1696
- 'We don\'t support that media type. If a request body is required,' \
1697
- ' please send it to us as `application/json`.',
1698
- _response
1699
- )
1700
- when 429
1701
- raise ApiErrorException.new(
1702
- 'You\'re sending requests to this endpoint too frequently. Please' \
1703
- ' slow your request rate down and try again.',
1704
- _response
1705
- )
1706
- when 500
1707
- raise ApiErrorException.new(
1708
- 'Something unexpected happened. Please try again.',
1709
- _response
1710
- )
1711
- end
1712
- validate_response(_response)
1713
-
1714
- # Return appropriate response type.
1715
- decoded = APIHelper.json_deserialize(_response.raw_body) unless
1716
- _response.raw_body.nil? ||
1717
- _response.raw_body.to_s.strip.empty?
1718
- ApiResponse.new(
1719
- _response, data: decoded
1720
- )
1721
- end
1722
-
1723
- # Returns a list of metadata for the recordings associated with the
1724
- # specified account. The list can be filtered by the optional from, to,
1725
- # minStartTime, and maxStartTime arguments. The list is capped at 1000
1726
- # entries and may be empty if no recordings match the specified criteria.
1727
- # @param [String] account_id Required parameter: Example:
1728
- # @param [String] from Optional parameter: Example:
1729
- # @param [String] to Optional parameter: Example:
1730
- # @param [String] min_start_time Optional parameter: Example:
1731
- # @param [String] max_start_time Optional parameter: Example:
1732
- # @return [List of CallRecordingMetadata] response from the API call
1733
- def get_query_call_recordings(account_id,
1734
- from: nil,
1735
- to: nil,
1736
- min_start_time: nil,
1737
- max_start_time: nil)
1738
- # Prepare query url.
1739
- _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1740
- _query_builder << '/api/v2/accounts/{accountId}/recordings'
1741
- _query_builder = APIHelper.append_url_with_template_parameters(
1742
- _query_builder,
1743
- 'accountId' => { 'value' => account_id, 'encode' => false }
1744
- )
1745
- _query_builder = APIHelper.append_url_with_query_parameters(
1746
- _query_builder,
1747
- 'from' => from,
1748
- 'to' => to,
1749
- 'minStartTime' => min_start_time,
1750
- 'maxStartTime' => max_start_time
1751
- )
1752
- _query_url = APIHelper.clean_url _query_builder
1753
-
1754
- # Prepare headers.
1755
- _headers = {
1756
- 'accept' => 'application/json'
1757
- }
1758
-
1759
- # Prepare and execute HttpRequest.
1760
- _request = config.http_client.get(
1761
- _query_url,
1762
- headers: _headers
1763
- )
1764
- VoiceBasicAuth.apply(config, _request)
1765
- _response = execute_request(_request)
1766
-
1767
- # Validate response against endpoint and global error codes.
1768
- case _response.status_code
1769
- when 400
1770
- raise ApiErrorException.new(
1771
- 'Something\'s not quite right... Your request is invalid. Please' \
1772
- ' fix it before trying again.',
1773
- _response
1774
- )
1775
- when 401
1776
- raise APIException.new(
1777
- 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1778
- ' credentials to authenticate to the API.',
1779
- _response
1780
- )
1781
- when 403
1782
- raise ApiErrorException.new(
1783
- 'User unauthorized to perform this action.',
1784
- _response
1785
- )
1786
- when 404
1787
- raise ApiErrorException.new(
1788
- 'The resource specified cannot be found or does not belong to you.',
1789
- _response
1790
- )
1791
- when 415
1792
- raise ApiErrorException.new(
1793
- 'We don\'t support that media type. If a request body is required,' \
1794
- ' please send it to us as `application/json`.',
1795
- _response
1796
- )
1797
- when 429
1798
- raise ApiErrorException.new(
1799
- 'You\'re sending requests to this endpoint too frequently. Please' \
1800
- ' slow your request rate down and try again.',
1801
- _response
1802
- )
1803
- when 500
1804
- raise ApiErrorException.new(
1805
- 'Something unexpected happened. Please try again.',
1806
- _response
1807
- )
1808
- end
1809
- validate_response(_response)
1810
-
1811
- # Return appropriate response type.
1812
- decoded = APIHelper.json_deserialize(_response.raw_body)
1813
- ApiResponse.new(
1814
- _response,
1815
- data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
1816
- )
1817
- end
1818
- end
1819
- end
1820
- end