bandwidth-sdk 6.2.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 -29
- data/lib/bandwidth/client.rb +8 -8
- data/lib/bandwidth/configuration.rb +20 -32
- data/lib/bandwidth/http/auth/{two_factor_auth_basic_auth.rb → multi_factor_auth_basic_auth.rb} +3 -3
- data/lib/bandwidth/http/faraday_client.rb +1 -1
- data/lib/bandwidth/messaging_lib/messaging/client.rb +14 -5
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +78 -71
- 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 +102 -24
- 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 +27 -80
- 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 +30 -8
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/client.rb +15 -6
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/mfa_controller.rb +28 -23
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/error_with_request_exception.rb +5 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/forbidden_request_exception.rb +4 -1
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/unauthorized_request_exception.rb +4 -1
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_code_request_schema.rb +27 -12
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_messaging_response.rb +17 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_code_response.rb +17 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_request_schema.rb +29 -10
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_voice_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +23 -0
- 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 +156 -0
- data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
- data/lib/bandwidth/voice_lib/voice/client.rb +14 -5
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +418 -379
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/voice_lib/voice/exceptions/{api_error_response_exception.rb → api_error_exception.rb} +8 -5
- data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
- data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +250 -0
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +284 -0
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +2 -20
- data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +2 -20
- data/lib/bandwidth/voice_lib/voice/models/{conference_member_detail.rb → conference_member_state.rb} +43 -20
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +173 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +153 -0
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +301 -0
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +256 -0
- 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_state.rb → modify_call_recording_request.rb} +19 -6
- data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +156 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +144 -0
- data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +7 -4
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +4 -7
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +108 -0
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +35 -17
- data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +89 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
- data/lib/bandwidth/voice_lib/voice.rb +20 -18
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +7 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +4 -4
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +75 -64
- 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 +20 -18
- data/test/integration/test_integration.rb +92 -57
- metadata +35 -31
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +0 -22
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +0 -207
- data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +0 -164
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +0 -248
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +0 -116
- data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +0 -107
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +0 -80
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +0 -108
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +0 -126
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +0 -47
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +0 -190
- data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +0 -29
- data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +0 -32
|
@@ -11,12 +11,12 @@ 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
|
-
# @param [
|
|
17
|
-
# @return [
|
|
16
|
+
# @param [CreateCallRequest] body Required parameter: Example:
|
|
17
|
+
# @return [CreateCallResponse] response from the API call
|
|
18
18
|
def create_call(account_id,
|
|
19
|
-
body
|
|
19
|
+
body)
|
|
20
20
|
# Prepare query url.
|
|
21
21
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
22
22
|
_query_builder << '/api/v2/accounts/{accountId}/calls'
|
|
@@ -42,42 +42,43 @@ module Voice
|
|
|
42
42
|
_response = execute_request(_request)
|
|
43
43
|
|
|
44
44
|
# Validate response against endpoint and global error codes.
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
case _response.status_code
|
|
46
|
+
when 400
|
|
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
|
-
raise
|
|
58
|
+
when 403
|
|
59
|
+
raise ApiErrorException.new(
|
|
59
60
|
'User unauthorized to perform this action.',
|
|
60
61
|
_response
|
|
61
62
|
)
|
|
62
|
-
|
|
63
|
-
raise
|
|
63
|
+
when 404
|
|
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
|
-
raise
|
|
68
|
+
when 415
|
|
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
|
-
raise
|
|
74
|
+
when 429
|
|
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
|
-
raise
|
|
80
|
+
when 500
|
|
81
|
+
raise ApiErrorException.new(
|
|
81
82
|
'Something unexpected happened. Please try again.',
|
|
82
83
|
_response
|
|
83
84
|
)
|
|
@@ -87,16 +88,16 @@ module Voice
|
|
|
87
88
|
# Return appropriate response type.
|
|
88
89
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
89
90
|
ApiResponse.new(
|
|
90
|
-
_response, data:
|
|
91
|
+
_response, data: CreateCallResponse.from_hash(decoded)
|
|
91
92
|
)
|
|
92
93
|
end
|
|
93
94
|
|
|
94
|
-
# Returns near-realtime metadata about the specified call
|
|
95
|
+
# Returns near-realtime metadata about the specified call.
|
|
95
96
|
# @param [String] account_id Required parameter: Example:
|
|
96
97
|
# @param [String] call_id Required parameter: Example:
|
|
97
|
-
# @return [
|
|
98
|
-
def
|
|
99
|
-
|
|
98
|
+
# @return [CallState] response from the API call
|
|
99
|
+
def get_call(account_id,
|
|
100
|
+
call_id)
|
|
100
101
|
# Prepare query url.
|
|
101
102
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
102
103
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
|
@@ -121,42 +122,43 @@ module Voice
|
|
|
121
122
|
_response = execute_request(_request)
|
|
122
123
|
|
|
123
124
|
# Validate response against endpoint and global error codes.
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
case _response.status_code
|
|
126
|
+
when 400
|
|
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
|
-
|
|
137
|
-
raise
|
|
138
|
+
when 403
|
|
139
|
+
raise ApiErrorException.new(
|
|
138
140
|
'User unauthorized to perform this action.',
|
|
139
141
|
_response
|
|
140
142
|
)
|
|
141
|
-
|
|
142
|
-
raise
|
|
143
|
+
when 404
|
|
144
|
+
raise ApiErrorException.new(
|
|
143
145
|
'The resource specified cannot be found or does not belong to you.',
|
|
144
146
|
_response
|
|
145
147
|
)
|
|
146
|
-
|
|
147
|
-
raise
|
|
148
|
+
when 415
|
|
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
|
-
|
|
153
|
-
raise
|
|
154
|
+
when 429
|
|
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
|
-
|
|
159
|
-
raise
|
|
160
|
+
when 500
|
|
161
|
+
raise ApiErrorException.new(
|
|
160
162
|
'Something unexpected happened. Please try again.',
|
|
161
163
|
_response
|
|
162
164
|
)
|
|
@@ -166,18 +168,18 @@ module Voice
|
|
|
166
168
|
# Return appropriate response type.
|
|
167
169
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
168
170
|
ApiResponse.new(
|
|
169
|
-
_response, data:
|
|
171
|
+
_response, data: CallState.from_hash(decoded)
|
|
170
172
|
)
|
|
171
173
|
end
|
|
172
174
|
|
|
173
|
-
# Interrupts and replaces an active call's BXML document
|
|
175
|
+
# Interrupts and replaces an active call's BXML document.
|
|
174
176
|
# @param [String] account_id Required parameter: Example:
|
|
175
177
|
# @param [String] call_id Required parameter: Example:
|
|
176
|
-
# @param [
|
|
178
|
+
# @param [ModifyCallRequest] body Required parameter: Example:
|
|
177
179
|
# @return [void] response from the API call
|
|
178
180
|
def modify_call(account_id,
|
|
179
181
|
call_id,
|
|
180
|
-
body
|
|
182
|
+
body)
|
|
181
183
|
# Prepare query url.
|
|
182
184
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
183
185
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
|
@@ -203,42 +205,43 @@ module Voice
|
|
|
203
205
|
_response = execute_request(_request)
|
|
204
206
|
|
|
205
207
|
# Validate response against endpoint and global error codes.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
case _response.status_code
|
|
209
|
+
when 400
|
|
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
|
-
|
|
219
|
-
raise
|
|
221
|
+
when 403
|
|
222
|
+
raise ApiErrorException.new(
|
|
220
223
|
'User unauthorized to perform this action.',
|
|
221
224
|
_response
|
|
222
225
|
)
|
|
223
|
-
|
|
224
|
-
raise
|
|
226
|
+
when 404
|
|
227
|
+
raise ApiErrorException.new(
|
|
225
228
|
'The resource specified cannot be found or does not belong to you.',
|
|
226
229
|
_response
|
|
227
230
|
)
|
|
228
|
-
|
|
229
|
-
raise
|
|
231
|
+
when 415
|
|
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
|
-
|
|
235
|
-
raise
|
|
237
|
+
when 429
|
|
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
|
-
|
|
241
|
-
raise
|
|
243
|
+
when 500
|
|
244
|
+
raise ApiErrorException.new(
|
|
242
245
|
'Something unexpected happened. Please try again.',
|
|
243
246
|
_response
|
|
244
247
|
)
|
|
@@ -249,14 +252,14 @@ module Voice
|
|
|
249
252
|
ApiResponse.new(_response)
|
|
250
253
|
end
|
|
251
254
|
|
|
252
|
-
# Pauses or resumes a recording
|
|
255
|
+
# Pauses or resumes a recording.
|
|
253
256
|
# @param [String] account_id Required parameter: Example:
|
|
254
257
|
# @param [String] call_id Required parameter: Example:
|
|
255
|
-
# @param [
|
|
258
|
+
# @param [ModifyCallRecordingRequest] body Required parameter: Example:
|
|
256
259
|
# @return [void] response from the API call
|
|
257
260
|
def modify_call_recording_state(account_id,
|
|
258
261
|
call_id,
|
|
259
|
-
body
|
|
262
|
+
body)
|
|
260
263
|
# Prepare query url.
|
|
261
264
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
262
265
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
|
|
@@ -282,42 +285,43 @@ module Voice
|
|
|
282
285
|
_response = execute_request(_request)
|
|
283
286
|
|
|
284
287
|
# Validate response against endpoint and global error codes.
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
case _response.status_code
|
|
289
|
+
when 400
|
|
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
|
-
|
|
298
|
-
raise
|
|
301
|
+
when 403
|
|
302
|
+
raise ApiErrorException.new(
|
|
299
303
|
'User unauthorized to perform this action.',
|
|
300
304
|
_response
|
|
301
305
|
)
|
|
302
|
-
|
|
303
|
-
raise
|
|
306
|
+
when 404
|
|
307
|
+
raise ApiErrorException.new(
|
|
304
308
|
'The resource specified cannot be found or does not belong to you.',
|
|
305
309
|
_response
|
|
306
310
|
)
|
|
307
|
-
|
|
308
|
-
raise
|
|
311
|
+
when 415
|
|
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
|
-
|
|
314
|
-
raise
|
|
317
|
+
when 429
|
|
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
|
-
|
|
320
|
-
raise
|
|
323
|
+
when 500
|
|
324
|
+
raise ApiErrorException.new(
|
|
321
325
|
'Something unexpected happened. Please try again.',
|
|
322
326
|
_response
|
|
323
327
|
)
|
|
@@ -329,12 +333,12 @@ 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
|
-
# @return [List of
|
|
336
|
-
def
|
|
337
|
-
|
|
339
|
+
# @return [List of CallRecordingMetadata] response from the API call
|
|
340
|
+
def get_call_recordings(account_id,
|
|
341
|
+
call_id)
|
|
338
342
|
# Prepare query url.
|
|
339
343
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
340
344
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
|
|
@@ -359,42 +363,43 @@ module Voice
|
|
|
359
363
|
_response = execute_request(_request)
|
|
360
364
|
|
|
361
365
|
# Validate response against endpoint and global error codes.
|
|
362
|
-
|
|
363
|
-
|
|
366
|
+
case _response.status_code
|
|
367
|
+
when 400
|
|
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
|
-
|
|
375
|
-
raise
|
|
379
|
+
when 403
|
|
380
|
+
raise ApiErrorException.new(
|
|
376
381
|
'User unauthorized to perform this action.',
|
|
377
382
|
_response
|
|
378
383
|
)
|
|
379
|
-
|
|
380
|
-
raise
|
|
384
|
+
when 404
|
|
385
|
+
raise ApiErrorException.new(
|
|
381
386
|
'The resource specified cannot be found or does not belong to you.',
|
|
382
387
|
_response
|
|
383
388
|
)
|
|
384
|
-
|
|
385
|
-
raise
|
|
389
|
+
when 415
|
|
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
|
-
|
|
391
|
-
raise
|
|
395
|
+
when 429
|
|
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
|
-
|
|
397
|
-
raise
|
|
401
|
+
when 500
|
|
402
|
+
raise ApiErrorException.new(
|
|
398
403
|
'Something unexpected happened. Please try again.',
|
|
399
404
|
_response
|
|
400
405
|
)
|
|
@@ -405,18 +410,18 @@ module Voice
|
|
|
405
410
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
406
411
|
ApiResponse.new(
|
|
407
412
|
_response,
|
|
408
|
-
data: decoded.map { |element|
|
|
413
|
+
data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
|
|
409
414
|
)
|
|
410
415
|
end
|
|
411
416
|
|
|
412
|
-
# Returns metadata for the specified recording
|
|
417
|
+
# Returns metadata for the specified recording.
|
|
413
418
|
# @param [String] account_id Required parameter: Example:
|
|
414
419
|
# @param [String] call_id Required parameter: Example:
|
|
415
420
|
# @param [String] recording_id Required parameter: Example:
|
|
416
|
-
# @return [
|
|
417
|
-
def
|
|
418
|
-
|
|
419
|
-
|
|
421
|
+
# @return [CallRecordingMetadata] response from the API call
|
|
422
|
+
def get_call_recording(account_id,
|
|
423
|
+
call_id,
|
|
424
|
+
recording_id)
|
|
420
425
|
# Prepare query url.
|
|
421
426
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
422
427
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
|
@@ -442,42 +447,43 @@ module Voice
|
|
|
442
447
|
_response = execute_request(_request)
|
|
443
448
|
|
|
444
449
|
# Validate response against endpoint and global error codes.
|
|
445
|
-
|
|
446
|
-
|
|
450
|
+
case _response.status_code
|
|
451
|
+
when 400
|
|
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
|
-
|
|
458
|
-
raise
|
|
463
|
+
when 403
|
|
464
|
+
raise ApiErrorException.new(
|
|
459
465
|
'User unauthorized to perform this action.',
|
|
460
466
|
_response
|
|
461
467
|
)
|
|
462
|
-
|
|
463
|
-
raise
|
|
468
|
+
when 404
|
|
469
|
+
raise ApiErrorException.new(
|
|
464
470
|
'The resource specified cannot be found or does not belong to you.',
|
|
465
471
|
_response
|
|
466
472
|
)
|
|
467
|
-
|
|
468
|
-
raise
|
|
473
|
+
when 415
|
|
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
|
-
|
|
474
|
-
raise
|
|
479
|
+
when 429
|
|
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
|
-
|
|
480
|
-
raise
|
|
485
|
+
when 500
|
|
486
|
+
raise ApiErrorException.new(
|
|
481
487
|
'Something unexpected happened. Please try again.',
|
|
482
488
|
_response
|
|
483
489
|
)
|
|
@@ -487,11 +493,11 @@ module Voice
|
|
|
487
493
|
# Return appropriate response type.
|
|
488
494
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
489
495
|
ApiResponse.new(
|
|
490
|
-
_response, data:
|
|
496
|
+
_response, data: CallRecordingMetadata.from_hash(decoded)
|
|
491
497
|
)
|
|
492
498
|
end
|
|
493
499
|
|
|
494
|
-
# Deletes the specified recording
|
|
500
|
+
# Deletes the specified recording.
|
|
495
501
|
# @param [String] account_id Required parameter: Example:
|
|
496
502
|
# @param [String] call_id Required parameter: Example:
|
|
497
503
|
# @param [String] recording_id Required parameter: Example:
|
|
@@ -518,42 +524,43 @@ module Voice
|
|
|
518
524
|
_response = execute_request(_request)
|
|
519
525
|
|
|
520
526
|
# Validate response against endpoint and global error codes.
|
|
521
|
-
|
|
522
|
-
|
|
527
|
+
case _response.status_code
|
|
528
|
+
when 400
|
|
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
|
-
|
|
534
|
-
raise
|
|
540
|
+
when 403
|
|
541
|
+
raise ApiErrorException.new(
|
|
535
542
|
'User unauthorized to perform this action.',
|
|
536
543
|
_response
|
|
537
544
|
)
|
|
538
|
-
|
|
539
|
-
raise
|
|
545
|
+
when 404
|
|
546
|
+
raise ApiErrorException.new(
|
|
540
547
|
'The resource specified cannot be found or does not belong to you.',
|
|
541
548
|
_response
|
|
542
549
|
)
|
|
543
|
-
|
|
544
|
-
raise
|
|
550
|
+
when 415
|
|
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
|
-
|
|
550
|
-
raise
|
|
556
|
+
when 429
|
|
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
|
-
|
|
556
|
-
raise
|
|
562
|
+
when 500
|
|
563
|
+
raise ApiErrorException.new(
|
|
557
564
|
'Something unexpected happened. Please try again.',
|
|
558
565
|
_response
|
|
559
566
|
)
|
|
@@ -564,14 +571,14 @@ module Voice
|
|
|
564
571
|
ApiResponse.new(_response)
|
|
565
572
|
end
|
|
566
573
|
|
|
567
|
-
# Downloads the specified recording
|
|
574
|
+
# Downloads the specified recording.
|
|
568
575
|
# @param [String] account_id Required parameter: Example:
|
|
569
576
|
# @param [String] call_id Required parameter: Example:
|
|
570
577
|
# @param [String] recording_id Required parameter: Example:
|
|
571
|
-
# @return [
|
|
572
|
-
def
|
|
573
|
-
|
|
574
|
-
|
|
578
|
+
# @return [Mixed] response from the API call
|
|
579
|
+
def get_download_call_recording(account_id,
|
|
580
|
+
call_id,
|
|
581
|
+
recording_id)
|
|
575
582
|
# Prepare query url.
|
|
576
583
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
577
584
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
|
@@ -583,50 +590,57 @@ module Voice
|
|
|
583
590
|
)
|
|
584
591
|
_query_url = APIHelper.clean_url _query_builder
|
|
585
592
|
|
|
593
|
+
# Prepare headers.
|
|
594
|
+
_headers = {
|
|
595
|
+
'accept' => 'application/json'
|
|
596
|
+
}
|
|
597
|
+
|
|
586
598
|
# Prepare and execute HttpRequest.
|
|
587
599
|
_request = config.http_client.get(
|
|
588
|
-
_query_url
|
|
600
|
+
_query_url,
|
|
601
|
+
headers: _headers
|
|
589
602
|
)
|
|
590
603
|
VoiceBasicAuth.apply(config, _request)
|
|
591
|
-
_response = execute_request(_request
|
|
604
|
+
_response = execute_request(_request)
|
|
592
605
|
|
|
593
606
|
# Validate response against endpoint and global error codes.
|
|
594
|
-
|
|
595
|
-
|
|
607
|
+
case _response.status_code
|
|
608
|
+
when 400
|
|
609
|
+
raise ApiErrorException.new(
|
|
596
610
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
597
611
|
' fix it before trying again.',
|
|
598
612
|
_response
|
|
599
613
|
)
|
|
600
|
-
|
|
614
|
+
when 401
|
|
601
615
|
raise APIException.new(
|
|
602
616
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
603
617
|
' credentials to authenticate to the API.',
|
|
604
618
|
_response
|
|
605
619
|
)
|
|
606
|
-
|
|
607
|
-
raise
|
|
620
|
+
when 403
|
|
621
|
+
raise ApiErrorException.new(
|
|
608
622
|
'User unauthorized to perform this action.',
|
|
609
623
|
_response
|
|
610
624
|
)
|
|
611
|
-
|
|
612
|
-
raise
|
|
625
|
+
when 404
|
|
626
|
+
raise ApiErrorException.new(
|
|
613
627
|
'The resource specified cannot be found or does not belong to you.',
|
|
614
628
|
_response
|
|
615
629
|
)
|
|
616
|
-
|
|
617
|
-
raise
|
|
630
|
+
when 415
|
|
631
|
+
raise ApiErrorException.new(
|
|
618
632
|
'We don\'t support that media type. If a request body is required,' \
|
|
619
633
|
' please send it to us as `application/json`.',
|
|
620
634
|
_response
|
|
621
635
|
)
|
|
622
|
-
|
|
623
|
-
raise
|
|
636
|
+
when 429
|
|
637
|
+
raise ApiErrorException.new(
|
|
624
638
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
625
639
|
' slow your request rate down and try again.',
|
|
626
640
|
_response
|
|
627
641
|
)
|
|
628
|
-
|
|
629
|
-
raise
|
|
642
|
+
when 500
|
|
643
|
+
raise ApiErrorException.new(
|
|
630
644
|
'Something unexpected happened. Please try again.',
|
|
631
645
|
_response
|
|
632
646
|
)
|
|
@@ -634,12 +648,15 @@ module Voice
|
|
|
634
648
|
validate_response(_response)
|
|
635
649
|
|
|
636
650
|
# Return appropriate response type.
|
|
651
|
+
decoded = APIHelper.json_deserialize(_response.raw_body) unless
|
|
652
|
+
_response.raw_body.nil? ||
|
|
653
|
+
_response.raw_body.to_s.strip.empty?
|
|
637
654
|
ApiResponse.new(
|
|
638
|
-
_response, data:
|
|
655
|
+
_response, data: decoded
|
|
639
656
|
)
|
|
640
657
|
end
|
|
641
658
|
|
|
642
|
-
# Deletes the specified recording's media
|
|
659
|
+
# Deletes the specified recording's media.
|
|
643
660
|
# @param [String] account_id Required parameter: Example:
|
|
644
661
|
# @param [String] call_id Required parameter: Example:
|
|
645
662
|
# @param [String] recording_id Required parameter: Example:
|
|
@@ -666,42 +683,43 @@ module Voice
|
|
|
666
683
|
_response = execute_request(_request)
|
|
667
684
|
|
|
668
685
|
# Validate response against endpoint and global error codes.
|
|
669
|
-
|
|
670
|
-
|
|
686
|
+
case _response.status_code
|
|
687
|
+
when 400
|
|
688
|
+
raise ApiErrorException.new(
|
|
671
689
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
672
690
|
' fix it before trying again.',
|
|
673
691
|
_response
|
|
674
692
|
)
|
|
675
|
-
|
|
693
|
+
when 401
|
|
676
694
|
raise APIException.new(
|
|
677
695
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
678
696
|
' credentials to authenticate to the API.',
|
|
679
697
|
_response
|
|
680
698
|
)
|
|
681
|
-
|
|
682
|
-
raise
|
|
699
|
+
when 403
|
|
700
|
+
raise ApiErrorException.new(
|
|
683
701
|
'User unauthorized to perform this action.',
|
|
684
702
|
_response
|
|
685
703
|
)
|
|
686
|
-
|
|
687
|
-
raise
|
|
704
|
+
when 404
|
|
705
|
+
raise ApiErrorException.new(
|
|
688
706
|
'The resource specified cannot be found or does not belong to you.',
|
|
689
707
|
_response
|
|
690
708
|
)
|
|
691
|
-
|
|
692
|
-
raise
|
|
709
|
+
when 415
|
|
710
|
+
raise ApiErrorException.new(
|
|
693
711
|
'We don\'t support that media type. If a request body is required,' \
|
|
694
712
|
' please send it to us as `application/json`.',
|
|
695
713
|
_response
|
|
696
714
|
)
|
|
697
|
-
|
|
698
|
-
raise
|
|
715
|
+
when 429
|
|
716
|
+
raise ApiErrorException.new(
|
|
699
717
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
700
718
|
' slow your request rate down and try again.',
|
|
701
719
|
_response
|
|
702
720
|
)
|
|
703
|
-
|
|
704
|
-
raise
|
|
721
|
+
when 500
|
|
722
|
+
raise ApiErrorException.new(
|
|
705
723
|
'Something unexpected happened. Please try again.',
|
|
706
724
|
_response
|
|
707
725
|
)
|
|
@@ -712,14 +730,14 @@ module Voice
|
|
|
712
730
|
ApiResponse.new(_response)
|
|
713
731
|
end
|
|
714
732
|
|
|
715
|
-
# Downloads the specified transcription
|
|
733
|
+
# Downloads the specified transcription.
|
|
716
734
|
# @param [String] account_id Required parameter: Example:
|
|
717
735
|
# @param [String] call_id Required parameter: Example:
|
|
718
736
|
# @param [String] recording_id Required parameter: Example:
|
|
719
737
|
# @return [TranscriptionResponse] response from the API call
|
|
720
|
-
def
|
|
721
|
-
|
|
722
|
-
|
|
738
|
+
def get_call_transcription(account_id,
|
|
739
|
+
call_id,
|
|
740
|
+
recording_id)
|
|
723
741
|
# Prepare query url.
|
|
724
742
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
725
743
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
|
@@ -745,42 +763,43 @@ module Voice
|
|
|
745
763
|
_response = execute_request(_request)
|
|
746
764
|
|
|
747
765
|
# Validate response against endpoint and global error codes.
|
|
748
|
-
|
|
749
|
-
|
|
766
|
+
case _response.status_code
|
|
767
|
+
when 400
|
|
768
|
+
raise ApiErrorException.new(
|
|
750
769
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
751
770
|
' fix it before trying again.',
|
|
752
771
|
_response
|
|
753
772
|
)
|
|
754
|
-
|
|
773
|
+
when 401
|
|
755
774
|
raise APIException.new(
|
|
756
775
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
757
776
|
' credentials to authenticate to the API.',
|
|
758
777
|
_response
|
|
759
778
|
)
|
|
760
|
-
|
|
761
|
-
raise
|
|
779
|
+
when 403
|
|
780
|
+
raise ApiErrorException.new(
|
|
762
781
|
'User unauthorized to perform this action.',
|
|
763
782
|
_response
|
|
764
783
|
)
|
|
765
|
-
|
|
766
|
-
raise
|
|
784
|
+
when 404
|
|
785
|
+
raise ApiErrorException.new(
|
|
767
786
|
'The resource specified cannot be found or does not belong to you.',
|
|
768
787
|
_response
|
|
769
788
|
)
|
|
770
|
-
|
|
771
|
-
raise
|
|
789
|
+
when 415
|
|
790
|
+
raise ApiErrorException.new(
|
|
772
791
|
'We don\'t support that media type. If a request body is required,' \
|
|
773
792
|
' please send it to us as `application/json`.',
|
|
774
793
|
_response
|
|
775
794
|
)
|
|
776
|
-
|
|
777
|
-
raise
|
|
795
|
+
when 429
|
|
796
|
+
raise ApiErrorException.new(
|
|
778
797
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
779
798
|
' slow your request rate down and try again.',
|
|
780
799
|
_response
|
|
781
800
|
)
|
|
782
|
-
|
|
783
|
-
raise
|
|
801
|
+
when 500
|
|
802
|
+
raise ApiErrorException.new(
|
|
784
803
|
'Something unexpected happened. Please try again.',
|
|
785
804
|
_response
|
|
786
805
|
)
|
|
@@ -794,16 +813,16 @@ module Voice
|
|
|
794
813
|
)
|
|
795
814
|
end
|
|
796
815
|
|
|
797
|
-
# Requests that the specified recording be transcribed
|
|
816
|
+
# Requests that the specified recording be transcribed.
|
|
798
817
|
# @param [String] account_id Required parameter: Example:
|
|
799
818
|
# @param [String] call_id Required parameter: Example:
|
|
800
819
|
# @param [String] recording_id Required parameter: Example:
|
|
801
|
-
# @param [
|
|
820
|
+
# @param [TranscribeRecordingRequest] body Required parameter: Example:
|
|
802
821
|
# @return [void] response from the API call
|
|
803
|
-
def
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
822
|
+
def create_transcribe_call_recording(account_id,
|
|
823
|
+
call_id,
|
|
824
|
+
recording_id,
|
|
825
|
+
body)
|
|
807
826
|
# Prepare query url.
|
|
808
827
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
809
828
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
|
@@ -830,48 +849,49 @@ module Voice
|
|
|
830
849
|
_response = execute_request(_request)
|
|
831
850
|
|
|
832
851
|
# Validate response against endpoint and global error codes.
|
|
833
|
-
|
|
834
|
-
|
|
852
|
+
case _response.status_code
|
|
853
|
+
when 400
|
|
854
|
+
raise ApiErrorException.new(
|
|
835
855
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
836
856
|
' fix it before trying again.',
|
|
837
857
|
_response
|
|
838
858
|
)
|
|
839
|
-
|
|
859
|
+
when 401
|
|
840
860
|
raise APIException.new(
|
|
841
861
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
842
862
|
' credentials to authenticate to the API.',
|
|
843
863
|
_response
|
|
844
864
|
)
|
|
845
|
-
|
|
846
|
-
raise
|
|
865
|
+
when 403
|
|
866
|
+
raise ApiErrorException.new(
|
|
847
867
|
'User unauthorized to perform this action.',
|
|
848
868
|
_response
|
|
849
869
|
)
|
|
850
|
-
|
|
851
|
-
raise
|
|
870
|
+
when 404
|
|
871
|
+
raise ApiErrorException.new(
|
|
852
872
|
'The resource specified cannot be found or does not belong to you.',
|
|
853
873
|
_response
|
|
854
874
|
)
|
|
855
|
-
|
|
856
|
-
raise
|
|
875
|
+
when 410
|
|
876
|
+
raise ApiErrorException.new(
|
|
857
877
|
'The media for this recording has been deleted, so we can\'t' \
|
|
858
878
|
' transcribe it',
|
|
859
879
|
_response
|
|
860
880
|
)
|
|
861
|
-
|
|
862
|
-
raise
|
|
881
|
+
when 415
|
|
882
|
+
raise ApiErrorException.new(
|
|
863
883
|
'We don\'t support that media type. If a request body is required,' \
|
|
864
884
|
' please send it to us as `application/json`.',
|
|
865
885
|
_response
|
|
866
886
|
)
|
|
867
|
-
|
|
868
|
-
raise
|
|
887
|
+
when 429
|
|
888
|
+
raise ApiErrorException.new(
|
|
869
889
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
870
890
|
' slow your request rate down and try again.',
|
|
871
891
|
_response
|
|
872
892
|
)
|
|
873
|
-
|
|
874
|
-
raise
|
|
893
|
+
when 500
|
|
894
|
+
raise ApiErrorException.new(
|
|
875
895
|
'Something unexpected happened. Please try again.',
|
|
876
896
|
_response
|
|
877
897
|
)
|
|
@@ -882,14 +902,14 @@ module Voice
|
|
|
882
902
|
ApiResponse.new(_response)
|
|
883
903
|
end
|
|
884
904
|
|
|
885
|
-
# Deletes the specified recording's transcription
|
|
905
|
+
# Deletes the specified recording's transcription.
|
|
886
906
|
# @param [String] account_id Required parameter: Example:
|
|
887
907
|
# @param [String] call_id Required parameter: Example:
|
|
888
908
|
# @param [String] recording_id Required parameter: Example:
|
|
889
909
|
# @return [void] response from the API call
|
|
890
|
-
def
|
|
891
|
-
|
|
892
|
-
|
|
910
|
+
def delete_call_transcription(account_id,
|
|
911
|
+
call_id,
|
|
912
|
+
recording_id)
|
|
893
913
|
# Prepare query url.
|
|
894
914
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
895
915
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
|
@@ -909,42 +929,43 @@ module Voice
|
|
|
909
929
|
_response = execute_request(_request)
|
|
910
930
|
|
|
911
931
|
# Validate response against endpoint and global error codes.
|
|
912
|
-
|
|
913
|
-
|
|
932
|
+
case _response.status_code
|
|
933
|
+
when 400
|
|
934
|
+
raise ApiErrorException.new(
|
|
914
935
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
915
936
|
' fix it before trying again.',
|
|
916
937
|
_response
|
|
917
938
|
)
|
|
918
|
-
|
|
939
|
+
when 401
|
|
919
940
|
raise APIException.new(
|
|
920
941
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
921
942
|
' credentials to authenticate to the API.',
|
|
922
943
|
_response
|
|
923
944
|
)
|
|
924
|
-
|
|
925
|
-
raise
|
|
945
|
+
when 403
|
|
946
|
+
raise ApiErrorException.new(
|
|
926
947
|
'User unauthorized to perform this action.',
|
|
927
948
|
_response
|
|
928
949
|
)
|
|
929
|
-
|
|
930
|
-
raise
|
|
950
|
+
when 404
|
|
951
|
+
raise ApiErrorException.new(
|
|
931
952
|
'The resource specified cannot be found or does not belong to you.',
|
|
932
953
|
_response
|
|
933
954
|
)
|
|
934
|
-
|
|
935
|
-
raise
|
|
955
|
+
when 415
|
|
956
|
+
raise ApiErrorException.new(
|
|
936
957
|
'We don\'t support that media type. If a request body is required,' \
|
|
937
958
|
' please send it to us as `application/json`.',
|
|
938
959
|
_response
|
|
939
960
|
)
|
|
940
|
-
|
|
941
|
-
raise
|
|
961
|
+
when 429
|
|
962
|
+
raise ApiErrorException.new(
|
|
942
963
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
943
964
|
' slow your request rate down and try again.',
|
|
944
965
|
_response
|
|
945
966
|
)
|
|
946
|
-
|
|
947
|
-
raise
|
|
967
|
+
when 500
|
|
968
|
+
raise ApiErrorException.new(
|
|
948
969
|
'Something unexpected happened. Please try again.',
|
|
949
970
|
_response
|
|
950
971
|
)
|
|
@@ -955,20 +976,20 @@ module Voice
|
|
|
955
976
|
ApiResponse.new(_response)
|
|
956
977
|
end
|
|
957
978
|
|
|
958
|
-
# Returns information about the conferences in the account
|
|
979
|
+
# Returns information about the conferences in the account.
|
|
959
980
|
# @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
981
|
# @param [String] name Optional parameter: Example:
|
|
963
982
|
# @param [String] min_created_time Optional parameter: Example:
|
|
964
983
|
# @param [String] max_created_time Optional parameter: Example:
|
|
965
|
-
# @
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
984
|
+
# @param [Integer] page_size Optional parameter: Example:1000
|
|
985
|
+
# @param [String] page_token Optional parameter: Example:
|
|
986
|
+
# @return [List of ConferenceState] response from the API call
|
|
987
|
+
def get_conferences(account_id,
|
|
988
|
+
name: nil,
|
|
989
|
+
min_created_time: nil,
|
|
990
|
+
max_created_time: nil,
|
|
991
|
+
page_size: 1000,
|
|
992
|
+
page_token: nil)
|
|
972
993
|
# Prepare query url.
|
|
973
994
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
974
995
|
_query_builder << '/api/v2/accounts/{accountId}/conferences'
|
|
@@ -978,11 +999,11 @@ module Voice
|
|
|
978
999
|
)
|
|
979
1000
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
|
980
1001
|
_query_builder,
|
|
981
|
-
'pageSize' => page_size,
|
|
982
|
-
'pageToken' => page_token,
|
|
983
1002
|
'name' => name,
|
|
984
1003
|
'minCreatedTime' => min_created_time,
|
|
985
|
-
'maxCreatedTime' => max_created_time
|
|
1004
|
+
'maxCreatedTime' => max_created_time,
|
|
1005
|
+
'pageSize' => page_size,
|
|
1006
|
+
'pageToken' => page_token
|
|
986
1007
|
)
|
|
987
1008
|
_query_url = APIHelper.clean_url _query_builder
|
|
988
1009
|
|
|
@@ -1000,42 +1021,43 @@ module Voice
|
|
|
1000
1021
|
_response = execute_request(_request)
|
|
1001
1022
|
|
|
1002
1023
|
# Validate response against endpoint and global error codes.
|
|
1003
|
-
|
|
1004
|
-
|
|
1024
|
+
case _response.status_code
|
|
1025
|
+
when 400
|
|
1026
|
+
raise ApiErrorException.new(
|
|
1005
1027
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1006
1028
|
' fix it before trying again.',
|
|
1007
1029
|
_response
|
|
1008
1030
|
)
|
|
1009
|
-
|
|
1031
|
+
when 401
|
|
1010
1032
|
raise APIException.new(
|
|
1011
1033
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1012
1034
|
' credentials to authenticate to the API.',
|
|
1013
1035
|
_response
|
|
1014
1036
|
)
|
|
1015
|
-
|
|
1016
|
-
raise
|
|
1037
|
+
when 403
|
|
1038
|
+
raise ApiErrorException.new(
|
|
1017
1039
|
'User unauthorized to perform this action.',
|
|
1018
1040
|
_response
|
|
1019
1041
|
)
|
|
1020
|
-
|
|
1021
|
-
raise
|
|
1042
|
+
when 404
|
|
1043
|
+
raise ApiErrorException.new(
|
|
1022
1044
|
'The resource specified cannot be found or does not belong to you.',
|
|
1023
1045
|
_response
|
|
1024
1046
|
)
|
|
1025
|
-
|
|
1026
|
-
raise
|
|
1047
|
+
when 415
|
|
1048
|
+
raise ApiErrorException.new(
|
|
1027
1049
|
'We don\'t support that media type. If a request body is required,' \
|
|
1028
1050
|
' please send it to us as `application/json`.',
|
|
1029
1051
|
_response
|
|
1030
1052
|
)
|
|
1031
|
-
|
|
1032
|
-
raise
|
|
1053
|
+
when 429
|
|
1054
|
+
raise ApiErrorException.new(
|
|
1033
1055
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1034
1056
|
' slow your request rate down and try again.',
|
|
1035
1057
|
_response
|
|
1036
1058
|
)
|
|
1037
|
-
|
|
1038
|
-
raise
|
|
1059
|
+
when 500
|
|
1060
|
+
raise ApiErrorException.new(
|
|
1039
1061
|
'Something unexpected happened. Please try again.',
|
|
1040
1062
|
_response
|
|
1041
1063
|
)
|
|
@@ -1046,16 +1068,16 @@ module Voice
|
|
|
1046
1068
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1047
1069
|
ApiResponse.new(
|
|
1048
1070
|
_response,
|
|
1049
|
-
data: decoded.map { |element|
|
|
1071
|
+
data: decoded.map { |element| ConferenceState.from_hash(element) }
|
|
1050
1072
|
)
|
|
1051
1073
|
end
|
|
1052
1074
|
|
|
1053
|
-
# Returns information about the specified conference
|
|
1075
|
+
# Returns information about the specified conference.
|
|
1054
1076
|
# @param [String] account_id Required parameter: Example:
|
|
1055
1077
|
# @param [String] conference_id Required parameter: Example:
|
|
1056
|
-
# @return [
|
|
1057
|
-
def
|
|
1058
|
-
|
|
1078
|
+
# @return [ConferenceState] response from the API call
|
|
1079
|
+
def get_conference(account_id,
|
|
1080
|
+
conference_id)
|
|
1059
1081
|
# Prepare query url.
|
|
1060
1082
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1061
1083
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
|
@@ -1080,42 +1102,43 @@ module Voice
|
|
|
1080
1102
|
_response = execute_request(_request)
|
|
1081
1103
|
|
|
1082
1104
|
# Validate response against endpoint and global error codes.
|
|
1083
|
-
|
|
1084
|
-
|
|
1105
|
+
case _response.status_code
|
|
1106
|
+
when 400
|
|
1107
|
+
raise ApiErrorException.new(
|
|
1085
1108
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1086
1109
|
' fix it before trying again.',
|
|
1087
1110
|
_response
|
|
1088
1111
|
)
|
|
1089
|
-
|
|
1112
|
+
when 401
|
|
1090
1113
|
raise APIException.new(
|
|
1091
1114
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1092
1115
|
' credentials to authenticate to the API.',
|
|
1093
1116
|
_response
|
|
1094
1117
|
)
|
|
1095
|
-
|
|
1096
|
-
raise
|
|
1118
|
+
when 403
|
|
1119
|
+
raise ApiErrorException.new(
|
|
1097
1120
|
'User unauthorized to perform this action.',
|
|
1098
1121
|
_response
|
|
1099
1122
|
)
|
|
1100
|
-
|
|
1101
|
-
raise
|
|
1123
|
+
when 404
|
|
1124
|
+
raise ApiErrorException.new(
|
|
1102
1125
|
'The resource specified cannot be found or does not belong to you.',
|
|
1103
1126
|
_response
|
|
1104
1127
|
)
|
|
1105
|
-
|
|
1106
|
-
raise
|
|
1128
|
+
when 415
|
|
1129
|
+
raise ApiErrorException.new(
|
|
1107
1130
|
'We don\'t support that media type. If a request body is required,' \
|
|
1108
1131
|
' please send it to us as `application/json`.',
|
|
1109
1132
|
_response
|
|
1110
1133
|
)
|
|
1111
|
-
|
|
1112
|
-
raise
|
|
1134
|
+
when 429
|
|
1135
|
+
raise ApiErrorException.new(
|
|
1113
1136
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1114
1137
|
' slow your request rate down and try again.',
|
|
1115
1138
|
_response
|
|
1116
1139
|
)
|
|
1117
|
-
|
|
1118
|
-
raise
|
|
1140
|
+
when 500
|
|
1141
|
+
raise ApiErrorException.new(
|
|
1119
1142
|
'Something unexpected happened. Please try again.',
|
|
1120
1143
|
_response
|
|
1121
1144
|
)
|
|
@@ -1125,18 +1148,18 @@ module Voice
|
|
|
1125
1148
|
# Return appropriate response type.
|
|
1126
1149
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1127
1150
|
ApiResponse.new(
|
|
1128
|
-
_response, data:
|
|
1151
|
+
_response, data: ConferenceState.from_hash(decoded)
|
|
1129
1152
|
)
|
|
1130
1153
|
end
|
|
1131
1154
|
|
|
1132
|
-
# Modify the conference state
|
|
1155
|
+
# Modify the conference state.
|
|
1133
1156
|
# @param [String] account_id Required parameter: Example:
|
|
1134
1157
|
# @param [String] conference_id Required parameter: Example:
|
|
1135
|
-
# @param [
|
|
1158
|
+
# @param [ModifyConferenceRequest] body Required parameter: Example:
|
|
1136
1159
|
# @return [void] response from the API call
|
|
1137
1160
|
def modify_conference(account_id,
|
|
1138
1161
|
conference_id,
|
|
1139
|
-
body
|
|
1162
|
+
body)
|
|
1140
1163
|
# Prepare query url.
|
|
1141
1164
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1142
1165
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
|
@@ -1162,42 +1185,43 @@ module Voice
|
|
|
1162
1185
|
_response = execute_request(_request)
|
|
1163
1186
|
|
|
1164
1187
|
# Validate response against endpoint and global error codes.
|
|
1165
|
-
|
|
1166
|
-
|
|
1188
|
+
case _response.status_code
|
|
1189
|
+
when 400
|
|
1190
|
+
raise ApiErrorException.new(
|
|
1167
1191
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1168
1192
|
' fix it before trying again.',
|
|
1169
1193
|
_response
|
|
1170
1194
|
)
|
|
1171
|
-
|
|
1195
|
+
when 401
|
|
1172
1196
|
raise APIException.new(
|
|
1173
1197
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1174
1198
|
' credentials to authenticate to the API.',
|
|
1175
1199
|
_response
|
|
1176
1200
|
)
|
|
1177
|
-
|
|
1178
|
-
raise
|
|
1201
|
+
when 403
|
|
1202
|
+
raise ApiErrorException.new(
|
|
1179
1203
|
'User unauthorized to perform this action.',
|
|
1180
1204
|
_response
|
|
1181
1205
|
)
|
|
1182
|
-
|
|
1183
|
-
raise
|
|
1206
|
+
when 404
|
|
1207
|
+
raise ApiErrorException.new(
|
|
1184
1208
|
'The resource specified cannot be found or does not belong to you.',
|
|
1185
1209
|
_response
|
|
1186
1210
|
)
|
|
1187
|
-
|
|
1188
|
-
raise
|
|
1211
|
+
when 415
|
|
1212
|
+
raise ApiErrorException.new(
|
|
1189
1213
|
'We don\'t support that media type. If a request body is required,' \
|
|
1190
1214
|
' please send it to us as `application/json`.',
|
|
1191
1215
|
_response
|
|
1192
1216
|
)
|
|
1193
|
-
|
|
1194
|
-
raise
|
|
1217
|
+
when 429
|
|
1218
|
+
raise ApiErrorException.new(
|
|
1195
1219
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1196
1220
|
' slow your request rate down and try again.',
|
|
1197
1221
|
_response
|
|
1198
1222
|
)
|
|
1199
|
-
|
|
1200
|
-
raise
|
|
1223
|
+
when 500
|
|
1224
|
+
raise ApiErrorException.new(
|
|
1201
1225
|
'Something unexpected happened. Please try again.',
|
|
1202
1226
|
_response
|
|
1203
1227
|
)
|
|
@@ -1208,16 +1232,16 @@ module Voice
|
|
|
1208
1232
|
ApiResponse.new(_response)
|
|
1209
1233
|
end
|
|
1210
1234
|
|
|
1211
|
-
# Updates settings for a particular conference member
|
|
1235
|
+
# Updates settings for a particular conference member.
|
|
1212
1236
|
# @param [String] account_id Required parameter: Example:
|
|
1213
1237
|
# @param [String] conference_id Required parameter: Example:
|
|
1214
1238
|
# @param [String] call_id Required parameter: Example:
|
|
1215
|
-
# @param [
|
|
1239
|
+
# @param [ConferenceMemberState] body Required parameter: Example:
|
|
1216
1240
|
# @return [void] response from the API call
|
|
1217
1241
|
def modify_conference_member(account_id,
|
|
1218
1242
|
conference_id,
|
|
1219
1243
|
call_id,
|
|
1220
|
-
body
|
|
1244
|
+
body)
|
|
1221
1245
|
# Prepare query url.
|
|
1222
1246
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1223
1247
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
|
|
@@ -1244,42 +1268,43 @@ module Voice
|
|
|
1244
1268
|
_response = execute_request(_request)
|
|
1245
1269
|
|
|
1246
1270
|
# Validate response against endpoint and global error codes.
|
|
1247
|
-
|
|
1248
|
-
|
|
1271
|
+
case _response.status_code
|
|
1272
|
+
when 400
|
|
1273
|
+
raise ApiErrorException.new(
|
|
1249
1274
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1250
1275
|
' fix it before trying again.',
|
|
1251
1276
|
_response
|
|
1252
1277
|
)
|
|
1253
|
-
|
|
1278
|
+
when 401
|
|
1254
1279
|
raise APIException.new(
|
|
1255
1280
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1256
1281
|
' credentials to authenticate to the API.',
|
|
1257
1282
|
_response
|
|
1258
1283
|
)
|
|
1259
|
-
|
|
1260
|
-
raise
|
|
1284
|
+
when 403
|
|
1285
|
+
raise ApiErrorException.new(
|
|
1261
1286
|
'User unauthorized to perform this action.',
|
|
1262
1287
|
_response
|
|
1263
1288
|
)
|
|
1264
|
-
|
|
1265
|
-
raise
|
|
1289
|
+
when 404
|
|
1290
|
+
raise ApiErrorException.new(
|
|
1266
1291
|
'The resource specified cannot be found or does not belong to you.',
|
|
1267
1292
|
_response
|
|
1268
1293
|
)
|
|
1269
|
-
|
|
1270
|
-
raise
|
|
1294
|
+
when 415
|
|
1295
|
+
raise ApiErrorException.new(
|
|
1271
1296
|
'We don\'t support that media type. If a request body is required,' \
|
|
1272
1297
|
' please send it to us as `application/json`.',
|
|
1273
1298
|
_response
|
|
1274
1299
|
)
|
|
1275
|
-
|
|
1276
|
-
raise
|
|
1300
|
+
when 429
|
|
1301
|
+
raise ApiErrorException.new(
|
|
1277
1302
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1278
1303
|
' slow your request rate down and try again.',
|
|
1279
1304
|
_response
|
|
1280
1305
|
)
|
|
1281
|
-
|
|
1282
|
-
raise
|
|
1306
|
+
when 500
|
|
1307
|
+
raise ApiErrorException.new(
|
|
1283
1308
|
'Something unexpected happened. Please try again.',
|
|
1284
1309
|
_response
|
|
1285
1310
|
)
|
|
@@ -1290,11 +1315,11 @@ module Voice
|
|
|
1290
1315
|
ApiResponse.new(_response)
|
|
1291
1316
|
end
|
|
1292
1317
|
|
|
1293
|
-
# Returns information about the specified conference member
|
|
1318
|
+
# Returns information about the specified conference member.
|
|
1294
1319
|
# @param [String] account_id Required parameter: Example:
|
|
1295
1320
|
# @param [String] conference_id Required parameter: Example:
|
|
1296
1321
|
# @param [String] member_id Required parameter: Example:
|
|
1297
|
-
# @return [
|
|
1322
|
+
# @return [ConferenceMemberState] response from the API call
|
|
1298
1323
|
def get_conference_member(account_id,
|
|
1299
1324
|
conference_id,
|
|
1300
1325
|
member_id)
|
|
@@ -1323,42 +1348,43 @@ module Voice
|
|
|
1323
1348
|
_response = execute_request(_request)
|
|
1324
1349
|
|
|
1325
1350
|
# Validate response against endpoint and global error codes.
|
|
1326
|
-
|
|
1327
|
-
|
|
1351
|
+
case _response.status_code
|
|
1352
|
+
when 400
|
|
1353
|
+
raise ApiErrorException.new(
|
|
1328
1354
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1329
1355
|
' fix it before trying again.',
|
|
1330
1356
|
_response
|
|
1331
1357
|
)
|
|
1332
|
-
|
|
1358
|
+
when 401
|
|
1333
1359
|
raise APIException.new(
|
|
1334
1360
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1335
1361
|
' credentials to authenticate to the API.',
|
|
1336
1362
|
_response
|
|
1337
1363
|
)
|
|
1338
|
-
|
|
1339
|
-
raise
|
|
1364
|
+
when 403
|
|
1365
|
+
raise ApiErrorException.new(
|
|
1340
1366
|
'User unauthorized to perform this action.',
|
|
1341
1367
|
_response
|
|
1342
1368
|
)
|
|
1343
|
-
|
|
1344
|
-
raise
|
|
1369
|
+
when 404
|
|
1370
|
+
raise ApiErrorException.new(
|
|
1345
1371
|
'The resource specified cannot be found or does not belong to you.',
|
|
1346
1372
|
_response
|
|
1347
1373
|
)
|
|
1348
|
-
|
|
1349
|
-
raise
|
|
1374
|
+
when 415
|
|
1375
|
+
raise ApiErrorException.new(
|
|
1350
1376
|
'We don\'t support that media type. If a request body is required,' \
|
|
1351
1377
|
' please send it to us as `application/json`.',
|
|
1352
1378
|
_response
|
|
1353
1379
|
)
|
|
1354
|
-
|
|
1355
|
-
raise
|
|
1380
|
+
when 429
|
|
1381
|
+
raise ApiErrorException.new(
|
|
1356
1382
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1357
1383
|
' slow your request rate down and try again.',
|
|
1358
1384
|
_response
|
|
1359
1385
|
)
|
|
1360
|
-
|
|
1361
|
-
raise
|
|
1386
|
+
when 500
|
|
1387
|
+
raise ApiErrorException.new(
|
|
1362
1388
|
'Something unexpected happened. Please try again.',
|
|
1363
1389
|
_response
|
|
1364
1390
|
)
|
|
@@ -1368,7 +1394,7 @@ module Voice
|
|
|
1368
1394
|
# Return appropriate response type.
|
|
1369
1395
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1370
1396
|
ApiResponse.new(
|
|
1371
|
-
_response, data:
|
|
1397
|
+
_response, data: ConferenceMemberState.from_hash(decoded)
|
|
1372
1398
|
)
|
|
1373
1399
|
end
|
|
1374
1400
|
|
|
@@ -1376,9 +1402,9 @@ module Voice
|
|
|
1376
1402
|
# took place during the specified conference
|
|
1377
1403
|
# @param [String] account_id Required parameter: Example:
|
|
1378
1404
|
# @param [String] conference_id Required parameter: Example:
|
|
1379
|
-
# @return [List of
|
|
1380
|
-
def
|
|
1381
|
-
|
|
1405
|
+
# @return [List of ConferenceRecordingMetadata] response from the API call
|
|
1406
|
+
def get_conference_recordings(account_id,
|
|
1407
|
+
conference_id)
|
|
1382
1408
|
# Prepare query url.
|
|
1383
1409
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1384
1410
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
|
|
@@ -1403,42 +1429,43 @@ module Voice
|
|
|
1403
1429
|
_response = execute_request(_request)
|
|
1404
1430
|
|
|
1405
1431
|
# Validate response against endpoint and global error codes.
|
|
1406
|
-
|
|
1407
|
-
|
|
1432
|
+
case _response.status_code
|
|
1433
|
+
when 400
|
|
1434
|
+
raise ApiErrorException.new(
|
|
1408
1435
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1409
1436
|
' fix it before trying again.',
|
|
1410
1437
|
_response
|
|
1411
1438
|
)
|
|
1412
|
-
|
|
1439
|
+
when 401
|
|
1413
1440
|
raise APIException.new(
|
|
1414
1441
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1415
1442
|
' credentials to authenticate to the API.',
|
|
1416
1443
|
_response
|
|
1417
1444
|
)
|
|
1418
|
-
|
|
1419
|
-
raise
|
|
1445
|
+
when 403
|
|
1446
|
+
raise ApiErrorException.new(
|
|
1420
1447
|
'User unauthorized to perform this action.',
|
|
1421
1448
|
_response
|
|
1422
1449
|
)
|
|
1423
|
-
|
|
1424
|
-
raise
|
|
1450
|
+
when 404
|
|
1451
|
+
raise ApiErrorException.new(
|
|
1425
1452
|
'The resource specified cannot be found or does not belong to you.',
|
|
1426
1453
|
_response
|
|
1427
1454
|
)
|
|
1428
|
-
|
|
1429
|
-
raise
|
|
1455
|
+
when 415
|
|
1456
|
+
raise ApiErrorException.new(
|
|
1430
1457
|
'We don\'t support that media type. If a request body is required,' \
|
|
1431
1458
|
' please send it to us as `application/json`.',
|
|
1432
1459
|
_response
|
|
1433
1460
|
)
|
|
1434
|
-
|
|
1435
|
-
raise
|
|
1461
|
+
when 429
|
|
1462
|
+
raise ApiErrorException.new(
|
|
1436
1463
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1437
1464
|
' slow your request rate down and try again.',
|
|
1438
1465
|
_response
|
|
1439
1466
|
)
|
|
1440
|
-
|
|
1441
|
-
raise
|
|
1467
|
+
when 500
|
|
1468
|
+
raise ApiErrorException.new(
|
|
1442
1469
|
'Something unexpected happened. Please try again.',
|
|
1443
1470
|
_response
|
|
1444
1471
|
)
|
|
@@ -1449,18 +1476,18 @@ module Voice
|
|
|
1449
1476
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1450
1477
|
ApiResponse.new(
|
|
1451
1478
|
_response,
|
|
1452
|
-
data: decoded.map { |element|
|
|
1479
|
+
data: decoded.map { |element| ConferenceRecordingMetadata.from_hash(element) }
|
|
1453
1480
|
)
|
|
1454
1481
|
end
|
|
1455
1482
|
|
|
1456
|
-
# Returns metadata for the specified recording
|
|
1483
|
+
# Returns metadata for the specified recording.
|
|
1457
1484
|
# @param [String] account_id Required parameter: Example:
|
|
1458
1485
|
# @param [String] conference_id Required parameter: Example:
|
|
1459
1486
|
# @param [String] recording_id Required parameter: Example:
|
|
1460
|
-
# @return [
|
|
1461
|
-
def
|
|
1462
|
-
|
|
1463
|
-
|
|
1487
|
+
# @return [CallRecordingMetadata] response from the API call
|
|
1488
|
+
def get_conference_recording(account_id,
|
|
1489
|
+
conference_id,
|
|
1490
|
+
recording_id)
|
|
1464
1491
|
# Prepare query url.
|
|
1465
1492
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1466
1493
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
|
|
@@ -1486,42 +1513,43 @@ module Voice
|
|
|
1486
1513
|
_response = execute_request(_request)
|
|
1487
1514
|
|
|
1488
1515
|
# Validate response against endpoint and global error codes.
|
|
1489
|
-
|
|
1490
|
-
|
|
1516
|
+
case _response.status_code
|
|
1517
|
+
when 400
|
|
1518
|
+
raise ApiErrorException.new(
|
|
1491
1519
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1492
1520
|
' fix it before trying again.',
|
|
1493
1521
|
_response
|
|
1494
1522
|
)
|
|
1495
|
-
|
|
1523
|
+
when 401
|
|
1496
1524
|
raise APIException.new(
|
|
1497
1525
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1498
1526
|
' credentials to authenticate to the API.',
|
|
1499
1527
|
_response
|
|
1500
1528
|
)
|
|
1501
|
-
|
|
1502
|
-
raise
|
|
1529
|
+
when 403
|
|
1530
|
+
raise ApiErrorException.new(
|
|
1503
1531
|
'User unauthorized to perform this action.',
|
|
1504
1532
|
_response
|
|
1505
1533
|
)
|
|
1506
|
-
|
|
1507
|
-
raise
|
|
1534
|
+
when 404
|
|
1535
|
+
raise ApiErrorException.new(
|
|
1508
1536
|
'The resource specified cannot be found or does not belong to you.',
|
|
1509
1537
|
_response
|
|
1510
1538
|
)
|
|
1511
|
-
|
|
1512
|
-
raise
|
|
1539
|
+
when 415
|
|
1540
|
+
raise ApiErrorException.new(
|
|
1513
1541
|
'We don\'t support that media type. If a request body is required,' \
|
|
1514
1542
|
' please send it to us as `application/json`.',
|
|
1515
1543
|
_response
|
|
1516
1544
|
)
|
|
1517
|
-
|
|
1518
|
-
raise
|
|
1545
|
+
when 429
|
|
1546
|
+
raise ApiErrorException.new(
|
|
1519
1547
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1520
1548
|
' slow your request rate down and try again.',
|
|
1521
1549
|
_response
|
|
1522
1550
|
)
|
|
1523
|
-
|
|
1524
|
-
raise
|
|
1551
|
+
when 500
|
|
1552
|
+
raise ApiErrorException.new(
|
|
1525
1553
|
'Something unexpected happened. Please try again.',
|
|
1526
1554
|
_response
|
|
1527
1555
|
)
|
|
@@ -1531,18 +1559,18 @@ module Voice
|
|
|
1531
1559
|
# Return appropriate response type.
|
|
1532
1560
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1533
1561
|
ApiResponse.new(
|
|
1534
|
-
_response, data:
|
|
1562
|
+
_response, data: CallRecordingMetadata.from_hash(decoded)
|
|
1535
1563
|
)
|
|
1536
1564
|
end
|
|
1537
1565
|
|
|
1538
|
-
# Downloads the specified recording
|
|
1566
|
+
# Downloads the specified recording.
|
|
1539
1567
|
# @param [String] account_id Required parameter: Example:
|
|
1540
1568
|
# @param [String] conference_id Required parameter: Example:
|
|
1541
1569
|
# @param [String] recording_id Required parameter: Example:
|
|
1542
|
-
# @return [
|
|
1543
|
-
def
|
|
1544
|
-
|
|
1545
|
-
|
|
1570
|
+
# @return [Mixed] response from the API call
|
|
1571
|
+
def get_download_conference_recording(account_id,
|
|
1572
|
+
conference_id,
|
|
1573
|
+
recording_id)
|
|
1546
1574
|
# Prepare query url.
|
|
1547
1575
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1548
1576
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
|
|
@@ -1554,50 +1582,57 @@ module Voice
|
|
|
1554
1582
|
)
|
|
1555
1583
|
_query_url = APIHelper.clean_url _query_builder
|
|
1556
1584
|
|
|
1585
|
+
# Prepare headers.
|
|
1586
|
+
_headers = {
|
|
1587
|
+
'accept' => 'application/json'
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1557
1590
|
# Prepare and execute HttpRequest.
|
|
1558
1591
|
_request = config.http_client.get(
|
|
1559
|
-
_query_url
|
|
1592
|
+
_query_url,
|
|
1593
|
+
headers: _headers
|
|
1560
1594
|
)
|
|
1561
1595
|
VoiceBasicAuth.apply(config, _request)
|
|
1562
|
-
_response = execute_request(_request
|
|
1596
|
+
_response = execute_request(_request)
|
|
1563
1597
|
|
|
1564
1598
|
# Validate response against endpoint and global error codes.
|
|
1565
|
-
|
|
1566
|
-
|
|
1599
|
+
case _response.status_code
|
|
1600
|
+
when 400
|
|
1601
|
+
raise ApiErrorException.new(
|
|
1567
1602
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1568
1603
|
' fix it before trying again.',
|
|
1569
1604
|
_response
|
|
1570
1605
|
)
|
|
1571
|
-
|
|
1606
|
+
when 401
|
|
1572
1607
|
raise APIException.new(
|
|
1573
1608
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1574
1609
|
' credentials to authenticate to the API.',
|
|
1575
1610
|
_response
|
|
1576
1611
|
)
|
|
1577
|
-
|
|
1578
|
-
raise
|
|
1612
|
+
when 403
|
|
1613
|
+
raise ApiErrorException.new(
|
|
1579
1614
|
'User unauthorized to perform this action.',
|
|
1580
1615
|
_response
|
|
1581
1616
|
)
|
|
1582
|
-
|
|
1583
|
-
raise
|
|
1617
|
+
when 404
|
|
1618
|
+
raise ApiErrorException.new(
|
|
1584
1619
|
'The resource specified cannot be found or does not belong to you.',
|
|
1585
1620
|
_response
|
|
1586
1621
|
)
|
|
1587
|
-
|
|
1588
|
-
raise
|
|
1622
|
+
when 415
|
|
1623
|
+
raise ApiErrorException.new(
|
|
1589
1624
|
'We don\'t support that media type. If a request body is required,' \
|
|
1590
1625
|
' please send it to us as `application/json`.',
|
|
1591
1626
|
_response
|
|
1592
1627
|
)
|
|
1593
|
-
|
|
1594
|
-
raise
|
|
1628
|
+
when 429
|
|
1629
|
+
raise ApiErrorException.new(
|
|
1595
1630
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1596
1631
|
' slow your request rate down and try again.',
|
|
1597
1632
|
_response
|
|
1598
1633
|
)
|
|
1599
|
-
|
|
1600
|
-
raise
|
|
1634
|
+
when 500
|
|
1635
|
+
raise ApiErrorException.new(
|
|
1601
1636
|
'Something unexpected happened. Please try again.',
|
|
1602
1637
|
_response
|
|
1603
1638
|
)
|
|
@@ -1605,8 +1640,11 @@ module Voice
|
|
|
1605
1640
|
validate_response(_response)
|
|
1606
1641
|
|
|
1607
1642
|
# Return appropriate response type.
|
|
1643
|
+
decoded = APIHelper.json_deserialize(_response.raw_body) unless
|
|
1644
|
+
_response.raw_body.nil? ||
|
|
1645
|
+
_response.raw_body.to_s.strip.empty?
|
|
1608
1646
|
ApiResponse.new(
|
|
1609
|
-
_response, data:
|
|
1647
|
+
_response, data: decoded
|
|
1610
1648
|
)
|
|
1611
1649
|
end
|
|
1612
1650
|
|
|
@@ -1619,12 +1657,12 @@ module Voice
|
|
|
1619
1657
|
# @param [String] to Optional parameter: Example:
|
|
1620
1658
|
# @param [String] min_start_time Optional parameter: Example:
|
|
1621
1659
|
# @param [String] max_start_time Optional parameter: Example:
|
|
1622
|
-
# @return [List of
|
|
1623
|
-
def
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1660
|
+
# @return [List of CallRecordingMetadata] response from the API call
|
|
1661
|
+
def get_query_call_recordings(account_id,
|
|
1662
|
+
from: nil,
|
|
1663
|
+
to: nil,
|
|
1664
|
+
min_start_time: nil,
|
|
1665
|
+
max_start_time: nil)
|
|
1628
1666
|
# Prepare query url.
|
|
1629
1667
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
|
1630
1668
|
_query_builder << '/api/v2/accounts/{accountId}/recordings'
|
|
@@ -1655,42 +1693,43 @@ module Voice
|
|
|
1655
1693
|
_response = execute_request(_request)
|
|
1656
1694
|
|
|
1657
1695
|
# Validate response against endpoint and global error codes.
|
|
1658
|
-
|
|
1659
|
-
|
|
1696
|
+
case _response.status_code
|
|
1697
|
+
when 400
|
|
1698
|
+
raise ApiErrorException.new(
|
|
1660
1699
|
'Something\'s not quite right... Your request is invalid. Please' \
|
|
1661
1700
|
' fix it before trying again.',
|
|
1662
1701
|
_response
|
|
1663
1702
|
)
|
|
1664
|
-
|
|
1703
|
+
when 401
|
|
1665
1704
|
raise APIException.new(
|
|
1666
1705
|
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
|
1667
1706
|
' credentials to authenticate to the API.',
|
|
1668
1707
|
_response
|
|
1669
1708
|
)
|
|
1670
|
-
|
|
1671
|
-
raise
|
|
1709
|
+
when 403
|
|
1710
|
+
raise ApiErrorException.new(
|
|
1672
1711
|
'User unauthorized to perform this action.',
|
|
1673
1712
|
_response
|
|
1674
1713
|
)
|
|
1675
|
-
|
|
1676
|
-
raise
|
|
1714
|
+
when 404
|
|
1715
|
+
raise ApiErrorException.new(
|
|
1677
1716
|
'The resource specified cannot be found or does not belong to you.',
|
|
1678
1717
|
_response
|
|
1679
1718
|
)
|
|
1680
|
-
|
|
1681
|
-
raise
|
|
1719
|
+
when 415
|
|
1720
|
+
raise ApiErrorException.new(
|
|
1682
1721
|
'We don\'t support that media type. If a request body is required,' \
|
|
1683
1722
|
' please send it to us as `application/json`.',
|
|
1684
1723
|
_response
|
|
1685
1724
|
)
|
|
1686
|
-
|
|
1687
|
-
raise
|
|
1725
|
+
when 429
|
|
1726
|
+
raise ApiErrorException.new(
|
|
1688
1727
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
|
1689
1728
|
' slow your request rate down and try again.',
|
|
1690
1729
|
_response
|
|
1691
1730
|
)
|
|
1692
|
-
|
|
1693
|
-
raise
|
|
1731
|
+
when 500
|
|
1732
|
+
raise ApiErrorException.new(
|
|
1694
1733
|
'Something unexpected happened. Please try again.',
|
|
1695
1734
|
_response
|
|
1696
1735
|
)
|
|
@@ -1701,7 +1740,7 @@ module Voice
|
|
|
1701
1740
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
|
1702
1741
|
ApiResponse.new(
|
|
1703
1742
|
_response,
|
|
1704
|
-
data: decoded.map { |element|
|
|
1743
|
+
data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
|
|
1705
1744
|
)
|
|
1706
1745
|
end
|
|
1707
1746
|
end
|