bandwidth-sdk 3.8.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/bandwidth/client.rb +2 -0
- data/lib/bandwidth/configuration.rb +23 -4
- data/lib/bandwidth/http/api_response.rb +2 -0
- data/lib/bandwidth/http/faraday_client.rb +9 -2
- data/lib/bandwidth/messaging_lib/messaging/client.rb +2 -0
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +8 -8
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +2 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +3 -3
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +0 -19
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +7 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/sip_uri.rb +25 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/tag.rb +13 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +14 -3
- data/lib/bandwidth/voice_lib/voice/client.rb +2 -0
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +455 -56
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +117 -12
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
- data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +107 -0
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
- data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +74 -2
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +7 -4
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +32 -4
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +4 -1
- data/lib/bandwidth/voice_lib/voice/models/{status2_enum.rb → status3_enum.rb} +3 -3
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
- data/lib/bandwidth/voice_lib/voice.rb +5 -2
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +2 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +24 -24
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +1 -1
- data/lib/bandwidth.rb +24 -1
- metadata +35 -13
@@ -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' => { 'value' => account_id, 'encode' =>
|
25
|
+
'accountId' => { 'value' => account_id, 'encode' => false }
|
26
26
|
)
|
27
27
|
_query_url = APIHelper.clean_url _query_builder
|
28
28
|
|
@@ -102,8 +102,8 @@ module Voice
|
|
102
102
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
103
103
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
104
104
|
_query_builder,
|
105
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
106
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
105
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
106
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
107
107
|
)
|
108
108
|
_query_url = APIHelper.clean_url _query_builder
|
109
109
|
|
@@ -183,8 +183,8 @@ module Voice
|
|
183
183
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
184
184
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
185
185
|
_query_builder,
|
186
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
187
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
186
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
187
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
188
188
|
)
|
189
189
|
_query_url = APIHelper.clean_url _query_builder
|
190
190
|
|
@@ -262,8 +262,8 @@ module Voice
|
|
262
262
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
|
263
263
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
264
264
|
_query_builder,
|
265
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
266
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
265
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
266
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
267
267
|
)
|
268
268
|
_query_url = APIHelper.clean_url _query_builder
|
269
269
|
|
@@ -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' => { 'value' => account_id, 'encode' =>
|
352
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
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' => false },
|
344
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
360
345
|
)
|
361
346
|
_query_url = APIHelper.clean_url _query_builder
|
362
347
|
|
@@ -437,9 +422,9 @@ module Voice
|
|
437
422
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
438
423
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
439
424
|
_query_builder,
|
440
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
441
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
442
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
425
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
426
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
427
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
443
428
|
)
|
444
429
|
_query_url = APIHelper.clean_url _query_builder
|
445
430
|
|
@@ -519,9 +504,9 @@ module Voice
|
|
519
504
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
520
505
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
521
506
|
_query_builder,
|
522
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
523
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
524
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
507
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
508
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
509
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
525
510
|
)
|
526
511
|
_query_url = APIHelper.clean_url _query_builder
|
527
512
|
|
@@ -592,9 +577,9 @@ module Voice
|
|
592
577
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
593
578
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
594
579
|
_query_builder,
|
595
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
596
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
597
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
580
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
581
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
582
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
598
583
|
)
|
599
584
|
_query_url = APIHelper.clean_url _query_builder
|
600
585
|
|
@@ -667,9 +652,9 @@ module Voice
|
|
667
652
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
668
653
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
669
654
|
_query_builder,
|
670
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
671
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
672
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
655
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
656
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
657
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
673
658
|
)
|
674
659
|
_query_url = APIHelper.clean_url _query_builder
|
675
660
|
|
@@ -740,9 +725,9 @@ module Voice
|
|
740
725
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
741
726
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
742
727
|
_query_builder,
|
743
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
744
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
745
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
728
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
729
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
730
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
746
731
|
)
|
747
732
|
_query_url = APIHelper.clean_url _query_builder
|
748
733
|
|
@@ -824,9 +809,9 @@ module Voice
|
|
824
809
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
825
810
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
826
811
|
_query_builder,
|
827
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
828
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
829
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
812
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
813
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
814
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
830
815
|
)
|
831
816
|
_query_url = APIHelper.clean_url _query_builder
|
832
817
|
|
@@ -910,9 +895,9 @@ module Voice
|
|
910
895
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
911
896
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
912
897
|
_query_builder,
|
913
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
914
|
-
'callId' => { 'value' => call_id, 'encode' =>
|
915
|
-
'recordingId' => { 'value' => recording_id, 'encode' =>
|
898
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
899
|
+
'callId' => { 'value' => call_id, 'encode' => false },
|
900
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
916
901
|
)
|
917
902
|
_query_url = APIHelper.clean_url _query_builder
|
918
903
|
|
@@ -970,6 +955,101 @@ module Voice
|
|
970
955
|
ApiResponse.new(_response)
|
971
956
|
end
|
972
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' => false }
|
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
|
+
|
973
1053
|
# Returns information about the specified conference
|
974
1054
|
# @param [String] account_id Required parameter: Example:
|
975
1055
|
# @param [String] conference_id Required parameter: Example:
|
@@ -981,8 +1061,8 @@ module Voice
|
|
981
1061
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
982
1062
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
983
1063
|
_query_builder,
|
984
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
985
|
-
'conferenceId' => { 'value' => conference_id, 'encode' =>
|
1064
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1065
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false }
|
986
1066
|
)
|
987
1067
|
_query_url = APIHelper.clean_url _query_builder
|
988
1068
|
|
@@ -1052,8 +1132,7 @@ module Voice
|
|
1052
1132
|
# Modify the conference state
|
1053
1133
|
# @param [String] account_id Required parameter: Example:
|
1054
1134
|
# @param [String] conference_id Required parameter: Example:
|
1055
|
-
# @param [
|
1056
|
-
# Example:
|
1135
|
+
# @param [ApiModifyConferenceRequest] body Optional parameter: Example:
|
1057
1136
|
# @return [void] response from the API call
|
1058
1137
|
def modify_conference(account_id,
|
1059
1138
|
conference_id,
|
@@ -1063,8 +1142,8 @@ module Voice
|
|
1063
1142
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
1064
1143
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
1065
1144
|
_query_builder,
|
1066
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
1067
|
-
'conferenceId' => { 'value' => conference_id, 'encode' =>
|
1145
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1146
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false }
|
1068
1147
|
)
|
1069
1148
|
_query_url = APIHelper.clean_url _query_builder
|
1070
1149
|
|
@@ -1129,6 +1208,88 @@ module Voice
|
|
1129
1208
|
ApiResponse.new(_response)
|
1130
1209
|
end
|
1131
1210
|
|
1211
|
+
# Updates settings for a particular conference member
|
1212
|
+
# @param [String] account_id Required parameter: Example:
|
1213
|
+
# @param [String] conference_id Required parameter: Example:
|
1214
|
+
# @param [String] call_id Required parameter: Example:
|
1215
|
+
# @param [ConferenceMemberDetail] body Optional parameter: Example:
|
1216
|
+
# @return [void] response from the API call
|
1217
|
+
def modify_conference_member(account_id,
|
1218
|
+
conference_id,
|
1219
|
+
call_id,
|
1220
|
+
body: nil)
|
1221
|
+
# Prepare query url.
|
1222
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1223
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
|
1224
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1225
|
+
_query_builder,
|
1226
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1227
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false },
|
1228
|
+
'callId' => { 'value' => call_id, 'encode' => false }
|
1229
|
+
)
|
1230
|
+
_query_url = APIHelper.clean_url _query_builder
|
1231
|
+
|
1232
|
+
# Prepare headers.
|
1233
|
+
_headers = {
|
1234
|
+
'content-type' => 'application/json; charset=utf-8'
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
# Prepare and execute HttpRequest.
|
1238
|
+
_request = config.http_client.put(
|
1239
|
+
_query_url,
|
1240
|
+
headers: _headers,
|
1241
|
+
parameters: body.to_json
|
1242
|
+
)
|
1243
|
+
VoiceBasicAuth.apply(config, _request)
|
1244
|
+
_response = execute_request(_request)
|
1245
|
+
|
1246
|
+
# Validate response against endpoint and global error codes.
|
1247
|
+
if _response.status_code == 400
|
1248
|
+
raise ApiErrorResponseException.new(
|
1249
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1250
|
+
' fix it before trying again.',
|
1251
|
+
_response
|
1252
|
+
)
|
1253
|
+
elsif _response.status_code == 401
|
1254
|
+
raise APIException.new(
|
1255
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1256
|
+
' credentials to authenticate to the API.',
|
1257
|
+
_response
|
1258
|
+
)
|
1259
|
+
elsif _response.status_code == 403
|
1260
|
+
raise ApiErrorResponseException.new(
|
1261
|
+
'User unauthorized to perform this action.',
|
1262
|
+
_response
|
1263
|
+
)
|
1264
|
+
elsif _response.status_code == 404
|
1265
|
+
raise ApiErrorResponseException.new(
|
1266
|
+
'The resource specified cannot be found or does not belong to you.',
|
1267
|
+
_response
|
1268
|
+
)
|
1269
|
+
elsif _response.status_code == 415
|
1270
|
+
raise ApiErrorResponseException.new(
|
1271
|
+
'We don\'t support that media type. If a request body is required,' \
|
1272
|
+
' please send it to us as `application/json`.',
|
1273
|
+
_response
|
1274
|
+
)
|
1275
|
+
elsif _response.status_code == 429
|
1276
|
+
raise ApiErrorResponseException.new(
|
1277
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1278
|
+
' slow your request rate down and try again.',
|
1279
|
+
_response
|
1280
|
+
)
|
1281
|
+
elsif _response.status_code == 500
|
1282
|
+
raise ApiErrorResponseException.new(
|
1283
|
+
'Something unexpected happened. Please try again.',
|
1284
|
+
_response
|
1285
|
+
)
|
1286
|
+
end
|
1287
|
+
validate_response(_response)
|
1288
|
+
|
1289
|
+
# Return appropriate response type.
|
1290
|
+
ApiResponse.new(_response)
|
1291
|
+
end
|
1292
|
+
|
1132
1293
|
# Returns information about the specified conference member
|
1133
1294
|
# @param [String] account_id Required parameter: Example:
|
1134
1295
|
# @param [String] conference_id Required parameter: Example:
|
@@ -1142,9 +1303,9 @@ module Voice
|
|
1142
1303
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'
|
1143
1304
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
1144
1305
|
_query_builder,
|
1145
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
1146
|
-
'conferenceId' => { 'value' => conference_id, 'encode' =>
|
1147
|
-
'memberId' => { 'value' => member_id, 'encode' =>
|
1306
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1307
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false },
|
1308
|
+
'memberId' => { 'value' => member_id, 'encode' => false }
|
1148
1309
|
)
|
1149
1310
|
_query_url = APIHelper.clean_url _query_builder
|
1150
1311
|
|
@@ -1211,6 +1372,244 @@ module Voice
|
|
1211
1372
|
)
|
1212
1373
|
end
|
1213
1374
|
|
1375
|
+
# Returns a (potentially empty) list of metadata for the recordings that
|
1376
|
+
# took place during the specified conference
|
1377
|
+
# @param [String] account_id Required parameter: Example:
|
1378
|
+
# @param [String] conference_id Required parameter: Example:
|
1379
|
+
# @return [List of ConferenceRecordingMetadataResponse] response from the API call
|
1380
|
+
def get_query_metadata_for_account_and_conference(account_id,
|
1381
|
+
conference_id)
|
1382
|
+
# Prepare query url.
|
1383
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1384
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
|
1385
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1386
|
+
_query_builder,
|
1387
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1388
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false }
|
1389
|
+
)
|
1390
|
+
_query_url = APIHelper.clean_url _query_builder
|
1391
|
+
|
1392
|
+
# Prepare headers.
|
1393
|
+
_headers = {
|
1394
|
+
'accept' => 'application/json'
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
# Prepare and execute HttpRequest.
|
1398
|
+
_request = config.http_client.get(
|
1399
|
+
_query_url,
|
1400
|
+
headers: _headers
|
1401
|
+
)
|
1402
|
+
VoiceBasicAuth.apply(config, _request)
|
1403
|
+
_response = execute_request(_request)
|
1404
|
+
|
1405
|
+
# Validate response against endpoint and global error codes.
|
1406
|
+
if _response.status_code == 400
|
1407
|
+
raise ApiErrorResponseException.new(
|
1408
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1409
|
+
' fix it before trying again.',
|
1410
|
+
_response
|
1411
|
+
)
|
1412
|
+
elsif _response.status_code == 401
|
1413
|
+
raise APIException.new(
|
1414
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1415
|
+
' credentials to authenticate to the API.',
|
1416
|
+
_response
|
1417
|
+
)
|
1418
|
+
elsif _response.status_code == 403
|
1419
|
+
raise ApiErrorResponseException.new(
|
1420
|
+
'User unauthorized to perform this action.',
|
1421
|
+
_response
|
1422
|
+
)
|
1423
|
+
elsif _response.status_code == 404
|
1424
|
+
raise ApiErrorResponseException.new(
|
1425
|
+
'The resource specified cannot be found or does not belong to you.',
|
1426
|
+
_response
|
1427
|
+
)
|
1428
|
+
elsif _response.status_code == 415
|
1429
|
+
raise ApiErrorResponseException.new(
|
1430
|
+
'We don\'t support that media type. If a request body is required,' \
|
1431
|
+
' please send it to us as `application/json`.',
|
1432
|
+
_response
|
1433
|
+
)
|
1434
|
+
elsif _response.status_code == 429
|
1435
|
+
raise ApiErrorResponseException.new(
|
1436
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1437
|
+
' slow your request rate down and try again.',
|
1438
|
+
_response
|
1439
|
+
)
|
1440
|
+
elsif _response.status_code == 500
|
1441
|
+
raise ApiErrorResponseException.new(
|
1442
|
+
'Something unexpected happened. Please try again.',
|
1443
|
+
_response
|
1444
|
+
)
|
1445
|
+
end
|
1446
|
+
validate_response(_response)
|
1447
|
+
|
1448
|
+
# Return appropriate response type.
|
1449
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1450
|
+
ApiResponse.new(
|
1451
|
+
_response,
|
1452
|
+
data: decoded.map { |element| ConferenceRecordingMetadataResponse.from_hash(element) }
|
1453
|
+
)
|
1454
|
+
end
|
1455
|
+
|
1456
|
+
# Returns metadata for the specified recording
|
1457
|
+
# @param [String] account_id Required parameter: Example:
|
1458
|
+
# @param [String] conference_id Required parameter: Example:
|
1459
|
+
# @param [String] recording_id Required parameter: Example:
|
1460
|
+
# @return [RecordingMetadataResponse] response from the API call
|
1461
|
+
def get_metadata_for_conference_recording(account_id,
|
1462
|
+
conference_id,
|
1463
|
+
recording_id)
|
1464
|
+
# Prepare query url.
|
1465
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1466
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
|
1467
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1468
|
+
_query_builder,
|
1469
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1470
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false },
|
1471
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
1472
|
+
)
|
1473
|
+
_query_url = APIHelper.clean_url _query_builder
|
1474
|
+
|
1475
|
+
# Prepare headers.
|
1476
|
+
_headers = {
|
1477
|
+
'accept' => 'application/json'
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
# Prepare and execute HttpRequest.
|
1481
|
+
_request = config.http_client.get(
|
1482
|
+
_query_url,
|
1483
|
+
headers: _headers
|
1484
|
+
)
|
1485
|
+
VoiceBasicAuth.apply(config, _request)
|
1486
|
+
_response = execute_request(_request)
|
1487
|
+
|
1488
|
+
# Validate response against endpoint and global error codes.
|
1489
|
+
if _response.status_code == 400
|
1490
|
+
raise ApiErrorResponseException.new(
|
1491
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1492
|
+
' fix it before trying again.',
|
1493
|
+
_response
|
1494
|
+
)
|
1495
|
+
elsif _response.status_code == 401
|
1496
|
+
raise APIException.new(
|
1497
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1498
|
+
' credentials to authenticate to the API.',
|
1499
|
+
_response
|
1500
|
+
)
|
1501
|
+
elsif _response.status_code == 403
|
1502
|
+
raise ApiErrorResponseException.new(
|
1503
|
+
'User unauthorized to perform this action.',
|
1504
|
+
_response
|
1505
|
+
)
|
1506
|
+
elsif _response.status_code == 404
|
1507
|
+
raise ApiErrorResponseException.new(
|
1508
|
+
'The resource specified cannot be found or does not belong to you.',
|
1509
|
+
_response
|
1510
|
+
)
|
1511
|
+
elsif _response.status_code == 415
|
1512
|
+
raise ApiErrorResponseException.new(
|
1513
|
+
'We don\'t support that media type. If a request body is required,' \
|
1514
|
+
' please send it to us as `application/json`.',
|
1515
|
+
_response
|
1516
|
+
)
|
1517
|
+
elsif _response.status_code == 429
|
1518
|
+
raise ApiErrorResponseException.new(
|
1519
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1520
|
+
' slow your request rate down and try again.',
|
1521
|
+
_response
|
1522
|
+
)
|
1523
|
+
elsif _response.status_code == 500
|
1524
|
+
raise ApiErrorResponseException.new(
|
1525
|
+
'Something unexpected happened. Please try again.',
|
1526
|
+
_response
|
1527
|
+
)
|
1528
|
+
end
|
1529
|
+
validate_response(_response)
|
1530
|
+
|
1531
|
+
# Return appropriate response type.
|
1532
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1533
|
+
ApiResponse.new(
|
1534
|
+
_response, data: RecordingMetadataResponse.from_hash(decoded)
|
1535
|
+
)
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
# Downloads the specified recording
|
1539
|
+
# @param [String] account_id Required parameter: Example:
|
1540
|
+
# @param [String] conference_id Required parameter: Example:
|
1541
|
+
# @param [String] recording_id Required parameter: Example:
|
1542
|
+
# @return [Binary] response from the API call
|
1543
|
+
def get_stream_conference_recording_media(account_id,
|
1544
|
+
conference_id,
|
1545
|
+
recording_id)
|
1546
|
+
# Prepare query url.
|
1547
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1548
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
|
1549
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1550
|
+
_query_builder,
|
1551
|
+
'accountId' => { 'value' => account_id, 'encode' => false },
|
1552
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => false },
|
1553
|
+
'recordingId' => { 'value' => recording_id, 'encode' => false }
|
1554
|
+
)
|
1555
|
+
_query_url = APIHelper.clean_url _query_builder
|
1556
|
+
|
1557
|
+
# Prepare and execute HttpRequest.
|
1558
|
+
_request = config.http_client.get(
|
1559
|
+
_query_url
|
1560
|
+
)
|
1561
|
+
VoiceBasicAuth.apply(config, _request)
|
1562
|
+
_response = execute_request(_request, binary: true)
|
1563
|
+
|
1564
|
+
# Validate response against endpoint and global error codes.
|
1565
|
+
if _response.status_code == 400
|
1566
|
+
raise ApiErrorResponseException.new(
|
1567
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1568
|
+
' fix it before trying again.',
|
1569
|
+
_response
|
1570
|
+
)
|
1571
|
+
elsif _response.status_code == 401
|
1572
|
+
raise APIException.new(
|
1573
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1574
|
+
' credentials to authenticate to the API.',
|
1575
|
+
_response
|
1576
|
+
)
|
1577
|
+
elsif _response.status_code == 403
|
1578
|
+
raise ApiErrorResponseException.new(
|
1579
|
+
'User unauthorized to perform this action.',
|
1580
|
+
_response
|
1581
|
+
)
|
1582
|
+
elsif _response.status_code == 404
|
1583
|
+
raise ApiErrorResponseException.new(
|
1584
|
+
'The resource specified cannot be found or does not belong to you.',
|
1585
|
+
_response
|
1586
|
+
)
|
1587
|
+
elsif _response.status_code == 415
|
1588
|
+
raise ApiErrorResponseException.new(
|
1589
|
+
'We don\'t support that media type. If a request body is required,' \
|
1590
|
+
' please send it to us as `application/json`.',
|
1591
|
+
_response
|
1592
|
+
)
|
1593
|
+
elsif _response.status_code == 429
|
1594
|
+
raise ApiErrorResponseException.new(
|
1595
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1596
|
+
' slow your request rate down and try again.',
|
1597
|
+
_response
|
1598
|
+
)
|
1599
|
+
elsif _response.status_code == 500
|
1600
|
+
raise ApiErrorResponseException.new(
|
1601
|
+
'Something unexpected happened. Please try again.',
|
1602
|
+
_response
|
1603
|
+
)
|
1604
|
+
end
|
1605
|
+
validate_response(_response)
|
1606
|
+
|
1607
|
+
# Return appropriate response type.
|
1608
|
+
ApiResponse.new(
|
1609
|
+
_response, data: _response.raw_body
|
1610
|
+
)
|
1611
|
+
end
|
1612
|
+
|
1214
1613
|
# Returns a list of metadata for the recordings associated with the
|
1215
1614
|
# specified account. The list can be filtered by the optional from, to,
|
1216
1615
|
# minStartTime, and maxStartTime arguments. The list is capped at 1000
|
@@ -1231,7 +1630,7 @@ module Voice
|
|
1231
1630
|
_query_builder << '/api/v2/accounts/{accountId}/recordings'
|
1232
1631
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
1233
1632
|
_query_builder,
|
1234
|
-
'accountId' => { 'value' => account_id, 'encode' =>
|
1633
|
+
'accountId' => { 'value' => account_id, 'encode' => false }
|
1235
1634
|
)
|
1236
1635
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
1237
1636
|
_query_builder,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# AnswerFallbackMethod.
|
8
|
+
class AnswerFallbackMethodEnum
|
9
|
+
ANSWER_FALLBACK_METHOD_ENUM = [
|
10
|
+
# TODO: Write general description for POST
|
11
|
+
POST = 'POST'.freeze,
|
12
|
+
|
13
|
+
# TODO: Write general description for GET
|
14
|
+
GET = 'GET'.freeze
|
15
|
+
].freeze
|
16
|
+
end
|
17
|
+
end
|