bandwidth-sdk 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bandwidth/api_helper.rb +19 -17
- data/lib/bandwidth/configuration.rb +7 -19
- data/lib/bandwidth/http/faraday_client.rb +1 -1
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +53 -42
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +65 -32
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
- data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +23 -6
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
- data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
- data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
- data/lib/bandwidth/models/base_model.rb +11 -0
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +21 -16
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +5 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +4 -1
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +4 -1
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +27 -12
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +29 -10
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +17 -2
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
- data/lib/bandwidth/utilities/date_time_helper.rb +2 -2
- data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +171 -150
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +6 -3
- data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
- data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +78 -37
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +94 -42
- data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +35 -12
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +55 -24
- data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +54 -17
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +173 -96
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +85 -41
- data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
- data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +15 -2
- data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +59 -19
- data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +55 -18
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +40 -12
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +26 -8
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
- data/lib/bandwidth/voice_lib/voice.rb +7 -1
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +61 -50
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
- data/lib/bandwidth.rb +19 -18
- data/test/integration/test_integration.rb +75 -53
- metadata +9 -2
|
@@ -11,7 +11,7 @@ module Voice
|
|
|
11
11
|
super(config, http_call_back: http_call_back)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
# Creates an outbound call.
|
|
14
|
+
# Creates an outbound phone call.
|
|
15
15
|
# @param [String] account_id Required parameter: Example:
|
|
16
16
|
# @param [CreateCallRequest] body Required parameter: Example:
|
|
17
17
|
# @return [CreateCallResponse] response from the API call
|
|
@@ -42,41 +42,42 @@ module Voice
|
|
|
42
42
|
_response = execute_request(_request)
|
|
43
43
|
|
|
44
44
|
# Validate response against endpoint and global error codes.
|
|
45
|
-
|
|
45
|
+
case _response.status_code
|
|
46
|
+
when 400
|
|
46
47
|
raise ApiErrorException.new(
|
|
47
48
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
48
49
|
' fix it before trying again.',
|
|
49
50
|
_response
|
|
50
51
|
)
|
|
51
|
-
|
|
52
|
+
when 401
|
|
52
53
|
raise APIException.new(
|
|
53
54
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
54
55
|
' credentials to authenticate to the API.',
|
|
55
56
|
_response
|
|
56
57
|
)
|
|
57
|
-
|
|
58
|
+
when 403
|
|
58
59
|
raise ApiErrorException.new(
|
|
59
60
|
'User unauthorized to perform this action.',
|
|
60
61
|
_response
|
|
61
62
|
)
|
|
62
|
-
|
|
63
|
+
when 404
|
|
63
64
|
raise ApiErrorException.new(
|
|
64
65
|
'The resource specified cannot be found or does not belong to you.',
|
|
65
66
|
_response
|
|
66
67
|
)
|
|
67
|
-
|
|
68
|
+
when 415
|
|
68
69
|
raise ApiErrorException.new(
|
|
69
70
|
'We don\'t support that media type. If a request body is required,' \
|
|
70
71
|
' please send it to us as `application/json`.',
|
|
71
72
|
_response
|
|
72
73
|
)
|
|
73
|
-
|
|
74
|
+
when 429
|
|
74
75
|
raise ApiErrorException.new(
|
|
75
76
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
76
77
|
' slow your request rate down and try again.',
|
|
77
78
|
_response
|
|
78
79
|
)
|
|
79
|
-
|
|
80
|
+
when 500
|
|
80
81
|
raise ApiErrorException.new(
|
|
81
82
|
'Something unexpected happened. Please try again.',
|
|
82
83
|
_response
|
|
@@ -121,41 +122,42 @@ module Voice
|
|
|
121
122
|
_response = execute_request(_request)
|
|
122
123
|
|
|
123
124
|
# Validate response against endpoint and global error codes.
|
|
124
|
-
|
|
125
|
+
case _response.status_code
|
|
126
|
+
when 400
|
|
125
127
|
raise ApiErrorException.new(
|
|
126
128
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
127
129
|
' fix it before trying again.',
|
|
128
130
|
_response
|
|
129
131
|
)
|
|
130
|
-
|
|
132
|
+
when 401
|
|
131
133
|
raise APIException.new(
|
|
132
134
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
133
135
|
' credentials to authenticate to the API.',
|
|
134
136
|
_response
|
|
135
137
|
)
|
|
136
|
-
|
|
138
|
+
when 403
|
|
137
139
|
raise ApiErrorException.new(
|
|
138
140
|
'User unauthorized to perform this action.',
|
|
139
141
|
_response
|
|
140
142
|
)
|
|
141
|
-
|
|
143
|
+
when 404
|
|
142
144
|
raise ApiErrorException.new(
|
|
143
145
|
'The resource specified cannot be found or does not belong to you.',
|
|
144
146
|
_response
|
|
145
147
|
)
|
|
146
|
-
|
|
148
|
+
when 415
|
|
147
149
|
raise ApiErrorException.new(
|
|
148
150
|
'We don\'t support that media type. If a request body is required,' \
|
|
149
151
|
' please send it to us as `application/json`.',
|
|
150
152
|
_response
|
|
151
153
|
)
|
|
152
|
-
|
|
154
|
+
when 429
|
|
153
155
|
raise ApiErrorException.new(
|
|
154
156
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
155
157
|
' slow your request rate down and try again.',
|
|
156
158
|
_response
|
|
157
159
|
)
|
|
158
|
-
|
|
160
|
+
when 500
|
|
159
161
|
raise ApiErrorException.new(
|
|
160
162
|
'Something unexpected happened. Please try again.',
|
|
161
163
|
_response
|
|
@@ -203,41 +205,42 @@ module Voice
|
|
|
203
205
|
_response = execute_request(_request)
|
|
204
206
|
|
|
205
207
|
# Validate response against endpoint and global error codes.
|
|
206
|
-
|
|
208
|
+
case _response.status_code
|
|
209
|
+
when 400
|
|
207
210
|
raise ApiErrorException.new(
|
|
208
211
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
209
212
|
' fix it before trying again.',
|
|
210
213
|
_response
|
|
211
214
|
)
|
|
212
|
-
|
|
215
|
+
when 401
|
|
213
216
|
raise APIException.new(
|
|
214
217
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
215
218
|
' credentials to authenticate to the API.',
|
|
216
219
|
_response
|
|
217
220
|
)
|
|
218
|
-
|
|
221
|
+
when 403
|
|
219
222
|
raise ApiErrorException.new(
|
|
220
223
|
'User unauthorized to perform this action.',
|
|
221
224
|
_response
|
|
222
225
|
)
|
|
223
|
-
|
|
226
|
+
when 404
|
|
224
227
|
raise ApiErrorException.new(
|
|
225
228
|
'The resource specified cannot be found or does not belong to you.',
|
|
226
229
|
_response
|
|
227
230
|
)
|
|
228
|
-
|
|
231
|
+
when 415
|
|
229
232
|
raise ApiErrorException.new(
|
|
230
233
|
'We don\'t support that media type. If a request body is required,' \
|
|
231
234
|
' please send it to us as `application/json`.',
|
|
232
235
|
_response
|
|
233
236
|
)
|
|
234
|
-
|
|
237
|
+
when 429
|
|
235
238
|
raise ApiErrorException.new(
|
|
236
239
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
237
240
|
' slow your request rate down and try again.',
|
|
238
241
|
_response
|
|
239
242
|
)
|
|
240
|
-
|
|
243
|
+
when 500
|
|
241
244
|
raise ApiErrorException.new(
|
|
242
245
|
'Something unexpected happened. Please try again.',
|
|
243
246
|
_response
|
|
@@ -282,41 +285,42 @@ module Voice
|
|
|
282
285
|
_response = execute_request(_request)
|
|
283
286
|
|
|
284
287
|
# Validate response against endpoint and global error codes.
|
|
285
|
-
|
|
288
|
+
case _response.status_code
|
|
289
|
+
when 400
|
|
286
290
|
raise ApiErrorException.new(
|
|
287
291
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
288
292
|
' fix it before trying again.',
|
|
289
293
|
_response
|
|
290
294
|
)
|
|
291
|
-
|
|
295
|
+
when 401
|
|
292
296
|
raise APIException.new(
|
|
293
297
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
294
298
|
' credentials to authenticate to the API.',
|
|
295
299
|
_response
|
|
296
300
|
)
|
|
297
|
-
|
|
301
|
+
when 403
|
|
298
302
|
raise ApiErrorException.new(
|
|
299
303
|
'User unauthorized to perform this action.',
|
|
300
304
|
_response
|
|
301
305
|
)
|
|
302
|
-
|
|
306
|
+
when 404
|
|
303
307
|
raise ApiErrorException.new(
|
|
304
308
|
'The resource specified cannot be found or does not belong to you.',
|
|
305
309
|
_response
|
|
306
310
|
)
|
|
307
|
-
|
|
311
|
+
when 415
|
|
308
312
|
raise ApiErrorException.new(
|
|
309
313
|
'We don\'t support that media type. If a request body is required,' \
|
|
310
314
|
' please send it to us as `application/json`.',
|
|
311
315
|
_response
|
|
312
316
|
)
|
|
313
|
-
|
|
317
|
+
when 429
|
|
314
318
|
raise ApiErrorException.new(
|
|
315
319
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
316
320
|
' slow your request rate down and try again.',
|
|
317
321
|
_response
|
|
318
322
|
)
|
|
319
|
-
|
|
323
|
+
when 500
|
|
320
324
|
raise ApiErrorException.new(
|
|
321
325
|
'Something unexpected happened. Please try again.',
|
|
322
326
|
_response
|
|
@@ -329,7 +333,7 @@ module Voice
|
|
|
329
333
|
end
|
|
330
334
|
|
|
331
335
|
# Returns a (potentially empty) list of metadata for the recordings that
|
|
332
|
-
# took place during the specified call
|
|
336
|
+
# took place during the specified call.
|
|
333
337
|
# @param [String] account_id Required parameter: Example:
|
|
334
338
|
# @param [String] call_id Required parameter: Example:
|
|
335
339
|
# @return [List of CallRecordingMetadata] response from the API call
|
|
@@ -359,41 +363,42 @@ module Voice
|
|
|
359
363
|
_response = execute_request(_request)
|
|
360
364
|
|
|
361
365
|
# Validate response against endpoint and global error codes.
|
|
362
|
-
|
|
366
|
+
case _response.status_code
|
|
367
|
+
when 400
|
|
363
368
|
raise ApiErrorException.new(
|
|
364
369
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
365
370
|
' fix it before trying again.',
|
|
366
371
|
_response
|
|
367
372
|
)
|
|
368
|
-
|
|
373
|
+
when 401
|
|
369
374
|
raise APIException.new(
|
|
370
375
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
371
376
|
' credentials to authenticate to the API.',
|
|
372
377
|
_response
|
|
373
378
|
)
|
|
374
|
-
|
|
379
|
+
when 403
|
|
375
380
|
raise ApiErrorException.new(
|
|
376
381
|
'User unauthorized to perform this action.',
|
|
377
382
|
_response
|
|
378
383
|
)
|
|
379
|
-
|
|
384
|
+
when 404
|
|
380
385
|
raise ApiErrorException.new(
|
|
381
386
|
'The resource specified cannot be found or does not belong to you.',
|
|
382
387
|
_response
|
|
383
388
|
)
|
|
384
|
-
|
|
389
|
+
when 415
|
|
385
390
|
raise ApiErrorException.new(
|
|
386
391
|
'We don\'t support that media type. If a request body is required,' \
|
|
387
392
|
' please send it to us as `application/json`.',
|
|
388
393
|
_response
|
|
389
394
|
)
|
|
390
|
-
|
|
395
|
+
when 429
|
|
391
396
|
raise ApiErrorException.new(
|
|
392
397
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
393
398
|
' slow your request rate down and try again.',
|
|
394
399
|
_response
|
|
395
400
|
)
|
|
396
|
-
|
|
401
|
+
when 500
|
|
397
402
|
raise ApiErrorException.new(
|
|
398
403
|
'Something unexpected happened. Please try again.',
|
|
399
404
|
_response
|
|
@@ -442,41 +447,42 @@ module Voice
|
|
|
442
447
|
_response = execute_request(_request)
|
|
443
448
|
|
|
444
449
|
# Validate response against endpoint and global error codes.
|
|
445
|
-
|
|
450
|
+
case _response.status_code
|
|
451
|
+
when 400
|
|
446
452
|
raise ApiErrorException.new(
|
|
447
453
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
448
454
|
' fix it before trying again.',
|
|
449
455
|
_response
|
|
450
456
|
)
|
|
451
|
-
|
|
457
|
+
when 401
|
|
452
458
|
raise APIException.new(
|
|
453
459
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
454
460
|
' credentials to authenticate to the API.',
|
|
455
461
|
_response
|
|
456
462
|
)
|
|
457
|
-
|
|
463
|
+
when 403
|
|
458
464
|
raise ApiErrorException.new(
|
|
459
465
|
'User unauthorized to perform this action.',
|
|
460
466
|
_response
|
|
461
467
|
)
|
|
462
|
-
|
|
468
|
+
when 404
|
|
463
469
|
raise ApiErrorException.new(
|
|
464
470
|
'The resource specified cannot be found or does not belong to you.',
|
|
465
471
|
_response
|
|
466
472
|
)
|
|
467
|
-
|
|
473
|
+
when 415
|
|
468
474
|
raise ApiErrorException.new(
|
|
469
475
|
'We don\'t support that media type. If a request body is required,' \
|
|
470
476
|
' please send it to us as `application/json`.',
|
|
471
477
|
_response
|
|
472
478
|
)
|
|
473
|
-
|
|
479
|
+
when 429
|
|
474
480
|
raise ApiErrorException.new(
|
|
475
481
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
476
482
|
' slow your request rate down and try again.',
|
|
477
483
|
_response
|
|
478
484
|
)
|
|
479
|
-
|
|
485
|
+
when 500
|
|
480
486
|
raise ApiErrorException.new(
|
|
481
487
|
'Something unexpected happened. Please try again.',
|
|
482
488
|
_response
|
|
@@ -518,41 +524,42 @@ module Voice
|
|
|
518
524
|
_response = execute_request(_request)
|
|
519
525
|
|
|
520
526
|
# Validate response against endpoint and global error codes.
|
|
521
|
-
|
|
527
|
+
case _response.status_code
|
|
528
|
+
when 400
|
|
522
529
|
raise ApiErrorException.new(
|
|
523
530
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
524
531
|
' fix it before trying again.',
|
|
525
532
|
_response
|
|
526
533
|
)
|
|
527
|
-
|
|
534
|
+
when 401
|
|
528
535
|
raise APIException.new(
|
|
529
536
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
530
537
|
' credentials to authenticate to the API.',
|
|
531
538
|
_response
|
|
532
539
|
)
|
|
533
|
-
|
|
540
|
+
when 403
|
|
534
541
|
raise ApiErrorException.new(
|
|
535
542
|
'User unauthorized to perform this action.',
|
|
536
543
|
_response
|
|
537
544
|
)
|
|
538
|
-
|
|
545
|
+
when 404
|
|
539
546
|
raise ApiErrorException.new(
|
|
540
547
|
'The resource specified cannot be found or does not belong to you.',
|
|
541
548
|
_response
|
|
542
549
|
)
|
|
543
|
-
|
|
550
|
+
when 415
|
|
544
551
|
raise ApiErrorException.new(
|
|
545
552
|
'We don\'t support that media type. If a request body is required,' \
|
|
546
553
|
' please send it to us as `application/json`.',
|
|
547
554
|
_response
|
|
548
555
|
)
|
|
549
|
-
|
|
556
|
+
when 429
|
|
550
557
|
raise ApiErrorException.new(
|
|
551
558
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
552
559
|
' slow your request rate down and try again.',
|
|
553
560
|
_response
|
|
554
561
|
)
|
|
555
|
-
|
|
562
|
+
when 500
|
|
556
563
|
raise ApiErrorException.new(
|
|
557
564
|
'Something unexpected happened. Please try again.',
|
|
558
565
|
_response
|
|
@@ -597,41 +604,42 @@ module Voice
|
|
|
597
604
|
_response = execute_request(_request)
|
|
598
605
|
|
|
599
606
|
# Validate response against endpoint and global error codes.
|
|
600
|
-
|
|
607
|
+
case _response.status_code
|
|
608
|
+
when 400
|
|
601
609
|
raise ApiErrorException.new(
|
|
602
610
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
603
611
|
' fix it before trying again.',
|
|
604
612
|
_response
|
|
605
613
|
)
|
|
606
|
-
|
|
614
|
+
when 401
|
|
607
615
|
raise APIException.new(
|
|
608
616
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
609
617
|
' credentials to authenticate to the API.',
|
|
610
618
|
_response
|
|
611
619
|
)
|
|
612
|
-
|
|
620
|
+
when 403
|
|
613
621
|
raise ApiErrorException.new(
|
|
614
622
|
'User unauthorized to perform this action.',
|
|
615
623
|
_response
|
|
616
624
|
)
|
|
617
|
-
|
|
625
|
+
when 404
|
|
618
626
|
raise ApiErrorException.new(
|
|
619
627
|
'The resource specified cannot be found or does not belong to you.',
|
|
620
628
|
_response
|
|
621
629
|
)
|
|
622
|
-
|
|
630
|
+
when 415
|
|
623
631
|
raise ApiErrorException.new(
|
|
624
632
|
'We don\'t support that media type. If a request body is required,' \
|
|
625
633
|
' please send it to us as `application/json`.',
|
|
626
634
|
_response
|
|
627
635
|
)
|
|
628
|
-
|
|
636
|
+
when 429
|
|
629
637
|
raise ApiErrorException.new(
|
|
630
638
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
631
639
|
' slow your request rate down and try again.',
|
|
632
640
|
_response
|
|
633
641
|
)
|
|
634
|
-
|
|
642
|
+
when 500
|
|
635
643
|
raise ApiErrorException.new(
|
|
636
644
|
'Something unexpected happened. Please try again.',
|
|
637
645
|
_response
|
|
@@ -675,41 +683,42 @@ module Voice
|
|
|
675
683
|
_response = execute_request(_request)
|
|
676
684
|
|
|
677
685
|
# Validate response against endpoint and global error codes.
|
|
678
|
-
|
|
686
|
+
case _response.status_code
|
|
687
|
+
when 400
|
|
679
688
|
raise ApiErrorException.new(
|
|
680
689
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
681
690
|
' fix it before trying again.',
|
|
682
691
|
_response
|
|
683
692
|
)
|
|
684
|
-
|
|
693
|
+
when 401
|
|
685
694
|
raise APIException.new(
|
|
686
695
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
687
696
|
' credentials to authenticate to the API.',
|
|
688
697
|
_response
|
|
689
698
|
)
|
|
690
|
-
|
|
699
|
+
when 403
|
|
691
700
|
raise ApiErrorException.new(
|
|
692
701
|
'User unauthorized to perform this action.',
|
|
693
702
|
_response
|
|
694
703
|
)
|
|
695
|
-
|
|
704
|
+
when 404
|
|
696
705
|
raise ApiErrorException.new(
|
|
697
706
|
'The resource specified cannot be found or does not belong to you.',
|
|
698
707
|
_response
|
|
699
708
|
)
|
|
700
|
-
|
|
709
|
+
when 415
|
|
701
710
|
raise ApiErrorException.new(
|
|
702
711
|
'We don\'t support that media type. If a request body is required,' \
|
|
703
712
|
' please send it to us as `application/json`.',
|
|
704
713
|
_response
|
|
705
714
|
)
|
|
706
|
-
|
|
715
|
+
when 429
|
|
707
716
|
raise ApiErrorException.new(
|
|
708
717
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
709
718
|
' slow your request rate down and try again.',
|
|
710
719
|
_response
|
|
711
720
|
)
|
|
712
|
-
|
|
721
|
+
when 500
|
|
713
722
|
raise ApiErrorException.new(
|
|
714
723
|
'Something unexpected happened. Please try again.',
|
|
715
724
|
_response
|
|
@@ -754,41 +763,42 @@ module Voice
|
|
|
754
763
|
_response = execute_request(_request)
|
|
755
764
|
|
|
756
765
|
# Validate response against endpoint and global error codes.
|
|
757
|
-
|
|
766
|
+
case _response.status_code
|
|
767
|
+
when 400
|
|
758
768
|
raise ApiErrorException.new(
|
|
759
769
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
760
770
|
' fix it before trying again.',
|
|
761
771
|
_response
|
|
762
772
|
)
|
|
763
|
-
|
|
773
|
+
when 401
|
|
764
774
|
raise APIException.new(
|
|
765
775
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
766
776
|
' credentials to authenticate to the API.',
|
|
767
777
|
_response
|
|
768
778
|
)
|
|
769
|
-
|
|
779
|
+
when 403
|
|
770
780
|
raise ApiErrorException.new(
|
|
771
781
|
'User unauthorized to perform this action.',
|
|
772
782
|
_response
|
|
773
783
|
)
|
|
774
|
-
|
|
784
|
+
when 404
|
|
775
785
|
raise ApiErrorException.new(
|
|
776
786
|
'The resource specified cannot be found or does not belong to you.',
|
|
777
787
|
_response
|
|
778
788
|
)
|
|
779
|
-
|
|
789
|
+
when 415
|
|
780
790
|
raise ApiErrorException.new(
|
|
781
791
|
'We don\'t support that media type. If a request body is required,' \
|
|
782
792
|
' please send it to us as `application/json`.',
|
|
783
793
|
_response
|
|
784
794
|
)
|
|
785
|
-
|
|
795
|
+
when 429
|
|
786
796
|
raise ApiErrorException.new(
|
|
787
797
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
788
798
|
' slow your request rate down and try again.',
|
|
789
799
|
_response
|
|
790
800
|
)
|
|
791
|
-
|
|
801
|
+
when 500
|
|
792
802
|
raise ApiErrorException.new(
|
|
793
803
|
'Something unexpected happened. Please try again.',
|
|
794
804
|
_response
|
|
@@ -839,47 +849,48 @@ module Voice
|
|
|
839
849
|
_response = execute_request(_request)
|
|
840
850
|
|
|
841
851
|
# Validate response against endpoint and global error codes.
|
|
842
|
-
|
|
852
|
+
case _response.status_code
|
|
853
|
+
when 400
|
|
843
854
|
raise ApiErrorException.new(
|
|
844
855
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
845
856
|
' fix it before trying again.',
|
|
846
857
|
_response
|
|
847
858
|
)
|
|
848
|
-
|
|
859
|
+
when 401
|
|
849
860
|
raise APIException.new(
|
|
850
861
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
851
862
|
' credentials to authenticate to the API.',
|
|
852
863
|
_response
|
|
853
864
|
)
|
|
854
|
-
|
|
865
|
+
when 403
|
|
855
866
|
raise ApiErrorException.new(
|
|
856
867
|
'User unauthorized to perform this action.',
|
|
857
868
|
_response
|
|
858
869
|
)
|
|
859
|
-
|
|
870
|
+
when 404
|
|
860
871
|
raise ApiErrorException.new(
|
|
861
872
|
'The resource specified cannot be found or does not belong to you.',
|
|
862
873
|
_response
|
|
863
874
|
)
|
|
864
|
-
|
|
875
|
+
when 410
|
|
865
876
|
raise ApiErrorException.new(
|
|
866
877
|
'The media for this recording has been deleted, so we can\'t' \
|
|
867
878
|
' transcribe it',
|
|
868
879
|
_response
|
|
869
880
|
)
|
|
870
|
-
|
|
881
|
+
when 415
|
|
871
882
|
raise ApiErrorException.new(
|
|
872
883
|
'We don\'t support that media type. If a request body is required,' \
|
|
873
884
|
' please send it to us as `application/json`.',
|
|
874
885
|
_response
|
|
875
886
|
)
|
|
876
|
-
|
|
887
|
+
when 429
|
|
877
888
|
raise ApiErrorException.new(
|
|
878
889
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
879
890
|
' slow your request rate down and try again.',
|
|
880
891
|
_response
|
|
881
892
|
)
|
|
882
|
-
|
|
893
|
+
when 500
|
|
883
894
|
raise ApiErrorException.new(
|
|
884
895
|
'Something unexpected happened. Please try again.',
|
|
885
896
|
_response
|
|
@@ -918,41 +929,42 @@ module Voice
|
|
|
918
929
|
_response = execute_request(_request)
|
|
919
930
|
|
|
920
931
|
# Validate response against endpoint and global error codes.
|
|
921
|
-
|
|
932
|
+
case _response.status_code
|
|
933
|
+
when 400
|
|
922
934
|
raise ApiErrorException.new(
|
|
923
935
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
924
936
|
' fix it before trying again.',
|
|
925
937
|
_response
|
|
926
938
|
)
|
|
927
|
-
|
|
939
|
+
when 401
|
|
928
940
|
raise APIException.new(
|
|
929
941
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
930
942
|
' credentials to authenticate to the API.',
|
|
931
943
|
_response
|
|
932
944
|
)
|
|
933
|
-
|
|
945
|
+
when 403
|
|
934
946
|
raise ApiErrorException.new(
|
|
935
947
|
'User unauthorized to perform this action.',
|
|
936
948
|
_response
|
|
937
949
|
)
|
|
938
|
-
|
|
950
|
+
when 404
|
|
939
951
|
raise ApiErrorException.new(
|
|
940
952
|
'The resource specified cannot be found or does not belong to you.',
|
|
941
953
|
_response
|
|
942
954
|
)
|
|
943
|
-
|
|
955
|
+
when 415
|
|
944
956
|
raise ApiErrorException.new(
|
|
945
957
|
'We don\'t support that media type. If a request body is required,' \
|
|
946
958
|
' please send it to us as `application/json`.',
|
|
947
959
|
_response
|
|
948
960
|
)
|
|
949
|
-
|
|
961
|
+
when 429
|
|
950
962
|
raise ApiErrorException.new(
|
|
951
963
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
952
964
|
' slow your request rate down and try again.',
|
|
953
965
|
_response
|
|
954
966
|
)
|
|
955
|
-
|
|
967
|
+
when 500
|
|
956
968
|
raise ApiErrorException.new(
|
|
957
969
|
'Something unexpected happened. Please try again.',
|
|
958
970
|
_response
|
|
@@ -1009,41 +1021,42 @@ module Voice
|
|
|
1009
1021
|
_response = execute_request(_request)
|
|
1010
1022
|
|
|
1011
1023
|
# Validate response against endpoint and global error codes.
|
|
1012
|
-
|
|
1024
|
+
case _response.status_code
|
|
1025
|
+
when 400
|
|
1013
1026
|
raise ApiErrorException.new(
|
|
1014
1027
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1015
1028
|
' fix it before trying again.',
|
|
1016
1029
|
_response
|
|
1017
1030
|
)
|
|
1018
|
-
|
|
1031
|
+
when 401
|
|
1019
1032
|
raise APIException.new(
|
|
1020
1033
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1021
1034
|
' credentials to authenticate to the API.',
|
|
1022
1035
|
_response
|
|
1023
1036
|
)
|
|
1024
|
-
|
|
1037
|
+
when 403
|
|
1025
1038
|
raise ApiErrorException.new(
|
|
1026
1039
|
'User unauthorized to perform this action.',
|
|
1027
1040
|
_response
|
|
1028
1041
|
)
|
|
1029
|
-
|
|
1042
|
+
when 404
|
|
1030
1043
|
raise ApiErrorException.new(
|
|
1031
1044
|
'The resource specified cannot be found or does not belong to you.',
|
|
1032
1045
|
_response
|
|
1033
1046
|
)
|
|
1034
|
-
|
|
1047
|
+
when 415
|
|
1035
1048
|
raise ApiErrorException.new(
|
|
1036
1049
|
'We don\'t support that media type. If a request body is required,' \
|
|
1037
1050
|
' please send it to us as `application/json`.',
|
|
1038
1051
|
_response
|
|
1039
1052
|
)
|
|
1040
|
-
|
|
1053
|
+
when 429
|
|
1041
1054
|
raise ApiErrorException.new(
|
|
1042
1055
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1043
1056
|
' slow your request rate down and try again.',
|
|
1044
1057
|
_response
|
|
1045
1058
|
)
|
|
1046
|
-
|
|
1059
|
+
when 500
|
|
1047
1060
|
raise ApiErrorException.new(
|
|
1048
1061
|
'Something unexpected happened. Please try again.',
|
|
1049
1062
|
_response
|
|
@@ -1089,41 +1102,42 @@ module Voice
|
|
|
1089
1102
|
_response = execute_request(_request)
|
|
1090
1103
|
|
|
1091
1104
|
# Validate response against endpoint and global error codes.
|
|
1092
|
-
|
|
1105
|
+
case _response.status_code
|
|
1106
|
+
when 400
|
|
1093
1107
|
raise ApiErrorException.new(
|
|
1094
1108
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1095
1109
|
' fix it before trying again.',
|
|
1096
1110
|
_response
|
|
1097
1111
|
)
|
|
1098
|
-
|
|
1112
|
+
when 401
|
|
1099
1113
|
raise APIException.new(
|
|
1100
1114
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1101
1115
|
' credentials to authenticate to the API.',
|
|
1102
1116
|
_response
|
|
1103
1117
|
)
|
|
1104
|
-
|
|
1118
|
+
when 403
|
|
1105
1119
|
raise ApiErrorException.new(
|
|
1106
1120
|
'User unauthorized to perform this action.',
|
|
1107
1121
|
_response
|
|
1108
1122
|
)
|
|
1109
|
-
|
|
1123
|
+
when 404
|
|
1110
1124
|
raise ApiErrorException.new(
|
|
1111
1125
|
'The resource specified cannot be found or does not belong to you.',
|
|
1112
1126
|
_response
|
|
1113
1127
|
)
|
|
1114
|
-
|
|
1128
|
+
when 415
|
|
1115
1129
|
raise ApiErrorException.new(
|
|
1116
1130
|
'We don\'t support that media type. If a request body is required,' \
|
|
1117
1131
|
' please send it to us as `application/json`.',
|
|
1118
1132
|
_response
|
|
1119
1133
|
)
|
|
1120
|
-
|
|
1134
|
+
when 429
|
|
1121
1135
|
raise ApiErrorException.new(
|
|
1122
1136
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1123
1137
|
' slow your request rate down and try again.',
|
|
1124
1138
|
_response
|
|
1125
1139
|
)
|
|
1126
|
-
|
|
1140
|
+
when 500
|
|
1127
1141
|
raise ApiErrorException.new(
|
|
1128
1142
|
'Something unexpected happened. Please try again.',
|
|
1129
1143
|
_response
|
|
@@ -1171,41 +1185,42 @@ module Voice
|
|
|
1171
1185
|
_response = execute_request(_request)
|
|
1172
1186
|
|
|
1173
1187
|
# Validate response against endpoint and global error codes.
|
|
1174
|
-
|
|
1188
|
+
case _response.status_code
|
|
1189
|
+
when 400
|
|
1175
1190
|
raise ApiErrorException.new(
|
|
1176
1191
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1177
1192
|
' fix it before trying again.',
|
|
1178
1193
|
_response
|
|
1179
1194
|
)
|
|
1180
|
-
|
|
1195
|
+
when 401
|
|
1181
1196
|
raise APIException.new(
|
|
1182
1197
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1183
1198
|
' credentials to authenticate to the API.',
|
|
1184
1199
|
_response
|
|
1185
1200
|
)
|
|
1186
|
-
|
|
1201
|
+
when 403
|
|
1187
1202
|
raise ApiErrorException.new(
|
|
1188
1203
|
'User unauthorized to perform this action.',
|
|
1189
1204
|
_response
|
|
1190
1205
|
)
|
|
1191
|
-
|
|
1206
|
+
when 404
|
|
1192
1207
|
raise ApiErrorException.new(
|
|
1193
1208
|
'The resource specified cannot be found or does not belong to you.',
|
|
1194
1209
|
_response
|
|
1195
1210
|
)
|
|
1196
|
-
|
|
1211
|
+
when 415
|
|
1197
1212
|
raise ApiErrorException.new(
|
|
1198
1213
|
'We don\'t support that media type. If a request body is required,' \
|
|
1199
1214
|
' please send it to us as `application/json`.',
|
|
1200
1215
|
_response
|
|
1201
1216
|
)
|
|
1202
|
-
|
|
1217
|
+
when 429
|
|
1203
1218
|
raise ApiErrorException.new(
|
|
1204
1219
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1205
1220
|
' slow your request rate down and try again.',
|
|
1206
1221
|
_response
|
|
1207
1222
|
)
|
|
1208
|
-
|
|
1223
|
+
when 500
|
|
1209
1224
|
raise ApiErrorException.new(
|
|
1210
1225
|
'Something unexpected happened. Please try again.',
|
|
1211
1226
|
_response
|
|
@@ -1253,41 +1268,42 @@ module Voice
|
|
|
1253
1268
|
_response = execute_request(_request)
|
|
1254
1269
|
|
|
1255
1270
|
# Validate response against endpoint and global error codes.
|
|
1256
|
-
|
|
1271
|
+
case _response.status_code
|
|
1272
|
+
when 400
|
|
1257
1273
|
raise ApiErrorException.new(
|
|
1258
1274
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1259
1275
|
' fix it before trying again.',
|
|
1260
1276
|
_response
|
|
1261
1277
|
)
|
|
1262
|
-
|
|
1278
|
+
when 401
|
|
1263
1279
|
raise APIException.new(
|
|
1264
1280
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1265
1281
|
' credentials to authenticate to the API.',
|
|
1266
1282
|
_response
|
|
1267
1283
|
)
|
|
1268
|
-
|
|
1284
|
+
when 403
|
|
1269
1285
|
raise ApiErrorException.new(
|
|
1270
1286
|
'User unauthorized to perform this action.',
|
|
1271
1287
|
_response
|
|
1272
1288
|
)
|
|
1273
|
-
|
|
1289
|
+
when 404
|
|
1274
1290
|
raise ApiErrorException.new(
|
|
1275
1291
|
'The resource specified cannot be found or does not belong to you.',
|
|
1276
1292
|
_response
|
|
1277
1293
|
)
|
|
1278
|
-
|
|
1294
|
+
when 415
|
|
1279
1295
|
raise ApiErrorException.new(
|
|
1280
1296
|
'We don\'t support that media type. If a request body is required,' \
|
|
1281
1297
|
' please send it to us as `application/json`.',
|
|
1282
1298
|
_response
|
|
1283
1299
|
)
|
|
1284
|
-
|
|
1300
|
+
when 429
|
|
1285
1301
|
raise ApiErrorException.new(
|
|
1286
1302
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1287
1303
|
' slow your request rate down and try again.',
|
|
1288
1304
|
_response
|
|
1289
1305
|
)
|
|
1290
|
-
|
|
1306
|
+
when 500
|
|
1291
1307
|
raise ApiErrorException.new(
|
|
1292
1308
|
'Something unexpected happened. Please try again.',
|
|
1293
1309
|
_response
|
|
@@ -1332,41 +1348,42 @@ module Voice
|
|
|
1332
1348
|
_response = execute_request(_request)
|
|
1333
1349
|
|
|
1334
1350
|
# Validate response against endpoint and global error codes.
|
|
1335
|
-
|
|
1351
|
+
case _response.status_code
|
|
1352
|
+
when 400
|
|
1336
1353
|
raise ApiErrorException.new(
|
|
1337
1354
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1338
1355
|
' fix it before trying again.',
|
|
1339
1356
|
_response
|
|
1340
1357
|
)
|
|
1341
|
-
|
|
1358
|
+
when 401
|
|
1342
1359
|
raise APIException.new(
|
|
1343
1360
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1344
1361
|
' credentials to authenticate to the API.',
|
|
1345
1362
|
_response
|
|
1346
1363
|
)
|
|
1347
|
-
|
|
1364
|
+
when 403
|
|
1348
1365
|
raise ApiErrorException.new(
|
|
1349
1366
|
'User unauthorized to perform this action.',
|
|
1350
1367
|
_response
|
|
1351
1368
|
)
|
|
1352
|
-
|
|
1369
|
+
when 404
|
|
1353
1370
|
raise ApiErrorException.new(
|
|
1354
1371
|
'The resource specified cannot be found or does not belong to you.',
|
|
1355
1372
|
_response
|
|
1356
1373
|
)
|
|
1357
|
-
|
|
1374
|
+
when 415
|
|
1358
1375
|
raise ApiErrorException.new(
|
|
1359
1376
|
'We don\'t support that media type. If a request body is required,' \
|
|
1360
1377
|
' please send it to us as `application/json`.',
|
|
1361
1378
|
_response
|
|
1362
1379
|
)
|
|
1363
|
-
|
|
1380
|
+
when 429
|
|
1364
1381
|
raise ApiErrorException.new(
|
|
1365
1382
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1366
1383
|
' slow your request rate down and try again.',
|
|
1367
1384
|
_response
|
|
1368
1385
|
)
|
|
1369
|
-
|
|
1386
|
+
when 500
|
|
1370
1387
|
raise ApiErrorException.new(
|
|
1371
1388
|
'Something unexpected happened. Please try again.',
|
|
1372
1389
|
_response
|
|
@@ -1412,41 +1429,42 @@ module Voice
|
|
|
1412
1429
|
_response = execute_request(_request)
|
|
1413
1430
|
|
|
1414
1431
|
# Validate response against endpoint and global error codes.
|
|
1415
|
-
|
|
1432
|
+
case _response.status_code
|
|
1433
|
+
when 400
|
|
1416
1434
|
raise ApiErrorException.new(
|
|
1417
1435
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1418
1436
|
' fix it before trying again.',
|
|
1419
1437
|
_response
|
|
1420
1438
|
)
|
|
1421
|
-
|
|
1439
|
+
when 401
|
|
1422
1440
|
raise APIException.new(
|
|
1423
1441
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1424
1442
|
' credentials to authenticate to the API.',
|
|
1425
1443
|
_response
|
|
1426
1444
|
)
|
|
1427
|
-
|
|
1445
|
+
when 403
|
|
1428
1446
|
raise ApiErrorException.new(
|
|
1429
1447
|
'User unauthorized to perform this action.',
|
|
1430
1448
|
_response
|
|
1431
1449
|
)
|
|
1432
|
-
|
|
1450
|
+
when 404
|
|
1433
1451
|
raise ApiErrorException.new(
|
|
1434
1452
|
'The resource specified cannot be found or does not belong to you.',
|
|
1435
1453
|
_response
|
|
1436
1454
|
)
|
|
1437
|
-
|
|
1455
|
+
when 415
|
|
1438
1456
|
raise ApiErrorException.new(
|
|
1439
1457
|
'We don\'t support that media type. If a request body is required,' \
|
|
1440
1458
|
' please send it to us as `application/json`.',
|
|
1441
1459
|
_response
|
|
1442
1460
|
)
|
|
1443
|
-
|
|
1461
|
+
when 429
|
|
1444
1462
|
raise ApiErrorException.new(
|
|
1445
1463
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1446
1464
|
' slow your request rate down and try again.',
|
|
1447
1465
|
_response
|
|
1448
1466
|
)
|
|
1449
|
-
|
|
1467
|
+
when 500
|
|
1450
1468
|
raise ApiErrorException.new(
|
|
1451
1469
|
'Something unexpected happened. Please try again.',
|
|
1452
1470
|
_response
|
|
@@ -1495,41 +1513,42 @@ module Voice
|
|
|
1495
1513
|
_response = execute_request(_request)
|
|
1496
1514
|
|
|
1497
1515
|
# Validate response against endpoint and global error codes.
|
|
1498
|
-
|
|
1516
|
+
case _response.status_code
|
|
1517
|
+
when 400
|
|
1499
1518
|
raise ApiErrorException.new(
|
|
1500
1519
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1501
1520
|
' fix it before trying again.',
|
|
1502
1521
|
_response
|
|
1503
1522
|
)
|
|
1504
|
-
|
|
1523
|
+
when 401
|
|
1505
1524
|
raise APIException.new(
|
|
1506
1525
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1507
1526
|
' credentials to authenticate to the API.',
|
|
1508
1527
|
_response
|
|
1509
1528
|
)
|
|
1510
|
-
|
|
1529
|
+
when 403
|
|
1511
1530
|
raise ApiErrorException.new(
|
|
1512
1531
|
'User unauthorized to perform this action.',
|
|
1513
1532
|
_response
|
|
1514
1533
|
)
|
|
1515
|
-
|
|
1534
|
+
when 404
|
|
1516
1535
|
raise ApiErrorException.new(
|
|
1517
1536
|
'The resource specified cannot be found or does not belong to you.',
|
|
1518
1537
|
_response
|
|
1519
1538
|
)
|
|
1520
|
-
|
|
1539
|
+
when 415
|
|
1521
1540
|
raise ApiErrorException.new(
|
|
1522
1541
|
'We don\'t support that media type. If a request body is required,' \
|
|
1523
1542
|
' please send it to us as `application/json`.',
|
|
1524
1543
|
_response
|
|
1525
1544
|
)
|
|
1526
|
-
|
|
1545
|
+
when 429
|
|
1527
1546
|
raise ApiErrorException.new(
|
|
1528
1547
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1529
1548
|
' slow your request rate down and try again.',
|
|
1530
1549
|
_response
|
|
1531
1550
|
)
|
|
1532
|
-
|
|
1551
|
+
when 500
|
|
1533
1552
|
raise ApiErrorException.new(
|
|
1534
1553
|
'Something unexpected happened. Please try again.',
|
|
1535
1554
|
_response
|
|
@@ -1577,41 +1596,42 @@ module Voice
|
|
|
1577
1596
|
_response = execute_request(_request)
|
|
1578
1597
|
|
|
1579
1598
|
# Validate response against endpoint and global error codes.
|
|
1580
|
-
|
|
1599
|
+
case _response.status_code
|
|
1600
|
+
when 400
|
|
1581
1601
|
raise ApiErrorException.new(
|
|
1582
1602
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1583
1603
|
' fix it before trying again.',
|
|
1584
1604
|
_response
|
|
1585
1605
|
)
|
|
1586
|
-
|
|
1606
|
+
when 401
|
|
1587
1607
|
raise APIException.new(
|
|
1588
1608
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1589
1609
|
' credentials to authenticate to the API.',
|
|
1590
1610
|
_response
|
|
1591
1611
|
)
|
|
1592
|
-
|
|
1612
|
+
when 403
|
|
1593
1613
|
raise ApiErrorException.new(
|
|
1594
1614
|
'User unauthorized to perform this action.',
|
|
1595
1615
|
_response
|
|
1596
1616
|
)
|
|
1597
|
-
|
|
1617
|
+
when 404
|
|
1598
1618
|
raise ApiErrorException.new(
|
|
1599
1619
|
'The resource specified cannot be found or does not belong to you.',
|
|
1600
1620
|
_response
|
|
1601
1621
|
)
|
|
1602
|
-
|
|
1622
|
+
when 415
|
|
1603
1623
|
raise ApiErrorException.new(
|
|
1604
1624
|
'We don\'t support that media type. If a request body is required,' \
|
|
1605
1625
|
' please send it to us as `application/json`.',
|
|
1606
1626
|
_response
|
|
1607
1627
|
)
|
|
1608
|
-
|
|
1628
|
+
when 429
|
|
1609
1629
|
raise ApiErrorException.new(
|
|
1610
1630
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1611
1631
|
' slow your request rate down and try again.',
|
|
1612
1632
|
_response
|
|
1613
1633
|
)
|
|
1614
|
-
|
|
1634
|
+
when 500
|
|
1615
1635
|
raise ApiErrorException.new(
|
|
1616
1636
|
'Something unexpected happened. Please try again.',
|
|
1617
1637
|
_response
|
|
@@ -1673,41 +1693,42 @@ module Voice
|
|
|
1673
1693
|
_response = execute_request(_request)
|
|
1674
1694
|
|
|
1675
1695
|
# Validate response against endpoint and global error codes.
|
|
1676
|
-
|
|
1696
|
+
case _response.status_code
|
|
1697
|
+
when 400
|
|
1677
1698
|
raise ApiErrorException.new(
|
|
1678
1699
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1679
1700
|
' fix it before trying again.',
|
|
1680
1701
|
_response
|
|
1681
1702
|
)
|
|
1682
|
-
|
|
1703
|
+
when 401
|
|
1683
1704
|
raise APIException.new(
|
|
1684
1705
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1685
1706
|
' credentials to authenticate to the API.',
|
|
1686
1707
|
_response
|
|
1687
1708
|
)
|
|
1688
|
-
|
|
1709
|
+
when 403
|
|
1689
1710
|
raise ApiErrorException.new(
|
|
1690
1711
|
'User unauthorized to perform this action.',
|
|
1691
1712
|
_response
|
|
1692
1713
|
)
|
|
1693
|
-
|
|
1714
|
+
when 404
|
|
1694
1715
|
raise ApiErrorException.new(
|
|
1695
1716
|
'The resource specified cannot be found or does not belong to you.',
|
|
1696
1717
|
_response
|
|
1697
1718
|
)
|
|
1698
|
-
|
|
1719
|
+
when 415
|
|
1699
1720
|
raise ApiErrorException.new(
|
|
1700
1721
|
'We don\'t support that media type. If a request body is required,' \
|
|
1701
1722
|
' please send it to us as `application/json`.',
|
|
1702
1723
|
_response
|
|
1703
1724
|
)
|
|
1704
|
-
|
|
1725
|
+
when 429
|
|
1705
1726
|
raise ApiErrorException.new(
|
|
1706
1727
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1707
1728
|
' slow your request rate down and try again.',
|
|
1708
1729
|
_response
|
|
1709
1730
|
)
|
|
1710
|
-
|
|
1731
|
+
when 500
|
|
1711
1732
|
raise ApiErrorException.new(
|
|
1712
1733
|
'Something unexpected happened. Please try again.',
|
|
1713
1734
|
_response
|