bandwidth-sdk 5.0.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -13
- data/lib/bandwidth.rb +5 -2
- data/lib/bandwidth/api_helper.rb +5 -17
- data/lib/bandwidth/client.rb +23 -9
- data/lib/bandwidth/configuration.rb +54 -18
- data/lib/bandwidth/http/auth/{two_factor_auth_basic_auth.rb → multi_factor_auth_basic_auth.rb} +3 -3
- data/lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb +22 -0
- data/lib/bandwidth/http/faraday_client.rb +5 -2
- data/lib/bandwidth/messaging_lib/messaging.rb +1 -0
- data/lib/bandwidth/messaging_lib/messaging/client.rb +14 -5
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +25 -29
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +11 -2
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +47 -2
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +5 -75
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +13 -2
- data/lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb +19 -0
- data/lib/bandwidth/models/base_model.rb +19 -8
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +23 -0
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/client.rb +60 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/base_controller.rb +0 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb → multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb} +69 -18
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +34 -0
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +29 -0
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +29 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_code_request_schema.rb +0 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_messaging_response.rb +0 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_code_response.rb +0 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_request_schema.rb +0 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_voice_response.rb +0 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb +20 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → phone_number_lookup_lib/phone_number_lookup}/client.rb +15 -6
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +1551 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +49 -0
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb → phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb} +5 -5
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +35 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +45 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +74 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +107 -0
- data/lib/bandwidth/utilities/date_time_helper.rb +156 -0
- data/lib/bandwidth/voice_lib/voice.rb +14 -18
- data/lib/bandwidth/voice_lib/voice/client.rb +14 -5
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +248 -230
- data/lib/bandwidth/voice_lib/voice/exceptions/{api_error_response_exception.rb → api_error_exception.rb} +2 -2
- data/lib/bandwidth/voice_lib/voice/models/{recording_metadata_response.rb → call_recording_metadata.rb} +47 -28
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +232 -0
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +2 -20
- 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} +8 -8
- data/lib/bandwidth/voice_lib/voice/models/{conference_recording_metadata_response.rb → conference_recording_metadata.rb} +34 -18
- data/lib/bandwidth/voice_lib/voice/models/{conference_detail.rb → conference_state.rb} +22 -14
- data/lib/bandwidth/voice_lib/voice/models/{api_create_call_request.rb → create_call_request.rb} +35 -59
- data/lib/bandwidth/voice_lib/voice/models/{api_call_response.rb → create_call_response.rb} +28 -23
- data/lib/bandwidth/voice_lib/voice/models/{modify_call_recording_state.rb → modify_call_recording_request.rb} +4 -4
- data/lib/bandwidth/voice_lib/voice/models/{api_modify_call_request.rb → modify_call_request.rb} +25 -25
- data/lib/bandwidth/voice_lib/voice/models/{api_modify_conference_request.rb → modify_conference_request.rb} +11 -11
- 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/{api_transcribe_recording_request.rb → transcribe_recording_request.rb} +8 -8
- data/lib/bandwidth/voice_lib/voice/models/{transcription.rb → transcription_metadata.rb} +19 -10
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +1 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +14 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +14 -14
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/device_api_version_enum.rb +17 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +11 -2
- data/test/integration/test_integration.rb +583 -0
- metadata +47 -35
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +0 -164
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +0 -47
- 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
@@ -7,39 +7,35 @@
|
|
7
7
|
require_relative 'voice/client.rb'
|
8
8
|
|
9
9
|
# Models
|
10
|
-
require_relative 'voice/models/
|
11
|
-
require_relative 'voice/models/
|
12
|
-
require_relative 'voice/models/
|
13
|
-
require_relative 'voice/models/
|
14
|
-
require_relative 'voice/models/
|
15
|
-
require_relative 'voice/models/
|
16
|
-
require_relative 'voice/models/
|
17
|
-
require_relative 'voice/models/
|
18
|
-
require_relative 'voice/models/
|
19
|
-
require_relative 'voice/models/
|
20
|
-
require_relative 'voice/models/
|
21
|
-
require_relative 'voice/models/transcript.rb'
|
22
|
-
require_relative 'voice/models/transcription.rb'
|
10
|
+
require_relative 'voice/models/create_call_request.rb'
|
11
|
+
require_relative 'voice/models/create_call_response.rb'
|
12
|
+
require_relative 'voice/models/call_state.rb'
|
13
|
+
require_relative 'voice/models/modify_call_request.rb'
|
14
|
+
require_relative 'voice/models/modify_call_recording_request.rb'
|
15
|
+
require_relative 'voice/models/call_recording_metadata.rb'
|
16
|
+
require_relative 'voice/models/modify_conference_request.rb'
|
17
|
+
require_relative 'voice/models/conference_state.rb'
|
18
|
+
require_relative 'voice/models/conference_member_state.rb'
|
19
|
+
require_relative 'voice/models/conference_recording_metadata.rb'
|
20
|
+
require_relative 'voice/models/transcribe_recording_request.rb'
|
23
21
|
require_relative 'voice/models/transcription_response.rb'
|
22
|
+
require_relative 'voice/models/transcription_metadata.rb'
|
23
|
+
require_relative 'voice/models/transcript.rb'
|
24
24
|
require_relative 'voice/models/answer_fallback_method_enum.rb'
|
25
25
|
require_relative 'voice/models/answer_method_enum.rb'
|
26
26
|
require_relative 'voice/models/callback_method_enum.rb'
|
27
27
|
require_relative 'voice/models/conference_event_method_enum.rb'
|
28
28
|
require_relative 'voice/models/direction_enum.rb'
|
29
|
-
require_relative 'voice/models/disconnect_cause_enum.rb'
|
30
29
|
require_relative 'voice/models/disconnect_method_enum.rb'
|
31
30
|
require_relative 'voice/models/file_format_enum.rb'
|
32
31
|
require_relative 'voice/models/redirect_fallback_method_enum.rb'
|
33
32
|
require_relative 'voice/models/redirect_method_enum.rb'
|
34
33
|
require_relative 'voice/models/state_enum.rb'
|
35
34
|
require_relative 'voice/models/state1_enum.rb'
|
36
|
-
require_relative 'voice/models/state2_enum.rb'
|
37
35
|
require_relative 'voice/models/status_enum.rb'
|
38
|
-
require_relative 'voice/models/status1_enum.rb'
|
39
|
-
require_relative 'voice/models/status3_enum.rb'
|
40
36
|
|
41
37
|
# Exceptions
|
42
|
-
require_relative 'voice/exceptions/
|
38
|
+
require_relative 'voice/exceptions/api_error_exception.rb'
|
43
39
|
# Controllers
|
44
40
|
require_relative 'voice/controllers/base_controller.rb'
|
45
41
|
require_relative 'voice/controllers/api_controller.rb'
|
@@ -16,12 +16,17 @@ module Bandwidth
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
19
|
-
backoff_factor:
|
19
|
+
backoff_factor: 2,
|
20
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
21
|
+
retry_methods: %i[get put get put],
|
22
|
+
environment: Environment::PRODUCTION,
|
20
23
|
base_url: 'https://www.example.com',
|
21
24
|
messaging_basic_auth_user_name: 'TODO: Replace',
|
22
25
|
messaging_basic_auth_password: 'TODO: Replace',
|
23
|
-
|
24
|
-
|
26
|
+
multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
27
|
+
multi_factor_auth_basic_auth_password: 'TODO: Replace',
|
28
|
+
phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
|
29
|
+
phone_number_lookup_basic_auth_password: 'TODO: Replace',
|
25
30
|
voice_basic_auth_user_name: 'TODO: Replace',
|
26
31
|
voice_basic_auth_password: 'TODO: Replace',
|
27
32
|
web_rtc_basic_auth_user_name: 'TODO: Replace',
|
@@ -32,12 +37,16 @@ module Bandwidth
|
|
32
37
|
max_retries: max_retries,
|
33
38
|
retry_interval: retry_interval,
|
34
39
|
backoff_factor: backoff_factor,
|
40
|
+
retry_statuses: retry_statuses,
|
41
|
+
retry_methods: retry_methods,
|
35
42
|
environment: environment,
|
36
43
|
base_url: base_url,
|
37
44
|
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
|
38
45
|
messaging_basic_auth_password: messaging_basic_auth_password,
|
39
|
-
|
40
|
-
|
46
|
+
multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
|
47
|
+
multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
|
48
|
+
phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
|
49
|
+
phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
|
41
50
|
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
42
51
|
voice_basic_auth_password: voice_basic_auth_password,
|
43
52
|
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
|
@@ -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 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'
|
@@ -43,7 +43,7 @@ module Voice
|
|
43
43
|
|
44
44
|
# Validate response against endpoint and global error codes.
|
45
45
|
if _response.status_code == 400
|
46
|
-
raise
|
46
|
+
raise ApiErrorException.new(
|
47
47
|
'Something\'s not quite right... Your request is invalid. Please' \
|
48
48
|
' fix it before trying again.',
|
49
49
|
_response
|
@@ -55,29 +55,29 @@ module Voice
|
|
55
55
|
_response
|
56
56
|
)
|
57
57
|
elsif _response.status_code == 403
|
58
|
-
raise
|
58
|
+
raise ApiErrorException.new(
|
59
59
|
'User unauthorized to perform this action.',
|
60
60
|
_response
|
61
61
|
)
|
62
62
|
elsif _response.status_code == 404
|
63
|
-
raise
|
63
|
+
raise ApiErrorException.new(
|
64
64
|
'The resource specified cannot be found or does not belong to you.',
|
65
65
|
_response
|
66
66
|
)
|
67
67
|
elsif _response.status_code == 415
|
68
|
-
raise
|
68
|
+
raise ApiErrorException.new(
|
69
69
|
'We don\'t support that media type. If a request body is required,' \
|
70
70
|
' please send it to us as `application/json`.',
|
71
71
|
_response
|
72
72
|
)
|
73
73
|
elsif _response.status_code == 429
|
74
|
-
raise
|
74
|
+
raise ApiErrorException.new(
|
75
75
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
76
76
|
' slow your request rate down and try again.',
|
77
77
|
_response
|
78
78
|
)
|
79
79
|
elsif _response.status_code == 500
|
80
|
-
raise
|
80
|
+
raise ApiErrorException.new(
|
81
81
|
'Something unexpected happened. Please try again.',
|
82
82
|
_response
|
83
83
|
)
|
@@ -87,16 +87,16 @@ module Voice
|
|
87
87
|
# Return appropriate response type.
|
88
88
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
89
89
|
ApiResponse.new(
|
90
|
-
_response, data:
|
90
|
+
_response, data: CreateCallResponse.from_hash(decoded)
|
91
91
|
)
|
92
92
|
end
|
93
93
|
|
94
|
-
# Returns near-realtime metadata about the specified call
|
94
|
+
# Returns near-realtime metadata about the specified call.
|
95
95
|
# @param [String] account_id Required parameter: Example:
|
96
96
|
# @param [String] call_id Required parameter: Example:
|
97
|
-
# @return [
|
98
|
-
def
|
99
|
-
|
97
|
+
# @return [CallState] response from the API call
|
98
|
+
def get_call(account_id,
|
99
|
+
call_id)
|
100
100
|
# Prepare query url.
|
101
101
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
102
102
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
@@ -122,7 +122,7 @@ module Voice
|
|
122
122
|
|
123
123
|
# Validate response against endpoint and global error codes.
|
124
124
|
if _response.status_code == 400
|
125
|
-
raise
|
125
|
+
raise ApiErrorException.new(
|
126
126
|
'Something\'s not quite right... Your request is invalid. Please' \
|
127
127
|
' fix it before trying again.',
|
128
128
|
_response
|
@@ -134,29 +134,29 @@ module Voice
|
|
134
134
|
_response
|
135
135
|
)
|
136
136
|
elsif _response.status_code == 403
|
137
|
-
raise
|
137
|
+
raise ApiErrorException.new(
|
138
138
|
'User unauthorized to perform this action.',
|
139
139
|
_response
|
140
140
|
)
|
141
141
|
elsif _response.status_code == 404
|
142
|
-
raise
|
142
|
+
raise ApiErrorException.new(
|
143
143
|
'The resource specified cannot be found or does not belong to you.',
|
144
144
|
_response
|
145
145
|
)
|
146
146
|
elsif _response.status_code == 415
|
147
|
-
raise
|
147
|
+
raise ApiErrorException.new(
|
148
148
|
'We don\'t support that media type. If a request body is required,' \
|
149
149
|
' please send it to us as `application/json`.',
|
150
150
|
_response
|
151
151
|
)
|
152
152
|
elsif _response.status_code == 429
|
153
|
-
raise
|
153
|
+
raise ApiErrorException.new(
|
154
154
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
155
155
|
' slow your request rate down and try again.',
|
156
156
|
_response
|
157
157
|
)
|
158
158
|
elsif _response.status_code == 500
|
159
|
-
raise
|
159
|
+
raise ApiErrorException.new(
|
160
160
|
'Something unexpected happened. Please try again.',
|
161
161
|
_response
|
162
162
|
)
|
@@ -166,18 +166,18 @@ module Voice
|
|
166
166
|
# Return appropriate response type.
|
167
167
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
168
168
|
ApiResponse.new(
|
169
|
-
_response, data:
|
169
|
+
_response, data: CallState.from_hash(decoded)
|
170
170
|
)
|
171
171
|
end
|
172
172
|
|
173
|
-
# Interrupts and replaces an active call's BXML document
|
173
|
+
# Interrupts and replaces an active call's BXML document.
|
174
174
|
# @param [String] account_id Required parameter: Example:
|
175
175
|
# @param [String] call_id Required parameter: Example:
|
176
|
-
# @param [
|
176
|
+
# @param [ModifyCallRequest] body Required parameter: Example:
|
177
177
|
# @return [void] response from the API call
|
178
178
|
def modify_call(account_id,
|
179
179
|
call_id,
|
180
|
-
body
|
180
|
+
body)
|
181
181
|
# Prepare query url.
|
182
182
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
183
183
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
@@ -204,7 +204,7 @@ module Voice
|
|
204
204
|
|
205
205
|
# Validate response against endpoint and global error codes.
|
206
206
|
if _response.status_code == 400
|
207
|
-
raise
|
207
|
+
raise ApiErrorException.new(
|
208
208
|
'Something\'s not quite right... Your request is invalid. Please' \
|
209
209
|
' fix it before trying again.',
|
210
210
|
_response
|
@@ -216,29 +216,29 @@ module Voice
|
|
216
216
|
_response
|
217
217
|
)
|
218
218
|
elsif _response.status_code == 403
|
219
|
-
raise
|
219
|
+
raise ApiErrorException.new(
|
220
220
|
'User unauthorized to perform this action.',
|
221
221
|
_response
|
222
222
|
)
|
223
223
|
elsif _response.status_code == 404
|
224
|
-
raise
|
224
|
+
raise ApiErrorException.new(
|
225
225
|
'The resource specified cannot be found or does not belong to you.',
|
226
226
|
_response
|
227
227
|
)
|
228
228
|
elsif _response.status_code == 415
|
229
|
-
raise
|
229
|
+
raise ApiErrorException.new(
|
230
230
|
'We don\'t support that media type. If a request body is required,' \
|
231
231
|
' please send it to us as `application/json`.',
|
232
232
|
_response
|
233
233
|
)
|
234
234
|
elsif _response.status_code == 429
|
235
|
-
raise
|
235
|
+
raise ApiErrorException.new(
|
236
236
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
237
237
|
' slow your request rate down and try again.',
|
238
238
|
_response
|
239
239
|
)
|
240
240
|
elsif _response.status_code == 500
|
241
|
-
raise
|
241
|
+
raise ApiErrorException.new(
|
242
242
|
'Something unexpected happened. Please try again.',
|
243
243
|
_response
|
244
244
|
)
|
@@ -249,14 +249,14 @@ module Voice
|
|
249
249
|
ApiResponse.new(_response)
|
250
250
|
end
|
251
251
|
|
252
|
-
# Pauses or resumes a recording
|
252
|
+
# Pauses or resumes a recording.
|
253
253
|
# @param [String] account_id Required parameter: Example:
|
254
254
|
# @param [String] call_id Required parameter: Example:
|
255
|
-
# @param [
|
255
|
+
# @param [ModifyCallRecordingRequest] body Required parameter: Example:
|
256
256
|
# @return [void] response from the API call
|
257
257
|
def modify_call_recording_state(account_id,
|
258
258
|
call_id,
|
259
|
-
body
|
259
|
+
body)
|
260
260
|
# Prepare query url.
|
261
261
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
262
262
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
|
@@ -283,7 +283,7 @@ module Voice
|
|
283
283
|
|
284
284
|
# Validate response against endpoint and global error codes.
|
285
285
|
if _response.status_code == 400
|
286
|
-
raise
|
286
|
+
raise ApiErrorException.new(
|
287
287
|
'Something\'s not quite right... Your request is invalid. Please' \
|
288
288
|
' fix it before trying again.',
|
289
289
|
_response
|
@@ -295,29 +295,29 @@ module Voice
|
|
295
295
|
_response
|
296
296
|
)
|
297
297
|
elsif _response.status_code == 403
|
298
|
-
raise
|
298
|
+
raise ApiErrorException.new(
|
299
299
|
'User unauthorized to perform this action.',
|
300
300
|
_response
|
301
301
|
)
|
302
302
|
elsif _response.status_code == 404
|
303
|
-
raise
|
303
|
+
raise ApiErrorException.new(
|
304
304
|
'The resource specified cannot be found or does not belong to you.',
|
305
305
|
_response
|
306
306
|
)
|
307
307
|
elsif _response.status_code == 415
|
308
|
-
raise
|
308
|
+
raise ApiErrorException.new(
|
309
309
|
'We don\'t support that media type. If a request body is required,' \
|
310
310
|
' please send it to us as `application/json`.',
|
311
311
|
_response
|
312
312
|
)
|
313
313
|
elsif _response.status_code == 429
|
314
|
-
raise
|
314
|
+
raise ApiErrorException.new(
|
315
315
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
316
316
|
' slow your request rate down and try again.',
|
317
317
|
_response
|
318
318
|
)
|
319
319
|
elsif _response.status_code == 500
|
320
|
-
raise
|
320
|
+
raise ApiErrorException.new(
|
321
321
|
'Something unexpected happened. Please try again.',
|
322
322
|
_response
|
323
323
|
)
|
@@ -332,9 +332,9 @@ 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
|
-
# @return [List of
|
336
|
-
def
|
337
|
-
|
335
|
+
# @return [List of CallRecordingMetadata] response from the API call
|
336
|
+
def get_call_recordings(account_id,
|
337
|
+
call_id)
|
338
338
|
# Prepare query url.
|
339
339
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
340
340
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
|
@@ -360,7 +360,7 @@ module Voice
|
|
360
360
|
|
361
361
|
# Validate response against endpoint and global error codes.
|
362
362
|
if _response.status_code == 400
|
363
|
-
raise
|
363
|
+
raise ApiErrorException.new(
|
364
364
|
'Something\'s not quite right... Your request is invalid. Please' \
|
365
365
|
' fix it before trying again.',
|
366
366
|
_response
|
@@ -372,29 +372,29 @@ module Voice
|
|
372
372
|
_response
|
373
373
|
)
|
374
374
|
elsif _response.status_code == 403
|
375
|
-
raise
|
375
|
+
raise ApiErrorException.new(
|
376
376
|
'User unauthorized to perform this action.',
|
377
377
|
_response
|
378
378
|
)
|
379
379
|
elsif _response.status_code == 404
|
380
|
-
raise
|
380
|
+
raise ApiErrorException.new(
|
381
381
|
'The resource specified cannot be found or does not belong to you.',
|
382
382
|
_response
|
383
383
|
)
|
384
384
|
elsif _response.status_code == 415
|
385
|
-
raise
|
385
|
+
raise ApiErrorException.new(
|
386
386
|
'We don\'t support that media type. If a request body is required,' \
|
387
387
|
' please send it to us as `application/json`.',
|
388
388
|
_response
|
389
389
|
)
|
390
390
|
elsif _response.status_code == 429
|
391
|
-
raise
|
391
|
+
raise ApiErrorException.new(
|
392
392
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
393
393
|
' slow your request rate down and try again.',
|
394
394
|
_response
|
395
395
|
)
|
396
396
|
elsif _response.status_code == 500
|
397
|
-
raise
|
397
|
+
raise ApiErrorException.new(
|
398
398
|
'Something unexpected happened. Please try again.',
|
399
399
|
_response
|
400
400
|
)
|
@@ -405,18 +405,18 @@ module Voice
|
|
405
405
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
406
406
|
ApiResponse.new(
|
407
407
|
_response,
|
408
|
-
data: decoded.map { |element|
|
408
|
+
data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
|
409
409
|
)
|
410
410
|
end
|
411
411
|
|
412
|
-
# Returns metadata for the specified recording
|
412
|
+
# Returns metadata for the specified recording.
|
413
413
|
# @param [String] account_id Required parameter: Example:
|
414
414
|
# @param [String] call_id Required parameter: Example:
|
415
415
|
# @param [String] recording_id Required parameter: Example:
|
416
|
-
# @return [
|
417
|
-
def
|
418
|
-
|
419
|
-
|
416
|
+
# @return [CallRecordingMetadata] response from the API call
|
417
|
+
def get_call_recording(account_id,
|
418
|
+
call_id,
|
419
|
+
recording_id)
|
420
420
|
# Prepare query url.
|
421
421
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
422
422
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
@@ -443,7 +443,7 @@ module Voice
|
|
443
443
|
|
444
444
|
# Validate response against endpoint and global error codes.
|
445
445
|
if _response.status_code == 400
|
446
|
-
raise
|
446
|
+
raise ApiErrorException.new(
|
447
447
|
'Something\'s not quite right... Your request is invalid. Please' \
|
448
448
|
' fix it before trying again.',
|
449
449
|
_response
|
@@ -455,29 +455,29 @@ module Voice
|
|
455
455
|
_response
|
456
456
|
)
|
457
457
|
elsif _response.status_code == 403
|
458
|
-
raise
|
458
|
+
raise ApiErrorException.new(
|
459
459
|
'User unauthorized to perform this action.',
|
460
460
|
_response
|
461
461
|
)
|
462
462
|
elsif _response.status_code == 404
|
463
|
-
raise
|
463
|
+
raise ApiErrorException.new(
|
464
464
|
'The resource specified cannot be found or does not belong to you.',
|
465
465
|
_response
|
466
466
|
)
|
467
467
|
elsif _response.status_code == 415
|
468
|
-
raise
|
468
|
+
raise ApiErrorException.new(
|
469
469
|
'We don\'t support that media type. If a request body is required,' \
|
470
470
|
' please send it to us as `application/json`.',
|
471
471
|
_response
|
472
472
|
)
|
473
473
|
elsif _response.status_code == 429
|
474
|
-
raise
|
474
|
+
raise ApiErrorException.new(
|
475
475
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
476
476
|
' slow your request rate down and try again.',
|
477
477
|
_response
|
478
478
|
)
|
479
479
|
elsif _response.status_code == 500
|
480
|
-
raise
|
480
|
+
raise ApiErrorException.new(
|
481
481
|
'Something unexpected happened. Please try again.',
|
482
482
|
_response
|
483
483
|
)
|
@@ -487,11 +487,11 @@ module Voice
|
|
487
487
|
# Return appropriate response type.
|
488
488
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
489
489
|
ApiResponse.new(
|
490
|
-
_response, data:
|
490
|
+
_response, data: CallRecordingMetadata.from_hash(decoded)
|
491
491
|
)
|
492
492
|
end
|
493
493
|
|
494
|
-
# Deletes the specified recording
|
494
|
+
# Deletes the specified recording.
|
495
495
|
# @param [String] account_id Required parameter: Example:
|
496
496
|
# @param [String] call_id Required parameter: Example:
|
497
497
|
# @param [String] recording_id Required parameter: Example:
|
@@ -519,7 +519,7 @@ module Voice
|
|
519
519
|
|
520
520
|
# Validate response against endpoint and global error codes.
|
521
521
|
if _response.status_code == 400
|
522
|
-
raise
|
522
|
+
raise ApiErrorException.new(
|
523
523
|
'Something\'s not quite right... Your request is invalid. Please' \
|
524
524
|
' fix it before trying again.',
|
525
525
|
_response
|
@@ -531,29 +531,29 @@ module Voice
|
|
531
531
|
_response
|
532
532
|
)
|
533
533
|
elsif _response.status_code == 403
|
534
|
-
raise
|
534
|
+
raise ApiErrorException.new(
|
535
535
|
'User unauthorized to perform this action.',
|
536
536
|
_response
|
537
537
|
)
|
538
538
|
elsif _response.status_code == 404
|
539
|
-
raise
|
539
|
+
raise ApiErrorException.new(
|
540
540
|
'The resource specified cannot be found or does not belong to you.',
|
541
541
|
_response
|
542
542
|
)
|
543
543
|
elsif _response.status_code == 415
|
544
|
-
raise
|
544
|
+
raise ApiErrorException.new(
|
545
545
|
'We don\'t support that media type. If a request body is required,' \
|
546
546
|
' please send it to us as `application/json`.',
|
547
547
|
_response
|
548
548
|
)
|
549
549
|
elsif _response.status_code == 429
|
550
|
-
raise
|
550
|
+
raise ApiErrorException.new(
|
551
551
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
552
552
|
' slow your request rate down and try again.',
|
553
553
|
_response
|
554
554
|
)
|
555
555
|
elsif _response.status_code == 500
|
556
|
-
raise
|
556
|
+
raise ApiErrorException.new(
|
557
557
|
'Something unexpected happened. Please try again.',
|
558
558
|
_response
|
559
559
|
)
|
@@ -564,14 +564,14 @@ module Voice
|
|
564
564
|
ApiResponse.new(_response)
|
565
565
|
end
|
566
566
|
|
567
|
-
# Downloads the specified recording
|
567
|
+
# Downloads the specified recording.
|
568
568
|
# @param [String] account_id Required parameter: Example:
|
569
569
|
# @param [String] call_id Required parameter: Example:
|
570
570
|
# @param [String] recording_id Required parameter: Example:
|
571
|
-
# @return [
|
572
|
-
def
|
573
|
-
|
574
|
-
|
571
|
+
# @return [Mixed] response from the API call
|
572
|
+
def get_download_call_recording(account_id,
|
573
|
+
call_id,
|
574
|
+
recording_id)
|
575
575
|
# Prepare query url.
|
576
576
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
577
577
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
@@ -583,16 +583,22 @@ module Voice
|
|
583
583
|
)
|
584
584
|
_query_url = APIHelper.clean_url _query_builder
|
585
585
|
|
586
|
+
# Prepare headers.
|
587
|
+
_headers = {
|
588
|
+
'accept' => 'application/json'
|
589
|
+
}
|
590
|
+
|
586
591
|
# Prepare and execute HttpRequest.
|
587
592
|
_request = config.http_client.get(
|
588
|
-
_query_url
|
593
|
+
_query_url,
|
594
|
+
headers: _headers
|
589
595
|
)
|
590
596
|
VoiceBasicAuth.apply(config, _request)
|
591
|
-
_response = execute_request(_request
|
597
|
+
_response = execute_request(_request)
|
592
598
|
|
593
599
|
# Validate response against endpoint and global error codes.
|
594
600
|
if _response.status_code == 400
|
595
|
-
raise
|
601
|
+
raise ApiErrorException.new(
|
596
602
|
'Something\'s not quite right... Your request is invalid. Please' \
|
597
603
|
' fix it before trying again.',
|
598
604
|
_response
|
@@ -604,29 +610,29 @@ module Voice
|
|
604
610
|
_response
|
605
611
|
)
|
606
612
|
elsif _response.status_code == 403
|
607
|
-
raise
|
613
|
+
raise ApiErrorException.new(
|
608
614
|
'User unauthorized to perform this action.',
|
609
615
|
_response
|
610
616
|
)
|
611
617
|
elsif _response.status_code == 404
|
612
|
-
raise
|
618
|
+
raise ApiErrorException.new(
|
613
619
|
'The resource specified cannot be found or does not belong to you.',
|
614
620
|
_response
|
615
621
|
)
|
616
622
|
elsif _response.status_code == 415
|
617
|
-
raise
|
623
|
+
raise ApiErrorException.new(
|
618
624
|
'We don\'t support that media type. If a request body is required,' \
|
619
625
|
' please send it to us as `application/json`.',
|
620
626
|
_response
|
621
627
|
)
|
622
628
|
elsif _response.status_code == 429
|
623
|
-
raise
|
629
|
+
raise ApiErrorException.new(
|
624
630
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
625
631
|
' slow your request rate down and try again.',
|
626
632
|
_response
|
627
633
|
)
|
628
634
|
elsif _response.status_code == 500
|
629
|
-
raise
|
635
|
+
raise ApiErrorException.new(
|
630
636
|
'Something unexpected happened. Please try again.',
|
631
637
|
_response
|
632
638
|
)
|
@@ -634,12 +640,15 @@ module Voice
|
|
634
640
|
validate_response(_response)
|
635
641
|
|
636
642
|
# Return appropriate response type.
|
643
|
+
decoded = APIHelper.json_deserialize(_response.raw_body) unless
|
644
|
+
_response.raw_body.nil? ||
|
645
|
+
_response.raw_body.to_s.strip.empty?
|
637
646
|
ApiResponse.new(
|
638
|
-
_response, data:
|
647
|
+
_response, data: decoded
|
639
648
|
)
|
640
649
|
end
|
641
650
|
|
642
|
-
# Deletes the specified recording's media
|
651
|
+
# Deletes the specified recording's media.
|
643
652
|
# @param [String] account_id Required parameter: Example:
|
644
653
|
# @param [String] call_id Required parameter: Example:
|
645
654
|
# @param [String] recording_id Required parameter: Example:
|
@@ -667,7 +676,7 @@ module Voice
|
|
667
676
|
|
668
677
|
# Validate response against endpoint and global error codes.
|
669
678
|
if _response.status_code == 400
|
670
|
-
raise
|
679
|
+
raise ApiErrorException.new(
|
671
680
|
'Something\'s not quite right... Your request is invalid. Please' \
|
672
681
|
' fix it before trying again.',
|
673
682
|
_response
|
@@ -679,29 +688,29 @@ module Voice
|
|
679
688
|
_response
|
680
689
|
)
|
681
690
|
elsif _response.status_code == 403
|
682
|
-
raise
|
691
|
+
raise ApiErrorException.new(
|
683
692
|
'User unauthorized to perform this action.',
|
684
693
|
_response
|
685
694
|
)
|
686
695
|
elsif _response.status_code == 404
|
687
|
-
raise
|
696
|
+
raise ApiErrorException.new(
|
688
697
|
'The resource specified cannot be found or does not belong to you.',
|
689
698
|
_response
|
690
699
|
)
|
691
700
|
elsif _response.status_code == 415
|
692
|
-
raise
|
701
|
+
raise ApiErrorException.new(
|
693
702
|
'We don\'t support that media type. If a request body is required,' \
|
694
703
|
' please send it to us as `application/json`.',
|
695
704
|
_response
|
696
705
|
)
|
697
706
|
elsif _response.status_code == 429
|
698
|
-
raise
|
707
|
+
raise ApiErrorException.new(
|
699
708
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
700
709
|
' slow your request rate down and try again.',
|
701
710
|
_response
|
702
711
|
)
|
703
712
|
elsif _response.status_code == 500
|
704
|
-
raise
|
713
|
+
raise ApiErrorException.new(
|
705
714
|
'Something unexpected happened. Please try again.',
|
706
715
|
_response
|
707
716
|
)
|
@@ -712,14 +721,14 @@ module Voice
|
|
712
721
|
ApiResponse.new(_response)
|
713
722
|
end
|
714
723
|
|
715
|
-
# Downloads the specified transcription
|
724
|
+
# Downloads the specified transcription.
|
716
725
|
# @param [String] account_id Required parameter: Example:
|
717
726
|
# @param [String] call_id Required parameter: Example:
|
718
727
|
# @param [String] recording_id Required parameter: Example:
|
719
728
|
# @return [TranscriptionResponse] response from the API call
|
720
|
-
def
|
721
|
-
|
722
|
-
|
729
|
+
def get_call_transcription(account_id,
|
730
|
+
call_id,
|
731
|
+
recording_id)
|
723
732
|
# Prepare query url.
|
724
733
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
725
734
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
@@ -746,7 +755,7 @@ module Voice
|
|
746
755
|
|
747
756
|
# Validate response against endpoint and global error codes.
|
748
757
|
if _response.status_code == 400
|
749
|
-
raise
|
758
|
+
raise ApiErrorException.new(
|
750
759
|
'Something\'s not quite right... Your request is invalid. Please' \
|
751
760
|
' fix it before trying again.',
|
752
761
|
_response
|
@@ -758,29 +767,29 @@ module Voice
|
|
758
767
|
_response
|
759
768
|
)
|
760
769
|
elsif _response.status_code == 403
|
761
|
-
raise
|
770
|
+
raise ApiErrorException.new(
|
762
771
|
'User unauthorized to perform this action.',
|
763
772
|
_response
|
764
773
|
)
|
765
774
|
elsif _response.status_code == 404
|
766
|
-
raise
|
775
|
+
raise ApiErrorException.new(
|
767
776
|
'The resource specified cannot be found or does not belong to you.',
|
768
777
|
_response
|
769
778
|
)
|
770
779
|
elsif _response.status_code == 415
|
771
|
-
raise
|
780
|
+
raise ApiErrorException.new(
|
772
781
|
'We don\'t support that media type. If a request body is required,' \
|
773
782
|
' please send it to us as `application/json`.',
|
774
783
|
_response
|
775
784
|
)
|
776
785
|
elsif _response.status_code == 429
|
777
|
-
raise
|
786
|
+
raise ApiErrorException.new(
|
778
787
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
779
788
|
' slow your request rate down and try again.',
|
780
789
|
_response
|
781
790
|
)
|
782
791
|
elsif _response.status_code == 500
|
783
|
-
raise
|
792
|
+
raise ApiErrorException.new(
|
784
793
|
'Something unexpected happened. Please try again.',
|
785
794
|
_response
|
786
795
|
)
|
@@ -794,16 +803,16 @@ module Voice
|
|
794
803
|
)
|
795
804
|
end
|
796
805
|
|
797
|
-
# Requests that the specified recording be transcribed
|
806
|
+
# Requests that the specified recording be transcribed.
|
798
807
|
# @param [String] account_id Required parameter: Example:
|
799
808
|
# @param [String] call_id Required parameter: Example:
|
800
809
|
# @param [String] recording_id Required parameter: Example:
|
801
|
-
# @param [
|
810
|
+
# @param [TranscribeRecordingRequest] body Required parameter: Example:
|
802
811
|
# @return [void] response from the API call
|
803
|
-
def
|
804
|
-
|
805
|
-
|
806
|
-
|
812
|
+
def create_transcribe_call_recording(account_id,
|
813
|
+
call_id,
|
814
|
+
recording_id,
|
815
|
+
body)
|
807
816
|
# Prepare query url.
|
808
817
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
809
818
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
@@ -831,7 +840,7 @@ module Voice
|
|
831
840
|
|
832
841
|
# Validate response against endpoint and global error codes.
|
833
842
|
if _response.status_code == 400
|
834
|
-
raise
|
843
|
+
raise ApiErrorException.new(
|
835
844
|
'Something\'s not quite right... Your request is invalid. Please' \
|
836
845
|
' fix it before trying again.',
|
837
846
|
_response
|
@@ -843,35 +852,35 @@ module Voice
|
|
843
852
|
_response
|
844
853
|
)
|
845
854
|
elsif _response.status_code == 403
|
846
|
-
raise
|
855
|
+
raise ApiErrorException.new(
|
847
856
|
'User unauthorized to perform this action.',
|
848
857
|
_response
|
849
858
|
)
|
850
859
|
elsif _response.status_code == 404
|
851
|
-
raise
|
860
|
+
raise ApiErrorException.new(
|
852
861
|
'The resource specified cannot be found or does not belong to you.',
|
853
862
|
_response
|
854
863
|
)
|
855
864
|
elsif _response.status_code == 410
|
856
|
-
raise
|
865
|
+
raise ApiErrorException.new(
|
857
866
|
'The media for this recording has been deleted, so we can\'t' \
|
858
867
|
' transcribe it',
|
859
868
|
_response
|
860
869
|
)
|
861
870
|
elsif _response.status_code == 415
|
862
|
-
raise
|
871
|
+
raise ApiErrorException.new(
|
863
872
|
'We don\'t support that media type. If a request body is required,' \
|
864
873
|
' please send it to us as `application/json`.',
|
865
874
|
_response
|
866
875
|
)
|
867
876
|
elsif _response.status_code == 429
|
868
|
-
raise
|
877
|
+
raise ApiErrorException.new(
|
869
878
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
870
879
|
' slow your request rate down and try again.',
|
871
880
|
_response
|
872
881
|
)
|
873
882
|
elsif _response.status_code == 500
|
874
|
-
raise
|
883
|
+
raise ApiErrorException.new(
|
875
884
|
'Something unexpected happened. Please try again.',
|
876
885
|
_response
|
877
886
|
)
|
@@ -882,14 +891,14 @@ module Voice
|
|
882
891
|
ApiResponse.new(_response)
|
883
892
|
end
|
884
893
|
|
885
|
-
# Deletes the specified recording's transcription
|
894
|
+
# Deletes the specified recording's transcription.
|
886
895
|
# @param [String] account_id Required parameter: Example:
|
887
896
|
# @param [String] call_id Required parameter: Example:
|
888
897
|
# @param [String] recording_id Required parameter: Example:
|
889
898
|
# @return [void] response from the API call
|
890
|
-
def
|
891
|
-
|
892
|
-
|
899
|
+
def delete_call_transcription(account_id,
|
900
|
+
call_id,
|
901
|
+
recording_id)
|
893
902
|
# Prepare query url.
|
894
903
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
895
904
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
@@ -910,7 +919,7 @@ module Voice
|
|
910
919
|
|
911
920
|
# Validate response against endpoint and global error codes.
|
912
921
|
if _response.status_code == 400
|
913
|
-
raise
|
922
|
+
raise ApiErrorException.new(
|
914
923
|
'Something\'s not quite right... Your request is invalid. Please' \
|
915
924
|
' fix it before trying again.',
|
916
925
|
_response
|
@@ -922,29 +931,29 @@ module Voice
|
|
922
931
|
_response
|
923
932
|
)
|
924
933
|
elsif _response.status_code == 403
|
925
|
-
raise
|
934
|
+
raise ApiErrorException.new(
|
926
935
|
'User unauthorized to perform this action.',
|
927
936
|
_response
|
928
937
|
)
|
929
938
|
elsif _response.status_code == 404
|
930
|
-
raise
|
939
|
+
raise ApiErrorException.new(
|
931
940
|
'The resource specified cannot be found or does not belong to you.',
|
932
941
|
_response
|
933
942
|
)
|
934
943
|
elsif _response.status_code == 415
|
935
|
-
raise
|
944
|
+
raise ApiErrorException.new(
|
936
945
|
'We don\'t support that media type. If a request body is required,' \
|
937
946
|
' please send it to us as `application/json`.',
|
938
947
|
_response
|
939
948
|
)
|
940
949
|
elsif _response.status_code == 429
|
941
|
-
raise
|
950
|
+
raise ApiErrorException.new(
|
942
951
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
943
952
|
' slow your request rate down and try again.',
|
944
953
|
_response
|
945
954
|
)
|
946
955
|
elsif _response.status_code == 500
|
947
|
-
raise
|
956
|
+
raise ApiErrorException.new(
|
948
957
|
'Something unexpected happened. Please try again.',
|
949
958
|
_response
|
950
959
|
)
|
@@ -955,20 +964,20 @@ module Voice
|
|
955
964
|
ApiResponse.new(_response)
|
956
965
|
end
|
957
966
|
|
958
|
-
# Returns information about the conferences in the account
|
967
|
+
# Returns information about the conferences in the account.
|
959
968
|
# @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
969
|
# @param [String] name Optional parameter: Example:
|
963
970
|
# @param [String] min_created_time Optional parameter: Example:
|
964
971
|
# @param [String] max_created_time Optional parameter: Example:
|
965
|
-
# @
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
+
# @param [Integer] page_size Optional parameter: Example:1000
|
973
|
+
# @param [String] page_token Optional parameter: Example:
|
974
|
+
# @return [List of ConferenceState] response from the API call
|
975
|
+
def get_conferences(account_id,
|
976
|
+
name: nil,
|
977
|
+
min_created_time: nil,
|
978
|
+
max_created_time: nil,
|
979
|
+
page_size: 1000,
|
980
|
+
page_token: nil)
|
972
981
|
# Prepare query url.
|
973
982
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
974
983
|
_query_builder << '/api/v2/accounts/{accountId}/conferences'
|
@@ -978,11 +987,11 @@ module Voice
|
|
978
987
|
)
|
979
988
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
980
989
|
_query_builder,
|
981
|
-
'pageSize' => page_size,
|
982
|
-
'pageToken' => page_token,
|
983
990
|
'name' => name,
|
984
991
|
'minCreatedTime' => min_created_time,
|
985
|
-
'maxCreatedTime' => max_created_time
|
992
|
+
'maxCreatedTime' => max_created_time,
|
993
|
+
'pageSize' => page_size,
|
994
|
+
'pageToken' => page_token
|
986
995
|
)
|
987
996
|
_query_url = APIHelper.clean_url _query_builder
|
988
997
|
|
@@ -1001,7 +1010,7 @@ module Voice
|
|
1001
1010
|
|
1002
1011
|
# Validate response against endpoint and global error codes.
|
1003
1012
|
if _response.status_code == 400
|
1004
|
-
raise
|
1013
|
+
raise ApiErrorException.new(
|
1005
1014
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1006
1015
|
' fix it before trying again.',
|
1007
1016
|
_response
|
@@ -1013,29 +1022,29 @@ module Voice
|
|
1013
1022
|
_response
|
1014
1023
|
)
|
1015
1024
|
elsif _response.status_code == 403
|
1016
|
-
raise
|
1025
|
+
raise ApiErrorException.new(
|
1017
1026
|
'User unauthorized to perform this action.',
|
1018
1027
|
_response
|
1019
1028
|
)
|
1020
1029
|
elsif _response.status_code == 404
|
1021
|
-
raise
|
1030
|
+
raise ApiErrorException.new(
|
1022
1031
|
'The resource specified cannot be found or does not belong to you.',
|
1023
1032
|
_response
|
1024
1033
|
)
|
1025
1034
|
elsif _response.status_code == 415
|
1026
|
-
raise
|
1035
|
+
raise ApiErrorException.new(
|
1027
1036
|
'We don\'t support that media type. If a request body is required,' \
|
1028
1037
|
' please send it to us as `application/json`.',
|
1029
1038
|
_response
|
1030
1039
|
)
|
1031
1040
|
elsif _response.status_code == 429
|
1032
|
-
raise
|
1041
|
+
raise ApiErrorException.new(
|
1033
1042
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1034
1043
|
' slow your request rate down and try again.',
|
1035
1044
|
_response
|
1036
1045
|
)
|
1037
1046
|
elsif _response.status_code == 500
|
1038
|
-
raise
|
1047
|
+
raise ApiErrorException.new(
|
1039
1048
|
'Something unexpected happened. Please try again.',
|
1040
1049
|
_response
|
1041
1050
|
)
|
@@ -1046,16 +1055,16 @@ module Voice
|
|
1046
1055
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1047
1056
|
ApiResponse.new(
|
1048
1057
|
_response,
|
1049
|
-
data: decoded.map { |element|
|
1058
|
+
data: decoded.map { |element| ConferenceState.from_hash(element) }
|
1050
1059
|
)
|
1051
1060
|
end
|
1052
1061
|
|
1053
|
-
# Returns information about the specified conference
|
1062
|
+
# Returns information about the specified conference.
|
1054
1063
|
# @param [String] account_id Required parameter: Example:
|
1055
1064
|
# @param [String] conference_id Required parameter: Example:
|
1056
|
-
# @return [
|
1057
|
-
def
|
1058
|
-
|
1065
|
+
# @return [ConferenceState] response from the API call
|
1066
|
+
def get_conference(account_id,
|
1067
|
+
conference_id)
|
1059
1068
|
# Prepare query url.
|
1060
1069
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1061
1070
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
@@ -1081,7 +1090,7 @@ module Voice
|
|
1081
1090
|
|
1082
1091
|
# Validate response against endpoint and global error codes.
|
1083
1092
|
if _response.status_code == 400
|
1084
|
-
raise
|
1093
|
+
raise ApiErrorException.new(
|
1085
1094
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1086
1095
|
' fix it before trying again.',
|
1087
1096
|
_response
|
@@ -1093,29 +1102,29 @@ module Voice
|
|
1093
1102
|
_response
|
1094
1103
|
)
|
1095
1104
|
elsif _response.status_code == 403
|
1096
|
-
raise
|
1105
|
+
raise ApiErrorException.new(
|
1097
1106
|
'User unauthorized to perform this action.',
|
1098
1107
|
_response
|
1099
1108
|
)
|
1100
1109
|
elsif _response.status_code == 404
|
1101
|
-
raise
|
1110
|
+
raise ApiErrorException.new(
|
1102
1111
|
'The resource specified cannot be found or does not belong to you.',
|
1103
1112
|
_response
|
1104
1113
|
)
|
1105
1114
|
elsif _response.status_code == 415
|
1106
|
-
raise
|
1115
|
+
raise ApiErrorException.new(
|
1107
1116
|
'We don\'t support that media type. If a request body is required,' \
|
1108
1117
|
' please send it to us as `application/json`.',
|
1109
1118
|
_response
|
1110
1119
|
)
|
1111
1120
|
elsif _response.status_code == 429
|
1112
|
-
raise
|
1121
|
+
raise ApiErrorException.new(
|
1113
1122
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1114
1123
|
' slow your request rate down and try again.',
|
1115
1124
|
_response
|
1116
1125
|
)
|
1117
1126
|
elsif _response.status_code == 500
|
1118
|
-
raise
|
1127
|
+
raise ApiErrorException.new(
|
1119
1128
|
'Something unexpected happened. Please try again.',
|
1120
1129
|
_response
|
1121
1130
|
)
|
@@ -1125,18 +1134,18 @@ module Voice
|
|
1125
1134
|
# Return appropriate response type.
|
1126
1135
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1127
1136
|
ApiResponse.new(
|
1128
|
-
_response, data:
|
1137
|
+
_response, data: ConferenceState.from_hash(decoded)
|
1129
1138
|
)
|
1130
1139
|
end
|
1131
1140
|
|
1132
|
-
# Modify the conference state
|
1141
|
+
# Modify the conference state.
|
1133
1142
|
# @param [String] account_id Required parameter: Example:
|
1134
1143
|
# @param [String] conference_id Required parameter: Example:
|
1135
|
-
# @param [
|
1144
|
+
# @param [ModifyConferenceRequest] body Required parameter: Example:
|
1136
1145
|
# @return [void] response from the API call
|
1137
1146
|
def modify_conference(account_id,
|
1138
1147
|
conference_id,
|
1139
|
-
body
|
1148
|
+
body)
|
1140
1149
|
# Prepare query url.
|
1141
1150
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1142
1151
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
@@ -1163,7 +1172,7 @@ module Voice
|
|
1163
1172
|
|
1164
1173
|
# Validate response against endpoint and global error codes.
|
1165
1174
|
if _response.status_code == 400
|
1166
|
-
raise
|
1175
|
+
raise ApiErrorException.new(
|
1167
1176
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1168
1177
|
' fix it before trying again.',
|
1169
1178
|
_response
|
@@ -1175,29 +1184,29 @@ module Voice
|
|
1175
1184
|
_response
|
1176
1185
|
)
|
1177
1186
|
elsif _response.status_code == 403
|
1178
|
-
raise
|
1187
|
+
raise ApiErrorException.new(
|
1179
1188
|
'User unauthorized to perform this action.',
|
1180
1189
|
_response
|
1181
1190
|
)
|
1182
1191
|
elsif _response.status_code == 404
|
1183
|
-
raise
|
1192
|
+
raise ApiErrorException.new(
|
1184
1193
|
'The resource specified cannot be found or does not belong to you.',
|
1185
1194
|
_response
|
1186
1195
|
)
|
1187
1196
|
elsif _response.status_code == 415
|
1188
|
-
raise
|
1197
|
+
raise ApiErrorException.new(
|
1189
1198
|
'We don\'t support that media type. If a request body is required,' \
|
1190
1199
|
' please send it to us as `application/json`.',
|
1191
1200
|
_response
|
1192
1201
|
)
|
1193
1202
|
elsif _response.status_code == 429
|
1194
|
-
raise
|
1203
|
+
raise ApiErrorException.new(
|
1195
1204
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1196
1205
|
' slow your request rate down and try again.',
|
1197
1206
|
_response
|
1198
1207
|
)
|
1199
1208
|
elsif _response.status_code == 500
|
1200
|
-
raise
|
1209
|
+
raise ApiErrorException.new(
|
1201
1210
|
'Something unexpected happened. Please try again.',
|
1202
1211
|
_response
|
1203
1212
|
)
|
@@ -1208,16 +1217,16 @@ module Voice
|
|
1208
1217
|
ApiResponse.new(_response)
|
1209
1218
|
end
|
1210
1219
|
|
1211
|
-
# Updates settings for a particular conference member
|
1220
|
+
# Updates settings for a particular conference member.
|
1212
1221
|
# @param [String] account_id Required parameter: Example:
|
1213
1222
|
# @param [String] conference_id Required parameter: Example:
|
1214
1223
|
# @param [String] call_id Required parameter: Example:
|
1215
|
-
# @param [
|
1224
|
+
# @param [ConferenceMemberState] body Required parameter: Example:
|
1216
1225
|
# @return [void] response from the API call
|
1217
1226
|
def modify_conference_member(account_id,
|
1218
1227
|
conference_id,
|
1219
1228
|
call_id,
|
1220
|
-
body
|
1229
|
+
body)
|
1221
1230
|
# Prepare query url.
|
1222
1231
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1223
1232
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
|
@@ -1245,7 +1254,7 @@ module Voice
|
|
1245
1254
|
|
1246
1255
|
# Validate response against endpoint and global error codes.
|
1247
1256
|
if _response.status_code == 400
|
1248
|
-
raise
|
1257
|
+
raise ApiErrorException.new(
|
1249
1258
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1250
1259
|
' fix it before trying again.',
|
1251
1260
|
_response
|
@@ -1257,29 +1266,29 @@ module Voice
|
|
1257
1266
|
_response
|
1258
1267
|
)
|
1259
1268
|
elsif _response.status_code == 403
|
1260
|
-
raise
|
1269
|
+
raise ApiErrorException.new(
|
1261
1270
|
'User unauthorized to perform this action.',
|
1262
1271
|
_response
|
1263
1272
|
)
|
1264
1273
|
elsif _response.status_code == 404
|
1265
|
-
raise
|
1274
|
+
raise ApiErrorException.new(
|
1266
1275
|
'The resource specified cannot be found or does not belong to you.',
|
1267
1276
|
_response
|
1268
1277
|
)
|
1269
1278
|
elsif _response.status_code == 415
|
1270
|
-
raise
|
1279
|
+
raise ApiErrorException.new(
|
1271
1280
|
'We don\'t support that media type. If a request body is required,' \
|
1272
1281
|
' please send it to us as `application/json`.',
|
1273
1282
|
_response
|
1274
1283
|
)
|
1275
1284
|
elsif _response.status_code == 429
|
1276
|
-
raise
|
1285
|
+
raise ApiErrorException.new(
|
1277
1286
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1278
1287
|
' slow your request rate down and try again.',
|
1279
1288
|
_response
|
1280
1289
|
)
|
1281
1290
|
elsif _response.status_code == 500
|
1282
|
-
raise
|
1291
|
+
raise ApiErrorException.new(
|
1283
1292
|
'Something unexpected happened. Please try again.',
|
1284
1293
|
_response
|
1285
1294
|
)
|
@@ -1290,11 +1299,11 @@ module Voice
|
|
1290
1299
|
ApiResponse.new(_response)
|
1291
1300
|
end
|
1292
1301
|
|
1293
|
-
# Returns information about the specified conference member
|
1302
|
+
# Returns information about the specified conference member.
|
1294
1303
|
# @param [String] account_id Required parameter: Example:
|
1295
1304
|
# @param [String] conference_id Required parameter: Example:
|
1296
1305
|
# @param [String] member_id Required parameter: Example:
|
1297
|
-
# @return [
|
1306
|
+
# @return [ConferenceMemberState] response from the API call
|
1298
1307
|
def get_conference_member(account_id,
|
1299
1308
|
conference_id,
|
1300
1309
|
member_id)
|
@@ -1324,7 +1333,7 @@ module Voice
|
|
1324
1333
|
|
1325
1334
|
# Validate response against endpoint and global error codes.
|
1326
1335
|
if _response.status_code == 400
|
1327
|
-
raise
|
1336
|
+
raise ApiErrorException.new(
|
1328
1337
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1329
1338
|
' fix it before trying again.',
|
1330
1339
|
_response
|
@@ -1336,29 +1345,29 @@ module Voice
|
|
1336
1345
|
_response
|
1337
1346
|
)
|
1338
1347
|
elsif _response.status_code == 403
|
1339
|
-
raise
|
1348
|
+
raise ApiErrorException.new(
|
1340
1349
|
'User unauthorized to perform this action.',
|
1341
1350
|
_response
|
1342
1351
|
)
|
1343
1352
|
elsif _response.status_code == 404
|
1344
|
-
raise
|
1353
|
+
raise ApiErrorException.new(
|
1345
1354
|
'The resource specified cannot be found or does not belong to you.',
|
1346
1355
|
_response
|
1347
1356
|
)
|
1348
1357
|
elsif _response.status_code == 415
|
1349
|
-
raise
|
1358
|
+
raise ApiErrorException.new(
|
1350
1359
|
'We don\'t support that media type. If a request body is required,' \
|
1351
1360
|
' please send it to us as `application/json`.',
|
1352
1361
|
_response
|
1353
1362
|
)
|
1354
1363
|
elsif _response.status_code == 429
|
1355
|
-
raise
|
1364
|
+
raise ApiErrorException.new(
|
1356
1365
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1357
1366
|
' slow your request rate down and try again.',
|
1358
1367
|
_response
|
1359
1368
|
)
|
1360
1369
|
elsif _response.status_code == 500
|
1361
|
-
raise
|
1370
|
+
raise ApiErrorException.new(
|
1362
1371
|
'Something unexpected happened. Please try again.',
|
1363
1372
|
_response
|
1364
1373
|
)
|
@@ -1368,7 +1377,7 @@ module Voice
|
|
1368
1377
|
# Return appropriate response type.
|
1369
1378
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1370
1379
|
ApiResponse.new(
|
1371
|
-
_response, data:
|
1380
|
+
_response, data: ConferenceMemberState.from_hash(decoded)
|
1372
1381
|
)
|
1373
1382
|
end
|
1374
1383
|
|
@@ -1376,9 +1385,9 @@ module Voice
|
|
1376
1385
|
# took place during the specified conference
|
1377
1386
|
# @param [String] account_id Required parameter: Example:
|
1378
1387
|
# @param [String] conference_id Required parameter: Example:
|
1379
|
-
# @return [List of
|
1380
|
-
def
|
1381
|
-
|
1388
|
+
# @return [List of ConferenceRecordingMetadata] response from the API call
|
1389
|
+
def get_conference_recordings(account_id,
|
1390
|
+
conference_id)
|
1382
1391
|
# Prepare query url.
|
1383
1392
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1384
1393
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
|
@@ -1404,7 +1413,7 @@ module Voice
|
|
1404
1413
|
|
1405
1414
|
# Validate response against endpoint and global error codes.
|
1406
1415
|
if _response.status_code == 400
|
1407
|
-
raise
|
1416
|
+
raise ApiErrorException.new(
|
1408
1417
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1409
1418
|
' fix it before trying again.',
|
1410
1419
|
_response
|
@@ -1416,29 +1425,29 @@ module Voice
|
|
1416
1425
|
_response
|
1417
1426
|
)
|
1418
1427
|
elsif _response.status_code == 403
|
1419
|
-
raise
|
1428
|
+
raise ApiErrorException.new(
|
1420
1429
|
'User unauthorized to perform this action.',
|
1421
1430
|
_response
|
1422
1431
|
)
|
1423
1432
|
elsif _response.status_code == 404
|
1424
|
-
raise
|
1433
|
+
raise ApiErrorException.new(
|
1425
1434
|
'The resource specified cannot be found or does not belong to you.',
|
1426
1435
|
_response
|
1427
1436
|
)
|
1428
1437
|
elsif _response.status_code == 415
|
1429
|
-
raise
|
1438
|
+
raise ApiErrorException.new(
|
1430
1439
|
'We don\'t support that media type. If a request body is required,' \
|
1431
1440
|
' please send it to us as `application/json`.',
|
1432
1441
|
_response
|
1433
1442
|
)
|
1434
1443
|
elsif _response.status_code == 429
|
1435
|
-
raise
|
1444
|
+
raise ApiErrorException.new(
|
1436
1445
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1437
1446
|
' slow your request rate down and try again.',
|
1438
1447
|
_response
|
1439
1448
|
)
|
1440
1449
|
elsif _response.status_code == 500
|
1441
|
-
raise
|
1450
|
+
raise ApiErrorException.new(
|
1442
1451
|
'Something unexpected happened. Please try again.',
|
1443
1452
|
_response
|
1444
1453
|
)
|
@@ -1449,18 +1458,18 @@ module Voice
|
|
1449
1458
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1450
1459
|
ApiResponse.new(
|
1451
1460
|
_response,
|
1452
|
-
data: decoded.map { |element|
|
1461
|
+
data: decoded.map { |element| ConferenceRecordingMetadata.from_hash(element) }
|
1453
1462
|
)
|
1454
1463
|
end
|
1455
1464
|
|
1456
|
-
# Returns metadata for the specified recording
|
1465
|
+
# Returns metadata for the specified recording.
|
1457
1466
|
# @param [String] account_id Required parameter: Example:
|
1458
1467
|
# @param [String] conference_id Required parameter: Example:
|
1459
1468
|
# @param [String] recording_id Required parameter: Example:
|
1460
|
-
# @return [
|
1461
|
-
def
|
1462
|
-
|
1463
|
-
|
1469
|
+
# @return [CallRecordingMetadata] response from the API call
|
1470
|
+
def get_conference_recording(account_id,
|
1471
|
+
conference_id,
|
1472
|
+
recording_id)
|
1464
1473
|
# Prepare query url.
|
1465
1474
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1466
1475
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
|
@@ -1487,7 +1496,7 @@ module Voice
|
|
1487
1496
|
|
1488
1497
|
# Validate response against endpoint and global error codes.
|
1489
1498
|
if _response.status_code == 400
|
1490
|
-
raise
|
1499
|
+
raise ApiErrorException.new(
|
1491
1500
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1492
1501
|
' fix it before trying again.',
|
1493
1502
|
_response
|
@@ -1499,29 +1508,29 @@ module Voice
|
|
1499
1508
|
_response
|
1500
1509
|
)
|
1501
1510
|
elsif _response.status_code == 403
|
1502
|
-
raise
|
1511
|
+
raise ApiErrorException.new(
|
1503
1512
|
'User unauthorized to perform this action.',
|
1504
1513
|
_response
|
1505
1514
|
)
|
1506
1515
|
elsif _response.status_code == 404
|
1507
|
-
raise
|
1516
|
+
raise ApiErrorException.new(
|
1508
1517
|
'The resource specified cannot be found or does not belong to you.',
|
1509
1518
|
_response
|
1510
1519
|
)
|
1511
1520
|
elsif _response.status_code == 415
|
1512
|
-
raise
|
1521
|
+
raise ApiErrorException.new(
|
1513
1522
|
'We don\'t support that media type. If a request body is required,' \
|
1514
1523
|
' please send it to us as `application/json`.',
|
1515
1524
|
_response
|
1516
1525
|
)
|
1517
1526
|
elsif _response.status_code == 429
|
1518
|
-
raise
|
1527
|
+
raise ApiErrorException.new(
|
1519
1528
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1520
1529
|
' slow your request rate down and try again.',
|
1521
1530
|
_response
|
1522
1531
|
)
|
1523
1532
|
elsif _response.status_code == 500
|
1524
|
-
raise
|
1533
|
+
raise ApiErrorException.new(
|
1525
1534
|
'Something unexpected happened. Please try again.',
|
1526
1535
|
_response
|
1527
1536
|
)
|
@@ -1531,18 +1540,18 @@ module Voice
|
|
1531
1540
|
# Return appropriate response type.
|
1532
1541
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1533
1542
|
ApiResponse.new(
|
1534
|
-
_response, data:
|
1543
|
+
_response, data: CallRecordingMetadata.from_hash(decoded)
|
1535
1544
|
)
|
1536
1545
|
end
|
1537
1546
|
|
1538
|
-
# Downloads the specified recording
|
1547
|
+
# Downloads the specified recording.
|
1539
1548
|
# @param [String] account_id Required parameter: Example:
|
1540
1549
|
# @param [String] conference_id Required parameter: Example:
|
1541
1550
|
# @param [String] recording_id Required parameter: Example:
|
1542
|
-
# @return [
|
1543
|
-
def
|
1544
|
-
|
1545
|
-
|
1551
|
+
# @return [Mixed] response from the API call
|
1552
|
+
def get_download_conference_recording(account_id,
|
1553
|
+
conference_id,
|
1554
|
+
recording_id)
|
1546
1555
|
# Prepare query url.
|
1547
1556
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1548
1557
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
|
@@ -1554,16 +1563,22 @@ module Voice
|
|
1554
1563
|
)
|
1555
1564
|
_query_url = APIHelper.clean_url _query_builder
|
1556
1565
|
|
1566
|
+
# Prepare headers.
|
1567
|
+
_headers = {
|
1568
|
+
'accept' => 'application/json'
|
1569
|
+
}
|
1570
|
+
|
1557
1571
|
# Prepare and execute HttpRequest.
|
1558
1572
|
_request = config.http_client.get(
|
1559
|
-
_query_url
|
1573
|
+
_query_url,
|
1574
|
+
headers: _headers
|
1560
1575
|
)
|
1561
1576
|
VoiceBasicAuth.apply(config, _request)
|
1562
|
-
_response = execute_request(_request
|
1577
|
+
_response = execute_request(_request)
|
1563
1578
|
|
1564
1579
|
# Validate response against endpoint and global error codes.
|
1565
1580
|
if _response.status_code == 400
|
1566
|
-
raise
|
1581
|
+
raise ApiErrorException.new(
|
1567
1582
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1568
1583
|
' fix it before trying again.',
|
1569
1584
|
_response
|
@@ -1575,29 +1590,29 @@ module Voice
|
|
1575
1590
|
_response
|
1576
1591
|
)
|
1577
1592
|
elsif _response.status_code == 403
|
1578
|
-
raise
|
1593
|
+
raise ApiErrorException.new(
|
1579
1594
|
'User unauthorized to perform this action.',
|
1580
1595
|
_response
|
1581
1596
|
)
|
1582
1597
|
elsif _response.status_code == 404
|
1583
|
-
raise
|
1598
|
+
raise ApiErrorException.new(
|
1584
1599
|
'The resource specified cannot be found or does not belong to you.',
|
1585
1600
|
_response
|
1586
1601
|
)
|
1587
1602
|
elsif _response.status_code == 415
|
1588
|
-
raise
|
1603
|
+
raise ApiErrorException.new(
|
1589
1604
|
'We don\'t support that media type. If a request body is required,' \
|
1590
1605
|
' please send it to us as `application/json`.',
|
1591
1606
|
_response
|
1592
1607
|
)
|
1593
1608
|
elsif _response.status_code == 429
|
1594
|
-
raise
|
1609
|
+
raise ApiErrorException.new(
|
1595
1610
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1596
1611
|
' slow your request rate down and try again.',
|
1597
1612
|
_response
|
1598
1613
|
)
|
1599
1614
|
elsif _response.status_code == 500
|
1600
|
-
raise
|
1615
|
+
raise ApiErrorException.new(
|
1601
1616
|
'Something unexpected happened. Please try again.',
|
1602
1617
|
_response
|
1603
1618
|
)
|
@@ -1605,8 +1620,11 @@ module Voice
|
|
1605
1620
|
validate_response(_response)
|
1606
1621
|
|
1607
1622
|
# Return appropriate response type.
|
1623
|
+
decoded = APIHelper.json_deserialize(_response.raw_body) unless
|
1624
|
+
_response.raw_body.nil? ||
|
1625
|
+
_response.raw_body.to_s.strip.empty?
|
1608
1626
|
ApiResponse.new(
|
1609
|
-
_response, data:
|
1627
|
+
_response, data: decoded
|
1610
1628
|
)
|
1611
1629
|
end
|
1612
1630
|
|
@@ -1619,12 +1637,12 @@ module Voice
|
|
1619
1637
|
# @param [String] to Optional parameter: Example:
|
1620
1638
|
# @param [String] min_start_time Optional parameter: Example:
|
1621
1639
|
# @param [String] max_start_time Optional parameter: Example:
|
1622
|
-
# @return [List of
|
1623
|
-
def
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1640
|
+
# @return [List of CallRecordingMetadata] response from the API call
|
1641
|
+
def get_query_call_recordings(account_id,
|
1642
|
+
from: nil,
|
1643
|
+
to: nil,
|
1644
|
+
min_start_time: nil,
|
1645
|
+
max_start_time: nil)
|
1628
1646
|
# Prepare query url.
|
1629
1647
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1630
1648
|
_query_builder << '/api/v2/accounts/{accountId}/recordings'
|
@@ -1656,7 +1674,7 @@ module Voice
|
|
1656
1674
|
|
1657
1675
|
# Validate response against endpoint and global error codes.
|
1658
1676
|
if _response.status_code == 400
|
1659
|
-
raise
|
1677
|
+
raise ApiErrorException.new(
|
1660
1678
|
'Something\'s not quite right... Your request is invalid. Please' \
|
1661
1679
|
' fix it before trying again.',
|
1662
1680
|
_response
|
@@ -1668,29 +1686,29 @@ module Voice
|
|
1668
1686
|
_response
|
1669
1687
|
)
|
1670
1688
|
elsif _response.status_code == 403
|
1671
|
-
raise
|
1689
|
+
raise ApiErrorException.new(
|
1672
1690
|
'User unauthorized to perform this action.',
|
1673
1691
|
_response
|
1674
1692
|
)
|
1675
1693
|
elsif _response.status_code == 404
|
1676
|
-
raise
|
1694
|
+
raise ApiErrorException.new(
|
1677
1695
|
'The resource specified cannot be found or does not belong to you.',
|
1678
1696
|
_response
|
1679
1697
|
)
|
1680
1698
|
elsif _response.status_code == 415
|
1681
|
-
raise
|
1699
|
+
raise ApiErrorException.new(
|
1682
1700
|
'We don\'t support that media type. If a request body is required,' \
|
1683
1701
|
' please send it to us as `application/json`.',
|
1684
1702
|
_response
|
1685
1703
|
)
|
1686
1704
|
elsif _response.status_code == 429
|
1687
|
-
raise
|
1705
|
+
raise ApiErrorException.new(
|
1688
1706
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
1689
1707
|
' slow your request rate down and try again.',
|
1690
1708
|
_response
|
1691
1709
|
)
|
1692
1710
|
elsif _response.status_code == 500
|
1693
|
-
raise
|
1711
|
+
raise ApiErrorException.new(
|
1694
1712
|
'Something unexpected happened. Please try again.',
|
1695
1713
|
_response
|
1696
1714
|
)
|
@@ -1701,7 +1719,7 @@ module Voice
|
|
1701
1719
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1702
1720
|
ApiResponse.new(
|
1703
1721
|
_response,
|
1704
|
-
data: decoded.map { |element|
|
1722
|
+
data: decoded.map { |element| CallRecordingMetadata.from_hash(element) }
|
1705
1723
|
)
|
1706
1724
|
end
|
1707
1725
|
end
|