bandwidth-sdk 2.2.2 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +28 -2
  3. data/lib/bandwidth/api_helper.rb +14 -9
  4. data/lib/bandwidth/client.rb +22 -2
  5. data/lib/bandwidth/configuration.rb +67 -12
  6. data/lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb +22 -0
  7. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
  8. data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
  9. data/lib/bandwidth/messaging_lib/messaging/client.rb +13 -2
  10. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +48 -95
  11. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  12. data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +20 -0
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +51 -0
  15. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +158 -0
  16. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
  17. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
  18. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +88 -0
  19. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
  20. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
  21. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +94 -0
  22. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
  23. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +28 -0
  24. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +32 -0
  25. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +13 -1
  26. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
  27. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +6 -1
  28. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
  29. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
  30. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  31. data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
  32. data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
  33. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
  34. data/lib/bandwidth/voice_lib/voice.rb +8 -0
  35. data/lib/bandwidth/voice_lib/voice/client.rb +13 -2
  36. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +768 -131
  37. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  38. data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
  39. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
  40. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +65 -2
  41. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
  42. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
  43. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +107 -0
  44. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
  45. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
  46. data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
  47. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
  48. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +4 -1
  49. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +33 -5
  50. data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
  51. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
  52. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +10 -13
  53. data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +32 -0
  54. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +4 -13
  55. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
  56. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
  57. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  58. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
  59. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
  60. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  61. data/lib/bandwidth/{messaging_lib/messaging/exceptions/path_client_exception.rb → web_rtc_lib/web_rtc/exceptions/error_exception.rb} +4 -19
  62. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  63. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  64. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  66. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  67. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  68. metadata +60 -13
  69. data/lib/bandwidth/messaging_lib/messaging/models/field_error.rb +0 -44
@@ -17,20 +17,31 @@ module Bandwidth
17
17
 
18
18
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
19
19
  backoff_factor: 1, environment: Environment::PRODUCTION,
20
+ base_url: 'https://www.example.com',
20
21
  messaging_basic_auth_user_name: 'TODO: Replace',
21
22
  messaging_basic_auth_password: 'TODO: Replace',
23
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
24
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
22
25
  voice_basic_auth_user_name: 'TODO: Replace',
23
- voice_basic_auth_password: 'TODO: Replace', config: nil)
26
+ voice_basic_auth_password: 'TODO: Replace',
27
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
28
+ web_rtc_basic_auth_password: 'TODO: Replace',
29
+ config: nil)
24
30
  @config = if config.nil?
25
31
  Configuration.new(timeout: timeout,
26
32
  max_retries: max_retries,
27
33
  retry_interval: retry_interval,
28
34
  backoff_factor: backoff_factor,
29
35
  environment: environment,
36
+ base_url: base_url,
30
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
31
38
  messaging_basic_auth_password: messaging_basic_auth_password,
39
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
40
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
32
41
  voice_basic_auth_user_name: voice_basic_auth_user_name,
33
- voice_basic_auth_password: voice_basic_auth_password)
42
+ voice_basic_auth_password: voice_basic_auth_password,
43
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
44
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
34
45
  else
35
46
  config
36
47
  end
@@ -22,7 +22,7 @@ module Voice
22
22
  _query_builder << '/api/v2/accounts/{accountId}/calls'
23
23
  _query_builder = APIHelper.append_url_with_template_parameters(
24
24
  _query_builder,
25
- 'accountId' => account_id
25
+ 'accountId' => { 'value' => account_id, 'encode' => true }
26
26
  )
27
27
  _query_url = APIHelper.clean_url _query_builder
28
28
 
@@ -44,20 +44,19 @@ module Voice
44
44
  # Validate response against endpoint and global error codes.
45
45
  if _response.status_code == 400
46
46
  raise ApiErrorResponseException.new(
47
- 'Something\'s not quite right... Either your request is invalid or' \
48
- ' you\'re requesting it at a bad time. Please fix it' \
49
- ' before trying again.',
47
+ 'Something\'s not quite right... Your request is invalid. Please' \
48
+ ' fix it before trying again.',
50
49
  _response
51
50
  )
52
51
  elsif _response.status_code == 401
53
52
  raise APIException.new(
54
- 'Please authenticate yourself.',
53
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
54
+ ' credentials to authenticate to the API.',
55
55
  _response
56
56
  )
57
57
  elsif _response.status_code == 403
58
58
  raise ApiErrorResponseException.new(
59
- 'Your credentials are invalid. Please use your API credentials for' \
60
- ' the Bandwidth Dashboard.',
59
+ 'User unauthorized to perform this action.',
61
60
  _response
62
61
  )
63
62
  elsif _response.status_code == 404
@@ -87,7 +86,9 @@ module Voice
87
86
 
88
87
  # Return appropriate response type.
89
88
  decoded = APIHelper.json_deserialize(_response.raw_body)
90
- ApiResponse.new(_response, data: ApiCallResponse.from_hash(decoded))
89
+ ApiResponse.new(
90
+ _response, data: ApiCallResponse.from_hash(decoded)
91
+ )
91
92
  end
92
93
 
93
94
  # Returns near-realtime metadata about the specified call
@@ -101,8 +102,8 @@ module Voice
101
102
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
102
103
  _query_builder = APIHelper.append_url_with_template_parameters(
103
104
  _query_builder,
104
- 'accountId' => account_id,
105
- 'callId' => call_id
105
+ 'accountId' => { 'value' => account_id, 'encode' => true },
106
+ 'callId' => { 'value' => call_id, 'encode' => true }
106
107
  )
107
108
  _query_url = APIHelper.clean_url _query_builder
108
109
 
@@ -122,20 +123,19 @@ module Voice
122
123
  # Validate response against endpoint and global error codes.
123
124
  if _response.status_code == 400
124
125
  raise ApiErrorResponseException.new(
125
- 'Something\'s not quite right... Either your request is invalid or' \
126
- ' you\'re requesting it at a bad time. Please fix it' \
127
- ' before trying again.',
126
+ 'Something\'s not quite right... Your request is invalid. Please' \
127
+ ' fix it before trying again.',
128
128
  _response
129
129
  )
130
130
  elsif _response.status_code == 401
131
131
  raise APIException.new(
132
- 'Please authenticate yourself.',
132
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
133
+ ' credentials to authenticate to the API.',
133
134
  _response
134
135
  )
135
136
  elsif _response.status_code == 403
136
137
  raise ApiErrorResponseException.new(
137
- 'Your credentials are invalid. Please use your API credentials for' \
138
- ' the Bandwidth Dashboard.',
138
+ 'User unauthorized to perform this action.',
139
139
  _response
140
140
  )
141
141
  elsif _response.status_code == 404
@@ -165,7 +165,9 @@ module Voice
165
165
 
166
166
  # Return appropriate response type.
167
167
  decoded = APIHelper.json_deserialize(_response.raw_body)
168
- ApiResponse.new(_response, data: ApiCallStateResponse.from_hash(decoded))
168
+ ApiResponse.new(
169
+ _response, data: ApiCallStateResponse.from_hash(decoded)
170
+ )
169
171
  end
170
172
 
171
173
  # Interrupts and replaces an active call's BXML document
@@ -181,8 +183,8 @@ module Voice
181
183
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
182
184
  _query_builder = APIHelper.append_url_with_template_parameters(
183
185
  _query_builder,
184
- 'accountId' => account_id,
185
- 'callId' => call_id
186
+ 'accountId' => { 'value' => account_id, 'encode' => true },
187
+ 'callId' => { 'value' => call_id, 'encode' => true }
186
188
  )
187
189
  _query_url = APIHelper.clean_url _query_builder
188
190
 
@@ -203,20 +205,19 @@ module Voice
203
205
  # Validate response against endpoint and global error codes.
204
206
  if _response.status_code == 400
205
207
  raise ApiErrorResponseException.new(
206
- 'Something\'s not quite right... Either your request is invalid or' \
207
- ' you\'re requesting it at a bad time. Please fix it' \
208
- ' before trying again.',
208
+ 'Something\'s not quite right... Your request is invalid. Please' \
209
+ ' fix it before trying again.',
209
210
  _response
210
211
  )
211
212
  elsif _response.status_code == 401
212
213
  raise APIException.new(
213
- 'Please authenticate yourself.',
214
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
215
+ ' credentials to authenticate to the API.',
214
216
  _response
215
217
  )
216
218
  elsif _response.status_code == 403
217
219
  raise ApiErrorResponseException.new(
218
- 'Your credentials are invalid. Please use your API credentials for' \
219
- ' the Bandwidth Dashboard.',
220
+ 'User unauthorized to perform this action.',
220
221
  _response
221
222
  )
222
223
  elsif _response.status_code == 404
@@ -261,8 +262,8 @@ module Voice
261
262
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
262
263
  _query_builder = APIHelper.append_url_with_template_parameters(
263
264
  _query_builder,
264
- 'accountId' => account_id,
265
- 'callId' => call_id
265
+ 'accountId' => { 'value' => account_id, 'encode' => true },
266
+ 'callId' => { 'value' => call_id, 'encode' => true }
266
267
  )
267
268
  _query_url = APIHelper.clean_url _query_builder
268
269
 
@@ -283,20 +284,19 @@ module Voice
283
284
  # Validate response against endpoint and global error codes.
284
285
  if _response.status_code == 400
285
286
  raise ApiErrorResponseException.new(
286
- 'Something\'s not quite right... Either your request is invalid or' \
287
- ' you\'re requesting it at a bad time. Please fix it' \
288
- ' before trying again.',
287
+ 'Something\'s not quite right... Your request is invalid. Please' \
288
+ ' fix it before trying again.',
289
289
  _response
290
290
  )
291
291
  elsif _response.status_code == 401
292
292
  raise APIException.new(
293
- 'Please authenticate yourself.',
293
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
294
+ ' credentials to authenticate to the API.',
294
295
  _response
295
296
  )
296
297
  elsif _response.status_code == 403
297
298
  raise ApiErrorResponseException.new(
298
- 'Your credentials are invalid. Please use your API credentials for' \
299
- ' the Bandwidth Dashboard.',
299
+ 'User unauthorized to perform this action.',
300
300
  _response
301
301
  )
302
302
  elsif _response.status_code == 404
@@ -332,31 +332,16 @@ module Voice
332
332
  # took place during the specified call
333
333
  # @param [String] account_id Required parameter: Example:
334
334
  # @param [String] call_id Required parameter: Example:
335
- # @param [String] from Optional parameter: Example:
336
- # @param [String] to Optional parameter: Example:
337
- # @param [String] min_start_time Optional parameter: Example:
338
- # @param [String] max_start_time Optional parameter: Example:
339
335
  # @return [List of RecordingMetadataResponse] response from the API call
340
336
  def get_query_metadata_for_account_and_call(account_id,
341
- call_id,
342
- from: nil,
343
- to: nil,
344
- min_start_time: nil,
345
- max_start_time: nil)
337
+ call_id)
346
338
  # Prepare query url.
347
339
  _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
348
340
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
349
341
  _query_builder = APIHelper.append_url_with_template_parameters(
350
342
  _query_builder,
351
- 'accountId' => account_id,
352
- 'callId' => call_id
353
- )
354
- _query_builder = APIHelper.append_url_with_query_parameters(
355
- _query_builder,
356
- 'from' => from,
357
- 'to' => to,
358
- 'minStartTime' => min_start_time,
359
- 'maxStartTime' => max_start_time
343
+ 'accountId' => { 'value' => account_id, 'encode' => true },
344
+ 'callId' => { 'value' => call_id, 'encode' => true }
360
345
  )
361
346
  _query_url = APIHelper.clean_url _query_builder
362
347
 
@@ -376,20 +361,19 @@ module Voice
376
361
  # Validate response against endpoint and global error codes.
377
362
  if _response.status_code == 400
378
363
  raise ApiErrorResponseException.new(
379
- 'Something\'s not quite right... Either your request is invalid or' \
380
- ' you\'re requesting it at a bad time. Please fix it' \
381
- ' before trying again.',
364
+ 'Something\'s not quite right... Your request is invalid. Please' \
365
+ ' fix it before trying again.',
382
366
  _response
383
367
  )
384
368
  elsif _response.status_code == 401
385
369
  raise APIException.new(
386
- 'Please authenticate yourself.',
370
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
371
+ ' credentials to authenticate to the API.',
387
372
  _response
388
373
  )
389
374
  elsif _response.status_code == 403
390
375
  raise ApiErrorResponseException.new(
391
- 'Your credentials are invalid. Please use your API credentials for' \
392
- ' the Bandwidth Dashboard.',
376
+ 'User unauthorized to perform this action.',
393
377
  _response
394
378
  )
395
379
  elsif _response.status_code == 404
@@ -438,9 +422,9 @@ module Voice
438
422
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
439
423
  _query_builder = APIHelper.append_url_with_template_parameters(
440
424
  _query_builder,
441
- 'accountId' => account_id,
442
- 'callId' => call_id,
443
- 'recordingId' => recording_id
425
+ 'accountId' => { 'value' => account_id, 'encode' => true },
426
+ 'callId' => { 'value' => call_id, 'encode' => true },
427
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
444
428
  )
445
429
  _query_url = APIHelper.clean_url _query_builder
446
430
 
@@ -460,20 +444,19 @@ module Voice
460
444
  # Validate response against endpoint and global error codes.
461
445
  if _response.status_code == 400
462
446
  raise ApiErrorResponseException.new(
463
- 'Something\'s not quite right... Either your request is invalid or' \
464
- ' you\'re requesting it at a bad time. Please fix it' \
465
- ' before trying again.',
447
+ 'Something\'s not quite right... Your request is invalid. Please' \
448
+ ' fix it before trying again.',
466
449
  _response
467
450
  )
468
451
  elsif _response.status_code == 401
469
452
  raise APIException.new(
470
- 'Please authenticate yourself.',
453
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
454
+ ' credentials to authenticate to the API.',
471
455
  _response
472
456
  )
473
457
  elsif _response.status_code == 403
474
458
  raise ApiErrorResponseException.new(
475
- 'Your credentials are invalid. Please use your API credentials for' \
476
- ' the Bandwidth Dashboard.',
459
+ 'User unauthorized to perform this action.',
477
460
  _response
478
461
  )
479
462
  elsif _response.status_code == 404
@@ -503,8 +486,9 @@ module Voice
503
486
 
504
487
  # Return appropriate response type.
505
488
  decoded = APIHelper.json_deserialize(_response.raw_body)
506
- ApiResponse.new(_response,
507
- data: RecordingMetadataResponse.from_hash(decoded))
489
+ ApiResponse.new(
490
+ _response, data: RecordingMetadataResponse.from_hash(decoded)
491
+ )
508
492
  end
509
493
 
510
494
  # Deletes the specified recording
@@ -520,9 +504,9 @@ module Voice
520
504
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
521
505
  _query_builder = APIHelper.append_url_with_template_parameters(
522
506
  _query_builder,
523
- 'accountId' => account_id,
524
- 'callId' => call_id,
525
- 'recordingId' => recording_id
507
+ 'accountId' => { 'value' => account_id, 'encode' => true },
508
+ 'callId' => { 'value' => call_id, 'encode' => true },
509
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
526
510
  )
527
511
  _query_url = APIHelper.clean_url _query_builder
528
512
 
@@ -536,20 +520,19 @@ module Voice
536
520
  # Validate response against endpoint and global error codes.
537
521
  if _response.status_code == 400
538
522
  raise ApiErrorResponseException.new(
539
- 'Something\'s not quite right... Either your request is invalid or' \
540
- ' you\'re requesting it at a bad time. Please fix it' \
541
- ' before trying again.',
523
+ 'Something\'s not quite right... Your request is invalid. Please' \
524
+ ' fix it before trying again.',
542
525
  _response
543
526
  )
544
527
  elsif _response.status_code == 401
545
528
  raise APIException.new(
546
- 'Please authenticate yourself.',
529
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
530
+ ' credentials to authenticate to the API.',
547
531
  _response
548
532
  )
549
533
  elsif _response.status_code == 403
550
534
  raise ApiErrorResponseException.new(
551
- 'Your credentials are invalid. Please use your API credentials for' \
552
- ' the Bandwidth Dashboard.',
535
+ 'User unauthorized to perform this action.',
553
536
  _response
554
537
  )
555
538
  elsif _response.status_code == 404
@@ -594,9 +577,9 @@ module Voice
594
577
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
595
578
  _query_builder = APIHelper.append_url_with_template_parameters(
596
579
  _query_builder,
597
- 'accountId' => account_id,
598
- 'callId' => call_id,
599
- 'recordingId' => recording_id
580
+ 'accountId' => { 'value' => account_id, 'encode' => true },
581
+ 'callId' => { 'value' => call_id, 'encode' => true },
582
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
600
583
  )
601
584
  _query_url = APIHelper.clean_url _query_builder
602
585
 
@@ -610,20 +593,19 @@ module Voice
610
593
  # Validate response against endpoint and global error codes.
611
594
  if _response.status_code == 400
612
595
  raise ApiErrorResponseException.new(
613
- 'Something\'s not quite right... Either your request is invalid or' \
614
- ' you\'re requesting it at a bad time. Please fix it' \
615
- ' before trying again.',
596
+ 'Something\'s not quite right... Your request is invalid. Please' \
597
+ ' fix it before trying again.',
616
598
  _response
617
599
  )
618
600
  elsif _response.status_code == 401
619
601
  raise APIException.new(
620
- 'Please authenticate yourself.',
602
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
603
+ ' credentials to authenticate to the API.',
621
604
  _response
622
605
  )
623
606
  elsif _response.status_code == 403
624
607
  raise ApiErrorResponseException.new(
625
- 'Your credentials are invalid. Please use your API credentials for' \
626
- ' the Bandwidth Dashboard.',
608
+ 'User unauthorized to perform this action.',
627
609
  _response
628
610
  )
629
611
  elsif _response.status_code == 404
@@ -652,7 +634,9 @@ module Voice
652
634
  validate_response(_response)
653
635
 
654
636
  # Return appropriate response type.
655
- ApiResponse.new(_response, data: _response.raw_body)
637
+ ApiResponse.new(
638
+ _response, data: _response.raw_body
639
+ )
656
640
  end
657
641
 
658
642
  # Deletes the specified recording's media
@@ -668,9 +652,9 @@ module Voice
668
652
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
669
653
  _query_builder = APIHelper.append_url_with_template_parameters(
670
654
  _query_builder,
671
- 'accountId' => account_id,
672
- 'callId' => call_id,
673
- 'recordingId' => recording_id
655
+ 'accountId' => { 'value' => account_id, 'encode' => true },
656
+ 'callId' => { 'value' => call_id, 'encode' => true },
657
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
674
658
  )
675
659
  _query_url = APIHelper.clean_url _query_builder
676
660
 
@@ -684,20 +668,19 @@ module Voice
684
668
  # Validate response against endpoint and global error codes.
685
669
  if _response.status_code == 400
686
670
  raise ApiErrorResponseException.new(
687
- 'Something\'s not quite right... Either your request is invalid or' \
688
- ' you\'re requesting it at a bad time. Please fix it' \
689
- ' before trying again.',
671
+ 'Something\'s not quite right... Your request is invalid. Please' \
672
+ ' fix it before trying again.',
690
673
  _response
691
674
  )
692
675
  elsif _response.status_code == 401
693
676
  raise APIException.new(
694
- 'Please authenticate yourself.',
677
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
678
+ ' credentials to authenticate to the API.',
695
679
  _response
696
680
  )
697
681
  elsif _response.status_code == 403
698
682
  raise ApiErrorResponseException.new(
699
- 'Your credentials are invalid. Please use your API credentials for' \
700
- ' the Bandwidth Dashboard.',
683
+ 'User unauthorized to perform this action.',
701
684
  _response
702
685
  )
703
686
  elsif _response.status_code == 404
@@ -742,9 +725,9 @@ module Voice
742
725
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
743
726
  _query_builder = APIHelper.append_url_with_template_parameters(
744
727
  _query_builder,
745
- 'accountId' => account_id,
746
- 'callId' => call_id,
747
- 'recordingId' => recording_id
728
+ 'accountId' => { 'value' => account_id, 'encode' => true },
729
+ 'callId' => { 'value' => call_id, 'encode' => true },
730
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
748
731
  )
749
732
  _query_url = APIHelper.clean_url _query_builder
750
733
 
@@ -764,20 +747,19 @@ module Voice
764
747
  # Validate response against endpoint and global error codes.
765
748
  if _response.status_code == 400
766
749
  raise ApiErrorResponseException.new(
767
- 'Something\'s not quite right... Either your request is invalid or' \
768
- ' you\'re requesting it at a bad time. Please fix it' \
769
- ' before trying again.',
750
+ 'Something\'s not quite right... Your request is invalid. Please' \
751
+ ' fix it before trying again.',
770
752
  _response
771
753
  )
772
754
  elsif _response.status_code == 401
773
755
  raise APIException.new(
774
- 'Please authenticate yourself.',
756
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
757
+ ' credentials to authenticate to the API.',
775
758
  _response
776
759
  )
777
760
  elsif _response.status_code == 403
778
761
  raise ApiErrorResponseException.new(
779
- 'Your credentials are invalid. Please use your API credentials for' \
780
- ' the Bandwidth Dashboard.',
762
+ 'User unauthorized to perform this action.',
781
763
  _response
782
764
  )
783
765
  elsif _response.status_code == 404
@@ -807,7 +789,9 @@ module Voice
807
789
 
808
790
  # Return appropriate response type.
809
791
  decoded = APIHelper.json_deserialize(_response.raw_body)
810
- ApiResponse.new(_response, data: TranscriptionResponse.from_hash(decoded))
792
+ ApiResponse.new(
793
+ _response, data: TranscriptionResponse.from_hash(decoded)
794
+ )
811
795
  end
812
796
 
813
797
  # Requests that the specified recording be transcribed
@@ -825,9 +809,9 @@ module Voice
825
809
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
826
810
  _query_builder = APIHelper.append_url_with_template_parameters(
827
811
  _query_builder,
828
- 'accountId' => account_id,
829
- 'callId' => call_id,
830
- 'recordingId' => recording_id
812
+ 'accountId' => { 'value' => account_id, 'encode' => true },
813
+ 'callId' => { 'value' => call_id, 'encode' => true },
814
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
831
815
  )
832
816
  _query_url = APIHelper.clean_url _query_builder
833
817
 
@@ -848,20 +832,19 @@ module Voice
848
832
  # Validate response against endpoint and global error codes.
849
833
  if _response.status_code == 400
850
834
  raise ApiErrorResponseException.new(
851
- 'Something\'s not quite right... Either your request is invalid or' \
852
- ' you\'re requesting it at a bad time. Please fix it' \
853
- ' before trying again.',
835
+ 'Something\'s not quite right... Your request is invalid. Please' \
836
+ ' fix it before trying again.',
854
837
  _response
855
838
  )
856
839
  elsif _response.status_code == 401
857
840
  raise APIException.new(
858
- 'Please authenticate yourself.',
841
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
842
+ ' credentials to authenticate to the API.',
859
843
  _response
860
844
  )
861
845
  elsif _response.status_code == 403
862
846
  raise ApiErrorResponseException.new(
863
- 'Your credentials are invalid. Please use your API credentials for' \
864
- ' the Bandwidth Dashboard.',
847
+ 'User unauthorized to perform this action.',
865
848
  _response
866
849
  )
867
850
  elsif _response.status_code == 404
@@ -912,9 +895,9 @@ module Voice
912
895
  _query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
913
896
  _query_builder = APIHelper.append_url_with_template_parameters(
914
897
  _query_builder,
915
- 'accountId' => account_id,
916
- 'callId' => call_id,
917
- 'recordingId' => recording_id
898
+ 'accountId' => { 'value' => account_id, 'encode' => true },
899
+ 'callId' => { 'value' => call_id, 'encode' => true },
900
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
918
901
  )
919
902
  _query_url = APIHelper.clean_url _query_builder
920
903
 
@@ -928,20 +911,273 @@ module Voice
928
911
  # Validate response against endpoint and global error codes.
929
912
  if _response.status_code == 400
930
913
  raise ApiErrorResponseException.new(
931
- 'Something\'s not quite right... Either your request is invalid or' \
932
- ' you\'re requesting it at a bad time. Please fix it' \
933
- ' before trying again.',
914
+ 'Something\'s not quite right... Your request is invalid. Please' \
915
+ ' fix it before trying again.',
916
+ _response
917
+ )
918
+ elsif _response.status_code == 401
919
+ raise APIException.new(
920
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
921
+ ' credentials to authenticate to the API.',
922
+ _response
923
+ )
924
+ elsif _response.status_code == 403
925
+ raise ApiErrorResponseException.new(
926
+ 'User unauthorized to perform this action.',
927
+ _response
928
+ )
929
+ elsif _response.status_code == 404
930
+ raise ApiErrorResponseException.new(
931
+ 'The resource specified cannot be found or does not belong to you.',
932
+ _response
933
+ )
934
+ elsif _response.status_code == 415
935
+ raise ApiErrorResponseException.new(
936
+ 'We don\'t support that media type. If a request body is required,' \
937
+ ' please send it to us as `application/json`.',
938
+ _response
939
+ )
940
+ elsif _response.status_code == 429
941
+ raise ApiErrorResponseException.new(
942
+ 'You\'re sending requests to this endpoint too frequently. Please' \
943
+ ' slow your request rate down and try again.',
944
+ _response
945
+ )
946
+ elsif _response.status_code == 500
947
+ raise ApiErrorResponseException.new(
948
+ 'Something unexpected happened. Please try again.',
949
+ _response
950
+ )
951
+ end
952
+ validate_response(_response)
953
+
954
+ # Return appropriate response type.
955
+ ApiResponse.new(_response)
956
+ end
957
+
958
+ # Returns information about the conferences in the account
959
+ # @param [String] account_id Required parameter: Example:
960
+ # @param [Integer] page_size Optional parameter: Example:1000
961
+ # @param [String] page_token Optional parameter: Example:
962
+ # @param [String] name Optional parameter: Example:
963
+ # @param [String] min_created_time Optional parameter: Example:
964
+ # @param [String] max_created_time Optional parameter: Example:
965
+ # @return [List of ConferenceDetail] response from the API call
966
+ def get_conferences_by_account(account_id,
967
+ page_size: 1000,
968
+ page_token: nil,
969
+ name: nil,
970
+ min_created_time: nil,
971
+ max_created_time: nil)
972
+ # Prepare query url.
973
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
974
+ _query_builder << '/api/v2/accounts/{accountId}/conferences'
975
+ _query_builder = APIHelper.append_url_with_template_parameters(
976
+ _query_builder,
977
+ 'accountId' => { 'value' => account_id, 'encode' => true }
978
+ )
979
+ _query_builder = APIHelper.append_url_with_query_parameters(
980
+ _query_builder,
981
+ 'pageSize' => page_size,
982
+ 'pageToken' => page_token,
983
+ 'name' => name,
984
+ 'minCreatedTime' => min_created_time,
985
+ 'maxCreatedTime' => max_created_time
986
+ )
987
+ _query_url = APIHelper.clean_url _query_builder
988
+
989
+ # Prepare headers.
990
+ _headers = {
991
+ 'accept' => 'application/json'
992
+ }
993
+
994
+ # Prepare and execute HttpRequest.
995
+ _request = config.http_client.get(
996
+ _query_url,
997
+ headers: _headers
998
+ )
999
+ VoiceBasicAuth.apply(config, _request)
1000
+ _response = execute_request(_request)
1001
+
1002
+ # Validate response against endpoint and global error codes.
1003
+ if _response.status_code == 400
1004
+ raise ApiErrorResponseException.new(
1005
+ 'Something\'s not quite right... Your request is invalid. Please' \
1006
+ ' fix it before trying again.',
1007
+ _response
1008
+ )
1009
+ elsif _response.status_code == 401
1010
+ raise APIException.new(
1011
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1012
+ ' credentials to authenticate to the API.',
1013
+ _response
1014
+ )
1015
+ elsif _response.status_code == 403
1016
+ raise ApiErrorResponseException.new(
1017
+ 'User unauthorized to perform this action.',
1018
+ _response
1019
+ )
1020
+ elsif _response.status_code == 404
1021
+ raise ApiErrorResponseException.new(
1022
+ 'The resource specified cannot be found or does not belong to you.',
1023
+ _response
1024
+ )
1025
+ elsif _response.status_code == 415
1026
+ raise ApiErrorResponseException.new(
1027
+ 'We don\'t support that media type. If a request body is required,' \
1028
+ ' please send it to us as `application/json`.',
1029
+ _response
1030
+ )
1031
+ elsif _response.status_code == 429
1032
+ raise ApiErrorResponseException.new(
1033
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1034
+ ' slow your request rate down and try again.',
1035
+ _response
1036
+ )
1037
+ elsif _response.status_code == 500
1038
+ raise ApiErrorResponseException.new(
1039
+ 'Something unexpected happened. Please try again.',
1040
+ _response
1041
+ )
1042
+ end
1043
+ validate_response(_response)
1044
+
1045
+ # Return appropriate response type.
1046
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1047
+ ApiResponse.new(
1048
+ _response,
1049
+ data: decoded.map { |element| ConferenceDetail.from_hash(element) }
1050
+ )
1051
+ end
1052
+
1053
+ # Returns information about the specified conference
1054
+ # @param [String] account_id Required parameter: Example:
1055
+ # @param [String] conference_id Required parameter: Example:
1056
+ # @return [ConferenceDetail] response from the API call
1057
+ def get_conference_by_id(account_id,
1058
+ conference_id)
1059
+ # Prepare query url.
1060
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1061
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
1062
+ _query_builder = APIHelper.append_url_with_template_parameters(
1063
+ _query_builder,
1064
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1065
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
1066
+ )
1067
+ _query_url = APIHelper.clean_url _query_builder
1068
+
1069
+ # Prepare headers.
1070
+ _headers = {
1071
+ 'accept' => 'application/json'
1072
+ }
1073
+
1074
+ # Prepare and execute HttpRequest.
1075
+ _request = config.http_client.get(
1076
+ _query_url,
1077
+ headers: _headers
1078
+ )
1079
+ VoiceBasicAuth.apply(config, _request)
1080
+ _response = execute_request(_request)
1081
+
1082
+ # Validate response against endpoint and global error codes.
1083
+ if _response.status_code == 400
1084
+ raise ApiErrorResponseException.new(
1085
+ 'Something\'s not quite right... Your request is invalid. Please' \
1086
+ ' fix it before trying again.',
1087
+ _response
1088
+ )
1089
+ elsif _response.status_code == 401
1090
+ raise APIException.new(
1091
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1092
+ ' credentials to authenticate to the API.',
1093
+ _response
1094
+ )
1095
+ elsif _response.status_code == 403
1096
+ raise ApiErrorResponseException.new(
1097
+ 'User unauthorized to perform this action.',
1098
+ _response
1099
+ )
1100
+ elsif _response.status_code == 404
1101
+ raise ApiErrorResponseException.new(
1102
+ 'The resource specified cannot be found or does not belong to you.',
1103
+ _response
1104
+ )
1105
+ elsif _response.status_code == 415
1106
+ raise ApiErrorResponseException.new(
1107
+ 'We don\'t support that media type. If a request body is required,' \
1108
+ ' please send it to us as `application/json`.',
1109
+ _response
1110
+ )
1111
+ elsif _response.status_code == 429
1112
+ raise ApiErrorResponseException.new(
1113
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1114
+ ' slow your request rate down and try again.',
1115
+ _response
1116
+ )
1117
+ elsif _response.status_code == 500
1118
+ raise ApiErrorResponseException.new(
1119
+ 'Something unexpected happened. Please try again.',
1120
+ _response
1121
+ )
1122
+ end
1123
+ validate_response(_response)
1124
+
1125
+ # Return appropriate response type.
1126
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1127
+ ApiResponse.new(
1128
+ _response, data: ConferenceDetail.from_hash(decoded)
1129
+ )
1130
+ end
1131
+
1132
+ # Modify the conference state
1133
+ # @param [String] account_id Required parameter: Example:
1134
+ # @param [String] conference_id Required parameter: Example:
1135
+ # @param [CallEngineModifyConferenceRequest] body Optional parameter:
1136
+ # Example:
1137
+ # @return [void] response from the API call
1138
+ def modify_conference(account_id,
1139
+ conference_id,
1140
+ body: nil)
1141
+ # Prepare query url.
1142
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1143
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
1144
+ _query_builder = APIHelper.append_url_with_template_parameters(
1145
+ _query_builder,
1146
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1147
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
1148
+ )
1149
+ _query_url = APIHelper.clean_url _query_builder
1150
+
1151
+ # Prepare headers.
1152
+ _headers = {
1153
+ 'content-type' => 'application/json; charset=utf-8'
1154
+ }
1155
+
1156
+ # Prepare and execute HttpRequest.
1157
+ _request = config.http_client.post(
1158
+ _query_url,
1159
+ headers: _headers,
1160
+ parameters: body.to_json
1161
+ )
1162
+ VoiceBasicAuth.apply(config, _request)
1163
+ _response = execute_request(_request)
1164
+
1165
+ # Validate response against endpoint and global error codes.
1166
+ if _response.status_code == 400
1167
+ raise ApiErrorResponseException.new(
1168
+ 'Something\'s not quite right... Your request is invalid. Please' \
1169
+ ' fix it before trying again.',
934
1170
  _response
935
1171
  )
936
1172
  elsif _response.status_code == 401
937
1173
  raise APIException.new(
938
- 'Please authenticate yourself.',
1174
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1175
+ ' credentials to authenticate to the API.',
939
1176
  _response
940
1177
  )
941
1178
  elsif _response.status_code == 403
942
1179
  raise ApiErrorResponseException.new(
943
- 'Your credentials are invalid. Please use your API credentials for' \
944
- ' the Bandwidth Dashboard.',
1180
+ 'User unauthorized to perform this action.',
945
1181
  _response
946
1182
  )
947
1183
  elsif _response.status_code == 404
@@ -973,6 +1209,408 @@ module Voice
973
1209
  ApiResponse.new(_response)
974
1210
  end
975
1211
 
1212
+ # Updates settings for a particular conference member
1213
+ # @param [String] account_id Required parameter: Example:
1214
+ # @param [String] conference_id Required parameter: Example:
1215
+ # @param [String] call_id Required parameter: Example:
1216
+ # @param [ConferenceMemberDetail] body Optional parameter: Example:
1217
+ # @return [void] response from the API call
1218
+ def modify_conference_member(account_id,
1219
+ conference_id,
1220
+ call_id,
1221
+ body: nil)
1222
+ # Prepare query url.
1223
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1224
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
1225
+ _query_builder = APIHelper.append_url_with_template_parameters(
1226
+ _query_builder,
1227
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1228
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1229
+ 'callId' => { 'value' => call_id, 'encode' => true }
1230
+ )
1231
+ _query_url = APIHelper.clean_url _query_builder
1232
+
1233
+ # Prepare headers.
1234
+ _headers = {
1235
+ 'content-type' => 'application/json; charset=utf-8'
1236
+ }
1237
+
1238
+ # Prepare and execute HttpRequest.
1239
+ _request = config.http_client.put(
1240
+ _query_url,
1241
+ headers: _headers,
1242
+ parameters: body.to_json
1243
+ )
1244
+ VoiceBasicAuth.apply(config, _request)
1245
+ _response = execute_request(_request)
1246
+
1247
+ # Validate response against endpoint and global error codes.
1248
+ if _response.status_code == 400
1249
+ raise ApiErrorResponseException.new(
1250
+ 'Something\'s not quite right... Your request is invalid. Please' \
1251
+ ' fix it before trying again.',
1252
+ _response
1253
+ )
1254
+ elsif _response.status_code == 401
1255
+ raise APIException.new(
1256
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1257
+ ' credentials to authenticate to the API.',
1258
+ _response
1259
+ )
1260
+ elsif _response.status_code == 403
1261
+ raise ApiErrorResponseException.new(
1262
+ 'User unauthorized to perform this action.',
1263
+ _response
1264
+ )
1265
+ elsif _response.status_code == 404
1266
+ raise ApiErrorResponseException.new(
1267
+ 'The resource specified cannot be found or does not belong to you.',
1268
+ _response
1269
+ )
1270
+ elsif _response.status_code == 415
1271
+ raise ApiErrorResponseException.new(
1272
+ 'We don\'t support that media type. If a request body is required,' \
1273
+ ' please send it to us as `application/json`.',
1274
+ _response
1275
+ )
1276
+ elsif _response.status_code == 429
1277
+ raise ApiErrorResponseException.new(
1278
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1279
+ ' slow your request rate down and try again.',
1280
+ _response
1281
+ )
1282
+ elsif _response.status_code == 500
1283
+ raise ApiErrorResponseException.new(
1284
+ 'Something unexpected happened. Please try again.',
1285
+ _response
1286
+ )
1287
+ end
1288
+ validate_response(_response)
1289
+
1290
+ # Return appropriate response type.
1291
+ ApiResponse.new(_response)
1292
+ end
1293
+
1294
+ # Returns information about the specified conference member
1295
+ # @param [String] account_id Required parameter: Example:
1296
+ # @param [String] conference_id Required parameter: Example:
1297
+ # @param [String] member_id Required parameter: Example:
1298
+ # @return [ConferenceMemberDetail] response from the API call
1299
+ def get_conference_member(account_id,
1300
+ conference_id,
1301
+ member_id)
1302
+ # Prepare query url.
1303
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1304
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'
1305
+ _query_builder = APIHelper.append_url_with_template_parameters(
1306
+ _query_builder,
1307
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1308
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1309
+ 'memberId' => { 'value' => member_id, 'encode' => true }
1310
+ )
1311
+ _query_url = APIHelper.clean_url _query_builder
1312
+
1313
+ # Prepare headers.
1314
+ _headers = {
1315
+ 'accept' => 'application/json'
1316
+ }
1317
+
1318
+ # Prepare and execute HttpRequest.
1319
+ _request = config.http_client.get(
1320
+ _query_url,
1321
+ headers: _headers
1322
+ )
1323
+ VoiceBasicAuth.apply(config, _request)
1324
+ _response = execute_request(_request)
1325
+
1326
+ # Validate response against endpoint and global error codes.
1327
+ if _response.status_code == 400
1328
+ raise ApiErrorResponseException.new(
1329
+ 'Something\'s not quite right... Your request is invalid. Please' \
1330
+ ' fix it before trying again.',
1331
+ _response
1332
+ )
1333
+ elsif _response.status_code == 401
1334
+ raise APIException.new(
1335
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1336
+ ' credentials to authenticate to the API.',
1337
+ _response
1338
+ )
1339
+ elsif _response.status_code == 403
1340
+ raise ApiErrorResponseException.new(
1341
+ 'User unauthorized to perform this action.',
1342
+ _response
1343
+ )
1344
+ elsif _response.status_code == 404
1345
+ raise ApiErrorResponseException.new(
1346
+ 'The resource specified cannot be found or does not belong to you.',
1347
+ _response
1348
+ )
1349
+ elsif _response.status_code == 415
1350
+ raise ApiErrorResponseException.new(
1351
+ 'We don\'t support that media type. If a request body is required,' \
1352
+ ' please send it to us as `application/json`.',
1353
+ _response
1354
+ )
1355
+ elsif _response.status_code == 429
1356
+ raise ApiErrorResponseException.new(
1357
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1358
+ ' slow your request rate down and try again.',
1359
+ _response
1360
+ )
1361
+ elsif _response.status_code == 500
1362
+ raise ApiErrorResponseException.new(
1363
+ 'Something unexpected happened. Please try again.',
1364
+ _response
1365
+ )
1366
+ end
1367
+ validate_response(_response)
1368
+
1369
+ # Return appropriate response type.
1370
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1371
+ ApiResponse.new(
1372
+ _response, data: ConferenceMemberDetail.from_hash(decoded)
1373
+ )
1374
+ end
1375
+
1376
+ # Returns a (potentially empty) list of metadata for the recordings that
1377
+ # took place during the specified conference
1378
+ # @param [String] account_id Required parameter: Example:
1379
+ # @param [String] conference_id Required parameter: Example:
1380
+ # @return [List of ConferenceRecordingMetadataResponse] response from the API call
1381
+ def get_query_metadata_for_account_and_conference(account_id,
1382
+ conference_id)
1383
+ # Prepare query url.
1384
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1385
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
1386
+ _query_builder = APIHelper.append_url_with_template_parameters(
1387
+ _query_builder,
1388
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1389
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true }
1390
+ )
1391
+ _query_url = APIHelper.clean_url _query_builder
1392
+
1393
+ # Prepare headers.
1394
+ _headers = {
1395
+ 'accept' => 'application/json'
1396
+ }
1397
+
1398
+ # Prepare and execute HttpRequest.
1399
+ _request = config.http_client.get(
1400
+ _query_url,
1401
+ headers: _headers
1402
+ )
1403
+ VoiceBasicAuth.apply(config, _request)
1404
+ _response = execute_request(_request)
1405
+
1406
+ # Validate response against endpoint and global error codes.
1407
+ if _response.status_code == 400
1408
+ raise ApiErrorResponseException.new(
1409
+ 'Something\'s not quite right... Your request is invalid. Please' \
1410
+ ' fix it before trying again.',
1411
+ _response
1412
+ )
1413
+ elsif _response.status_code == 401
1414
+ raise APIException.new(
1415
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1416
+ ' credentials to authenticate to the API.',
1417
+ _response
1418
+ )
1419
+ elsif _response.status_code == 403
1420
+ raise ApiErrorResponseException.new(
1421
+ 'User unauthorized to perform this action.',
1422
+ _response
1423
+ )
1424
+ elsif _response.status_code == 404
1425
+ raise ApiErrorResponseException.new(
1426
+ 'The resource specified cannot be found or does not belong to you.',
1427
+ _response
1428
+ )
1429
+ elsif _response.status_code == 415
1430
+ raise ApiErrorResponseException.new(
1431
+ 'We don\'t support that media type. If a request body is required,' \
1432
+ ' please send it to us as `application/json`.',
1433
+ _response
1434
+ )
1435
+ elsif _response.status_code == 429
1436
+ raise ApiErrorResponseException.new(
1437
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1438
+ ' slow your request rate down and try again.',
1439
+ _response
1440
+ )
1441
+ elsif _response.status_code == 500
1442
+ raise ApiErrorResponseException.new(
1443
+ 'Something unexpected happened. Please try again.',
1444
+ _response
1445
+ )
1446
+ end
1447
+ validate_response(_response)
1448
+
1449
+ # Return appropriate response type.
1450
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1451
+ ApiResponse.new(
1452
+ _response,
1453
+ data: decoded.map { |element| ConferenceRecordingMetadataResponse.from_hash(element) }
1454
+ )
1455
+ end
1456
+
1457
+ # Returns metadata for the specified recording
1458
+ # @param [String] account_id Required parameter: Example:
1459
+ # @param [String] conference_id Required parameter: Example:
1460
+ # @param [String] recording_id Required parameter: Example:
1461
+ # @return [RecordingMetadataResponse] response from the API call
1462
+ def get_metadata_for_conference_recording(account_id,
1463
+ conference_id,
1464
+ recording_id)
1465
+ # Prepare query url.
1466
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1467
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
1468
+ _query_builder = APIHelper.append_url_with_template_parameters(
1469
+ _query_builder,
1470
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1471
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1472
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
1473
+ )
1474
+ _query_url = APIHelper.clean_url _query_builder
1475
+
1476
+ # Prepare headers.
1477
+ _headers = {
1478
+ 'accept' => 'application/json'
1479
+ }
1480
+
1481
+ # Prepare and execute HttpRequest.
1482
+ _request = config.http_client.get(
1483
+ _query_url,
1484
+ headers: _headers
1485
+ )
1486
+ VoiceBasicAuth.apply(config, _request)
1487
+ _response = execute_request(_request)
1488
+
1489
+ # Validate response against endpoint and global error codes.
1490
+ if _response.status_code == 400
1491
+ raise ApiErrorResponseException.new(
1492
+ 'Something\'s not quite right... Your request is invalid. Please' \
1493
+ ' fix it before trying again.',
1494
+ _response
1495
+ )
1496
+ elsif _response.status_code == 401
1497
+ raise APIException.new(
1498
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1499
+ ' credentials to authenticate to the API.',
1500
+ _response
1501
+ )
1502
+ elsif _response.status_code == 403
1503
+ raise ApiErrorResponseException.new(
1504
+ 'User unauthorized to perform this action.',
1505
+ _response
1506
+ )
1507
+ elsif _response.status_code == 404
1508
+ raise ApiErrorResponseException.new(
1509
+ 'The resource specified cannot be found or does not belong to you.',
1510
+ _response
1511
+ )
1512
+ elsif _response.status_code == 415
1513
+ raise ApiErrorResponseException.new(
1514
+ 'We don\'t support that media type. If a request body is required,' \
1515
+ ' please send it to us as `application/json`.',
1516
+ _response
1517
+ )
1518
+ elsif _response.status_code == 429
1519
+ raise ApiErrorResponseException.new(
1520
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1521
+ ' slow your request rate down and try again.',
1522
+ _response
1523
+ )
1524
+ elsif _response.status_code == 500
1525
+ raise ApiErrorResponseException.new(
1526
+ 'Something unexpected happened. Please try again.',
1527
+ _response
1528
+ )
1529
+ end
1530
+ validate_response(_response)
1531
+
1532
+ # Return appropriate response type.
1533
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1534
+ ApiResponse.new(
1535
+ _response, data: RecordingMetadataResponse.from_hash(decoded)
1536
+ )
1537
+ end
1538
+
1539
+ # Downloads the specified recording
1540
+ # @param [String] account_id Required parameter: Example:
1541
+ # @param [String] conference_id Required parameter: Example:
1542
+ # @param [String] recording_id Required parameter: Example:
1543
+ # @return [Binary] response from the API call
1544
+ def get_stream_conference_recording_media(account_id,
1545
+ conference_id,
1546
+ recording_id)
1547
+ # Prepare query url.
1548
+ _query_builder = config.get_base_uri(Server::VOICEDEFAULT)
1549
+ _query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
1550
+ _query_builder = APIHelper.append_url_with_template_parameters(
1551
+ _query_builder,
1552
+ 'accountId' => { 'value' => account_id, 'encode' => true },
1553
+ 'conferenceId' => { 'value' => conference_id, 'encode' => true },
1554
+ 'recordingId' => { 'value' => recording_id, 'encode' => true }
1555
+ )
1556
+ _query_url = APIHelper.clean_url _query_builder
1557
+
1558
+ # Prepare and execute HttpRequest.
1559
+ _request = config.http_client.get(
1560
+ _query_url
1561
+ )
1562
+ VoiceBasicAuth.apply(config, _request)
1563
+ _response = execute_request(_request, binary: true)
1564
+
1565
+ # Validate response against endpoint and global error codes.
1566
+ if _response.status_code == 400
1567
+ raise ApiErrorResponseException.new(
1568
+ 'Something\'s not quite right... Your request is invalid. Please' \
1569
+ ' fix it before trying again.',
1570
+ _response
1571
+ )
1572
+ elsif _response.status_code == 401
1573
+ raise APIException.new(
1574
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1575
+ ' credentials to authenticate to the API.',
1576
+ _response
1577
+ )
1578
+ elsif _response.status_code == 403
1579
+ raise ApiErrorResponseException.new(
1580
+ 'User unauthorized to perform this action.',
1581
+ _response
1582
+ )
1583
+ elsif _response.status_code == 404
1584
+ raise ApiErrorResponseException.new(
1585
+ 'The resource specified cannot be found or does not belong to you.',
1586
+ _response
1587
+ )
1588
+ elsif _response.status_code == 415
1589
+ raise ApiErrorResponseException.new(
1590
+ 'We don\'t support that media type. If a request body is required,' \
1591
+ ' please send it to us as `application/json`.',
1592
+ _response
1593
+ )
1594
+ elsif _response.status_code == 429
1595
+ raise ApiErrorResponseException.new(
1596
+ 'You\'re sending requests to this endpoint too frequently. Please' \
1597
+ ' slow your request rate down and try again.',
1598
+ _response
1599
+ )
1600
+ elsif _response.status_code == 500
1601
+ raise ApiErrorResponseException.new(
1602
+ 'Something unexpected happened. Please try again.',
1603
+ _response
1604
+ )
1605
+ end
1606
+ validate_response(_response)
1607
+
1608
+ # Return appropriate response type.
1609
+ ApiResponse.new(
1610
+ _response, data: _response.raw_body
1611
+ )
1612
+ end
1613
+
976
1614
  # Returns a list of metadata for the recordings associated with the
977
1615
  # specified account. The list can be filtered by the optional from, to,
978
1616
  # minStartTime, and maxStartTime arguments. The list is capped at 1000
@@ -993,7 +1631,7 @@ module Voice
993
1631
  _query_builder << '/api/v2/accounts/{accountId}/recordings'
994
1632
  _query_builder = APIHelper.append_url_with_template_parameters(
995
1633
  _query_builder,
996
- 'accountId' => account_id
1634
+ 'accountId' => { 'value' => account_id, 'encode' => true }
997
1635
  )
998
1636
  _query_builder = APIHelper.append_url_with_query_parameters(
999
1637
  _query_builder,
@@ -1020,20 +1658,19 @@ module Voice
1020
1658
  # Validate response against endpoint and global error codes.
1021
1659
  if _response.status_code == 400
1022
1660
  raise ApiErrorResponseException.new(
1023
- 'Something\'s not quite right... Either your request is invalid or' \
1024
- ' you\'re requesting it at a bad time. Please fix it' \
1025
- ' before trying again.',
1661
+ 'Something\'s not quite right... Your request is invalid. Please' \
1662
+ ' fix it before trying again.',
1026
1663
  _response
1027
1664
  )
1028
1665
  elsif _response.status_code == 401
1029
1666
  raise APIException.new(
1030
- 'Please authenticate yourself.',
1667
+ 'Your credentials are invalid. Please use your Bandwidth dashboard' \
1668
+ ' credentials to authenticate to the API.',
1031
1669
  _response
1032
1670
  )
1033
1671
  elsif _response.status_code == 403
1034
1672
  raise ApiErrorResponseException.new(
1035
- 'Your credentials are invalid. Please use your API credentials for' \
1036
- ' the Bandwidth Dashboard.',
1673
+ 'User unauthorized to perform this action.',
1037
1674
  _response
1038
1675
  )
1039
1676
  elsif _response.status_code == 404