bandwidth-sdk 2.1.1 → 2.2.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 +3 -3
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +4 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +4 -1
- data/lib/bandwidth/voice_lib/voice.rb +11 -4
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +540 -90
- data/lib/bandwidth/voice_lib/voice/exceptions/{error_response_exception.rb → api_error_response_exception.rb} +3 -3
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +11 -2
- data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +164 -0
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +71 -0
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +35 -0
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +44 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_state.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +35 -25
- data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +4 -7
- data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +20 -0
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +7 -4
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +32 -0
- data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +26 -0
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +44 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +62 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +42 -0
- metadata +13 -6
- data/lib/bandwidth/voice_lib/voice/models/api_get_account_recordings_metadata_request.rb +0 -65
- data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/type_enum.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37ac6cedf8f46960bdc51af5b2c1cb7084f303ba4b757373538186ca932997ba
|
4
|
+
data.tar.gz: 1bac73b1c867feec6a21b3b985bbe15b3a163c3319538313453928e39a66806a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7883069c08c868dcddd095be404121878adacd67dce7adbab68cc3e2af858d7534f2bd16410b64786a496372f0d1f81b6ffe456ea0b4c6434b4594cb997b0fb3
|
7
|
+
data.tar.gz: f32337f52e22bad320f06fa789cfcd8618a4973fea80155ac626cef225c9c063cc2d27c7927354e14ed4f50b6185d139c303b0690d325f6d8dcb4c9514fbb484
|
data/README.md
CHANGED
@@ -7,16 +7,16 @@ Bandwidth's set of APIs
|
|
7
7
|
Install the gem from the command line:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem install bandwidth-sdk -v 2.
|
10
|
+
gem install bandwidth-sdk -v 2.2.0
|
11
11
|
```
|
12
12
|
|
13
13
|
Or add the gem to your Gemfile and run `bundle`:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'bandwidth-sdk', '2.
|
16
|
+
gem 'bandwidth-sdk', '2.2.0'
|
17
17
|
```
|
18
18
|
|
19
|
-
For additional gem details, see the [RubyGems page for the bandwidth-sdk gem](https://rubygems.org/gems/bandwidth-sdk/versions/2.
|
19
|
+
For additional gem details, see the [RubyGems page for the bandwidth-sdk gem](https://rubygems.org/gems/bandwidth-sdk/versions/2.2.0).
|
20
20
|
|
21
21
|
## Initialize the API Client
|
22
22
|
|
@@ -17,7 +17,10 @@ module Bandwidth
|
|
17
17
|
'recordingAvailableMethod' => recording_available_method,
|
18
18
|
'terminatingDigits' => terminating_digits,
|
19
19
|
'maxDuration' => max_duration,
|
20
|
-
'fileFormat' => file_format
|
20
|
+
'fileFormat' => file_format,
|
21
|
+
'transcribe' => transcribe,
|
22
|
+
'transcriptionAvailableUrl' => transcription_available_url,
|
23
|
+
'transcriptionAvailableMethod' => transcription_available_method
|
21
24
|
}))
|
22
25
|
end
|
23
26
|
end
|
@@ -14,7 +14,10 @@ module Bandwidth
|
|
14
14
|
'recordingAvailableUrl' => recording_available_url,
|
15
15
|
'recordingAvailableMethod' => recording_available_method,
|
16
16
|
'fileFormat' => file_format,
|
17
|
-
'multiChannel' => multi_channel
|
17
|
+
'multiChannel' => multi_channel,
|
18
|
+
'transcribe' => transcribe,
|
19
|
+
'transcriptionAvailableUrl' => transcription_available_url,
|
20
|
+
'transcriptionAvailableMethod' => transcription_available_method
|
18
21
|
}))
|
19
22
|
end
|
20
23
|
end
|
@@ -8,23 +8,30 @@ require_relative 'voice/client.rb'
|
|
8
8
|
|
9
9
|
# Models
|
10
10
|
require_relative 'voice/models/api_call_response.rb'
|
11
|
+
require_relative 'voice/models/api_call_state_response.rb'
|
11
12
|
require_relative 'voice/models/api_create_call_request.rb'
|
12
|
-
require_relative 'voice/models/api_get_account_recordings_metadata_request.rb'
|
13
13
|
require_relative 'voice/models/api_modify_call_request.rb'
|
14
|
+
require_relative 'voice/models/api_transcribe_recording_request.rb'
|
14
15
|
require_relative 'voice/models/modify_call_recording_state.rb'
|
15
16
|
require_relative 'voice/models/recording_metadata_response.rb'
|
17
|
+
require_relative 'voice/models/transcript.rb'
|
18
|
+
require_relative 'voice/models/transcription.rb'
|
19
|
+
require_relative 'voice/models/transcription_response.rb'
|
16
20
|
require_relative 'voice/models/answer_method_enum.rb'
|
21
|
+
require_relative 'voice/models/callback_method_enum.rb'
|
17
22
|
require_relative 'voice/models/direction_enum.rb'
|
23
|
+
require_relative 'voice/models/disconnect_cause_enum.rb'
|
18
24
|
require_relative 'voice/models/disconnect_method_enum.rb'
|
19
25
|
require_relative 'voice/models/file_format_enum.rb'
|
20
26
|
require_relative 'voice/models/redirect_method_enum.rb'
|
21
27
|
require_relative 'voice/models/state_enum.rb'
|
22
28
|
require_relative 'voice/models/state1_enum.rb'
|
23
|
-
require_relative 'voice/models/
|
24
|
-
require_relative 'voice/models/
|
29
|
+
require_relative 'voice/models/state2_enum.rb'
|
30
|
+
require_relative 'voice/models/status_enum.rb'
|
31
|
+
require_relative 'voice/models/status1_enum.rb'
|
25
32
|
|
26
33
|
# Exceptions
|
27
|
-
require_relative 'voice/exceptions/
|
34
|
+
require_relative 'voice/exceptions/api_error_response_exception.rb'
|
28
35
|
# Controllers
|
29
36
|
require_relative 'voice/controllers/base_controller.rb'
|
30
37
|
require_relative 'voice/controllers/api_controller.rb'
|
@@ -11,7 +11,7 @@ module Voice
|
|
11
11
|
super(config, http_call_back: http_call_back)
|
12
12
|
end
|
13
13
|
|
14
|
-
# Creates
|
14
|
+
# Creates an outbound call
|
15
15
|
# @param [String] account_id Required parameter: Example:
|
16
16
|
# @param [ApiCreateCallRequest] body Optional parameter: Example:
|
17
17
|
# @return [ApiCallResponse] response from the API call
|
@@ -43,36 +43,42 @@ module Voice
|
|
43
43
|
|
44
44
|
# Validate response against endpoint and global error codes.
|
45
45
|
if _response.status_code == 400
|
46
|
-
raise
|
47
|
-
'Something
|
46
|
+
raise ApiErrorResponseException.new(
|
47
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
48
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
48
49
|
' before trying again.',
|
49
50
|
_response
|
50
51
|
)
|
51
52
|
elsif _response.status_code == 401
|
52
53
|
raise APIException.new(
|
53
|
-
'Please authenticate yourself',
|
54
|
+
'Please authenticate yourself.',
|
54
55
|
_response
|
55
56
|
)
|
56
57
|
elsif _response.status_code == 403
|
57
|
-
raise
|
58
|
+
raise ApiErrorResponseException.new(
|
58
59
|
'Your credentials are invalid. Please use your API credentials for' \
|
59
60
|
' the Bandwidth Dashboard.',
|
60
61
|
_response
|
61
62
|
)
|
63
|
+
elsif _response.status_code == 404
|
64
|
+
raise ApiErrorResponseException.new(
|
65
|
+
'The resource specified cannot be found or does not belong to you.',
|
66
|
+
_response
|
67
|
+
)
|
62
68
|
elsif _response.status_code == 415
|
63
|
-
raise
|
64
|
-
'We don\'t support that media type.
|
65
|
-
' `application/json`.',
|
69
|
+
raise ApiErrorResponseException.new(
|
70
|
+
'We don\'t support that media type. If a request body is required,' \
|
71
|
+
' please send it to us as `application/json`.',
|
66
72
|
_response
|
67
73
|
)
|
68
74
|
elsif _response.status_code == 429
|
69
|
-
raise
|
75
|
+
raise ApiErrorResponseException.new(
|
70
76
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
71
77
|
' slow your request rate down and try again.',
|
72
78
|
_response
|
73
79
|
)
|
74
80
|
elsif _response.status_code == 500
|
75
|
-
raise
|
81
|
+
raise ApiErrorResponseException.new(
|
76
82
|
'Something unexpected happened. Please try again.',
|
77
83
|
_response
|
78
84
|
)
|
@@ -84,6 +90,84 @@ module Voice
|
|
84
90
|
ApiResponse.new(_response, data: ApiCallResponse.from_hash(decoded))
|
85
91
|
end
|
86
92
|
|
93
|
+
# Returns near-realtime metadata about the specified call
|
94
|
+
# @param [String] account_id Required parameter: Example:
|
95
|
+
# @param [String] call_id Required parameter: Example:
|
96
|
+
# @return [ApiCallStateResponse] response from the API call
|
97
|
+
def get_call_state(account_id,
|
98
|
+
call_id)
|
99
|
+
# Prepare query url.
|
100
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
101
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
102
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
103
|
+
_query_builder,
|
104
|
+
'accountId' => account_id,
|
105
|
+
'callId' => call_id
|
106
|
+
)
|
107
|
+
_query_url = APIHelper.clean_url _query_builder
|
108
|
+
|
109
|
+
# Prepare headers.
|
110
|
+
_headers = {
|
111
|
+
'accept' => 'application/json'
|
112
|
+
}
|
113
|
+
|
114
|
+
# Prepare and execute HttpRequest.
|
115
|
+
_request = config.http_client.get(
|
116
|
+
_query_url,
|
117
|
+
headers: _headers
|
118
|
+
)
|
119
|
+
VoiceBasicAuth.apply(config, _request)
|
120
|
+
_response = execute_request(_request)
|
121
|
+
|
122
|
+
# Validate response against endpoint and global error codes.
|
123
|
+
if _response.status_code == 400
|
124
|
+
raise ApiErrorResponseException.new(
|
125
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
126
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
127
|
+
' before trying again.',
|
128
|
+
_response
|
129
|
+
)
|
130
|
+
elsif _response.status_code == 401
|
131
|
+
raise APIException.new(
|
132
|
+
'Please authenticate yourself.',
|
133
|
+
_response
|
134
|
+
)
|
135
|
+
elsif _response.status_code == 403
|
136
|
+
raise ApiErrorResponseException.new(
|
137
|
+
'Your credentials are invalid. Please use your API credentials for' \
|
138
|
+
' the Bandwidth Dashboard.',
|
139
|
+
_response
|
140
|
+
)
|
141
|
+
elsif _response.status_code == 404
|
142
|
+
raise ApiErrorResponseException.new(
|
143
|
+
'The resource specified cannot be found or does not belong to you.',
|
144
|
+
_response
|
145
|
+
)
|
146
|
+
elsif _response.status_code == 415
|
147
|
+
raise ApiErrorResponseException.new(
|
148
|
+
'We don\'t support that media type. If a request body is required,' \
|
149
|
+
' please send it to us as `application/json`.',
|
150
|
+
_response
|
151
|
+
)
|
152
|
+
elsif _response.status_code == 429
|
153
|
+
raise ApiErrorResponseException.new(
|
154
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
155
|
+
' slow your request rate down and try again.',
|
156
|
+
_response
|
157
|
+
)
|
158
|
+
elsif _response.status_code == 500
|
159
|
+
raise ApiErrorResponseException.new(
|
160
|
+
'Something unexpected happened. Please try again.',
|
161
|
+
_response
|
162
|
+
)
|
163
|
+
end
|
164
|
+
validate_response(_response)
|
165
|
+
|
166
|
+
# Return appropriate response type.
|
167
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
168
|
+
ApiResponse.new(_response, data: ApiCallStateResponse.from_hash(decoded))
|
169
|
+
end
|
170
|
+
|
87
171
|
# Interrupts and replaces an active call's BXML document
|
88
172
|
# @param [String] account_id Required parameter: Example:
|
89
173
|
# @param [String] call_id Required parameter: Example:
|
@@ -118,40 +202,42 @@ module Voice
|
|
118
202
|
|
119
203
|
# Validate response against endpoint and global error codes.
|
120
204
|
if _response.status_code == 400
|
121
|
-
raise
|
122
|
-
'
|
205
|
+
raise ApiErrorResponseException.new(
|
206
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
207
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
208
|
+
' before trying again.',
|
123
209
|
_response
|
124
210
|
)
|
125
211
|
elsif _response.status_code == 401
|
126
212
|
raise APIException.new(
|
127
|
-
'Please authenticate yourself',
|
213
|
+
'Please authenticate yourself.',
|
128
214
|
_response
|
129
215
|
)
|
130
216
|
elsif _response.status_code == 403
|
131
|
-
raise
|
217
|
+
raise ApiErrorResponseException.new(
|
132
218
|
'Your credentials are invalid. Please use your API credentials for' \
|
133
219
|
' the Bandwidth Dashboard.',
|
134
220
|
_response
|
135
221
|
)
|
136
222
|
elsif _response.status_code == 404
|
137
|
-
raise
|
138
|
-
'The
|
223
|
+
raise ApiErrorResponseException.new(
|
224
|
+
'The resource specified cannot be found or does not belong to you.',
|
139
225
|
_response
|
140
226
|
)
|
141
227
|
elsif _response.status_code == 415
|
142
|
-
raise
|
143
|
-
'We don\'t support that media type.
|
144
|
-
' `application/json`.',
|
228
|
+
raise ApiErrorResponseException.new(
|
229
|
+
'We don\'t support that media type. If a request body is required,' \
|
230
|
+
' please send it to us as `application/json`.',
|
145
231
|
_response
|
146
232
|
)
|
147
233
|
elsif _response.status_code == 429
|
148
|
-
raise
|
234
|
+
raise ApiErrorResponseException.new(
|
149
235
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
150
236
|
' slow your request rate down and try again.',
|
151
237
|
_response
|
152
238
|
)
|
153
239
|
elsif _response.status_code == 500
|
154
|
-
raise
|
240
|
+
raise ApiErrorResponseException.new(
|
155
241
|
'Something unexpected happened. Please try again.',
|
156
242
|
_response
|
157
243
|
)
|
@@ -196,40 +282,42 @@ module Voice
|
|
196
282
|
|
197
283
|
# Validate response against endpoint and global error codes.
|
198
284
|
if _response.status_code == 400
|
199
|
-
raise
|
200
|
-
'
|
285
|
+
raise ApiErrorResponseException.new(
|
286
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
287
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
288
|
+
' before trying again.',
|
201
289
|
_response
|
202
290
|
)
|
203
291
|
elsif _response.status_code == 401
|
204
292
|
raise APIException.new(
|
205
|
-
'Please authenticate yourself',
|
293
|
+
'Please authenticate yourself.',
|
206
294
|
_response
|
207
295
|
)
|
208
296
|
elsif _response.status_code == 403
|
209
|
-
raise
|
297
|
+
raise ApiErrorResponseException.new(
|
210
298
|
'Your credentials are invalid. Please use your API credentials for' \
|
211
299
|
' the Bandwidth Dashboard.',
|
212
300
|
_response
|
213
301
|
)
|
214
302
|
elsif _response.status_code == 404
|
215
|
-
raise
|
216
|
-
'The
|
303
|
+
raise ApiErrorResponseException.new(
|
304
|
+
'The resource specified cannot be found or does not belong to you.',
|
217
305
|
_response
|
218
306
|
)
|
219
307
|
elsif _response.status_code == 415
|
220
|
-
raise
|
221
|
-
'We don\'t support that media type.
|
222
|
-
' `application/json`.',
|
308
|
+
raise ApiErrorResponseException.new(
|
309
|
+
'We don\'t support that media type. If a request body is required,' \
|
310
|
+
' please send it to us as `application/json`.',
|
223
311
|
_response
|
224
312
|
)
|
225
313
|
elsif _response.status_code == 429
|
226
|
-
raise
|
314
|
+
raise ApiErrorResponseException.new(
|
227
315
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
228
316
|
' slow your request rate down and try again.',
|
229
317
|
_response
|
230
318
|
)
|
231
319
|
elsif _response.status_code == 500
|
232
|
-
raise
|
320
|
+
raise ApiErrorResponseException.new(
|
233
321
|
'Something unexpected happened. Please try again.',
|
234
322
|
_response
|
235
323
|
)
|
@@ -244,9 +332,17 @@ module Voice
|
|
244
332
|
# took place during the specified call
|
245
333
|
# @param [String] account_id Required parameter: Example:
|
246
334
|
# @param [String] call_id Required parameter: Example:
|
335
|
+
# @param [String] from Optional parameter: Example:
|
336
|
+
# @param [String] to Optional parameter: Example:
|
337
|
+
# @param [String] min_start_time Optional parameter: Example:
|
338
|
+
# @param [String] max_start_time Optional parameter: Example:
|
247
339
|
# @return [List of RecordingMetadataResponse] response from the API call
|
248
340
|
def get_query_metadata_for_account_and_call(account_id,
|
249
|
-
call_id
|
341
|
+
call_id,
|
342
|
+
from: nil,
|
343
|
+
to: nil,
|
344
|
+
min_start_time: nil,
|
345
|
+
max_start_time: nil)
|
250
346
|
# Prepare query url.
|
251
347
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
252
348
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
|
@@ -255,6 +351,13 @@ module Voice
|
|
255
351
|
'accountId' => account_id,
|
256
352
|
'callId' => call_id
|
257
353
|
)
|
354
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
355
|
+
_query_builder,
|
356
|
+
'from' => from,
|
357
|
+
'to' => to,
|
358
|
+
'minStartTime' => min_start_time,
|
359
|
+
'maxStartTime' => max_start_time
|
360
|
+
)
|
258
361
|
_query_url = APIHelper.clean_url _query_builder
|
259
362
|
|
260
363
|
# Prepare headers.
|
@@ -272,36 +375,42 @@ module Voice
|
|
272
375
|
|
273
376
|
# Validate response against endpoint and global error codes.
|
274
377
|
if _response.status_code == 400
|
275
|
-
raise
|
276
|
-
'Something
|
378
|
+
raise ApiErrorResponseException.new(
|
379
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
380
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
277
381
|
' before trying again.',
|
278
382
|
_response
|
279
383
|
)
|
280
384
|
elsif _response.status_code == 401
|
281
385
|
raise APIException.new(
|
282
|
-
'Please authenticate yourself',
|
386
|
+
'Please authenticate yourself.',
|
283
387
|
_response
|
284
388
|
)
|
285
389
|
elsif _response.status_code == 403
|
286
|
-
raise
|
390
|
+
raise ApiErrorResponseException.new(
|
287
391
|
'Your credentials are invalid. Please use your API credentials for' \
|
288
392
|
' the Bandwidth Dashboard.',
|
289
393
|
_response
|
290
394
|
)
|
395
|
+
elsif _response.status_code == 404
|
396
|
+
raise ApiErrorResponseException.new(
|
397
|
+
'The resource specified cannot be found or does not belong to you.',
|
398
|
+
_response
|
399
|
+
)
|
291
400
|
elsif _response.status_code == 415
|
292
|
-
raise
|
293
|
-
'We don\'t support that media type.
|
294
|
-
' `application/json`.',
|
401
|
+
raise ApiErrorResponseException.new(
|
402
|
+
'We don\'t support that media type. If a request body is required,' \
|
403
|
+
' please send it to us as `application/json`.',
|
295
404
|
_response
|
296
405
|
)
|
297
406
|
elsif _response.status_code == 429
|
298
|
-
raise
|
407
|
+
raise ApiErrorResponseException.new(
|
299
408
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
300
409
|
' slow your request rate down and try again.',
|
301
410
|
_response
|
302
411
|
)
|
303
412
|
elsif _response.status_code == 500
|
304
|
-
raise
|
413
|
+
raise ApiErrorResponseException.new(
|
305
414
|
'Something unexpected happened. Please try again.',
|
306
415
|
_response
|
307
416
|
)
|
@@ -350,42 +459,42 @@ module Voice
|
|
350
459
|
|
351
460
|
# Validate response against endpoint and global error codes.
|
352
461
|
if _response.status_code == 400
|
353
|
-
raise
|
354
|
-
'Something
|
462
|
+
raise ApiErrorResponseException.new(
|
463
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
464
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
355
465
|
' before trying again.',
|
356
466
|
_response
|
357
467
|
)
|
358
468
|
elsif _response.status_code == 401
|
359
469
|
raise APIException.new(
|
360
|
-
'Please authenticate yourself',
|
470
|
+
'Please authenticate yourself.',
|
361
471
|
_response
|
362
472
|
)
|
363
473
|
elsif _response.status_code == 403
|
364
|
-
raise
|
474
|
+
raise ApiErrorResponseException.new(
|
365
475
|
'Your credentials are invalid. Please use your API credentials for' \
|
366
476
|
' the Bandwidth Dashboard.',
|
367
477
|
_response
|
368
478
|
)
|
369
479
|
elsif _response.status_code == 404
|
370
|
-
raise
|
371
|
-
'The
|
372
|
-
' to you',
|
480
|
+
raise ApiErrorResponseException.new(
|
481
|
+
'The resource specified cannot be found or does not belong to you.',
|
373
482
|
_response
|
374
483
|
)
|
375
484
|
elsif _response.status_code == 415
|
376
|
-
raise
|
377
|
-
'We don\'t support that media type.
|
378
|
-
' `application/json`.',
|
485
|
+
raise ApiErrorResponseException.new(
|
486
|
+
'We don\'t support that media type. If a request body is required,' \
|
487
|
+
' please send it to us as `application/json`.',
|
379
488
|
_response
|
380
489
|
)
|
381
490
|
elsif _response.status_code == 429
|
382
|
-
raise
|
491
|
+
raise ApiErrorResponseException.new(
|
383
492
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
384
493
|
' slow your request rate down and try again.',
|
385
494
|
_response
|
386
495
|
)
|
387
496
|
elsif _response.status_code == 500
|
388
|
-
raise
|
497
|
+
raise ApiErrorResponseException.new(
|
389
498
|
'Something unexpected happened. Please try again.',
|
390
499
|
_response
|
391
500
|
)
|
@@ -426,42 +535,42 @@ module Voice
|
|
426
535
|
|
427
536
|
# Validate response against endpoint and global error codes.
|
428
537
|
if _response.status_code == 400
|
429
|
-
raise
|
430
|
-
'Something
|
538
|
+
raise ApiErrorResponseException.new(
|
539
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
540
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
431
541
|
' before trying again.',
|
432
542
|
_response
|
433
543
|
)
|
434
544
|
elsif _response.status_code == 401
|
435
545
|
raise APIException.new(
|
436
|
-
'Please authenticate yourself',
|
546
|
+
'Please authenticate yourself.',
|
437
547
|
_response
|
438
548
|
)
|
439
549
|
elsif _response.status_code == 403
|
440
|
-
raise
|
550
|
+
raise ApiErrorResponseException.new(
|
441
551
|
'Your credentials are invalid. Please use your API credentials for' \
|
442
552
|
' the Bandwidth Dashboard.',
|
443
553
|
_response
|
444
554
|
)
|
445
555
|
elsif _response.status_code == 404
|
446
|
-
raise
|
447
|
-
'The
|
448
|
-
' to you',
|
556
|
+
raise ApiErrorResponseException.new(
|
557
|
+
'The resource specified cannot be found or does not belong to you.',
|
449
558
|
_response
|
450
559
|
)
|
451
560
|
elsif _response.status_code == 415
|
452
|
-
raise
|
453
|
-
'We don\'t support that media type.
|
454
|
-
' `application/json`.',
|
561
|
+
raise ApiErrorResponseException.new(
|
562
|
+
'We don\'t support that media type. If a request body is required,' \
|
563
|
+
' please send it to us as `application/json`.',
|
455
564
|
_response
|
456
565
|
)
|
457
566
|
elsif _response.status_code == 429
|
458
|
-
raise
|
567
|
+
raise ApiErrorResponseException.new(
|
459
568
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
460
569
|
' slow your request rate down and try again.',
|
461
570
|
_response
|
462
571
|
)
|
463
572
|
elsif _response.status_code == 500
|
464
|
-
raise
|
573
|
+
raise ApiErrorResponseException.new(
|
465
574
|
'Something unexpected happened. Please try again.',
|
466
575
|
_response
|
467
576
|
)
|
@@ -500,42 +609,42 @@ module Voice
|
|
500
609
|
|
501
610
|
# Validate response against endpoint and global error codes.
|
502
611
|
if _response.status_code == 400
|
503
|
-
raise
|
504
|
-
'Something
|
612
|
+
raise ApiErrorResponseException.new(
|
613
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
614
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
505
615
|
' before trying again.',
|
506
616
|
_response
|
507
617
|
)
|
508
618
|
elsif _response.status_code == 401
|
509
619
|
raise APIException.new(
|
510
|
-
'Please authenticate yourself',
|
620
|
+
'Please authenticate yourself.',
|
511
621
|
_response
|
512
622
|
)
|
513
623
|
elsif _response.status_code == 403
|
514
|
-
raise
|
624
|
+
raise ApiErrorResponseException.new(
|
515
625
|
'Your credentials are invalid. Please use your API credentials for' \
|
516
626
|
' the Bandwidth Dashboard.',
|
517
627
|
_response
|
518
628
|
)
|
519
629
|
elsif _response.status_code == 404
|
520
|
-
raise
|
521
|
-
'The
|
522
|
-
' to you',
|
630
|
+
raise ApiErrorResponseException.new(
|
631
|
+
'The resource specified cannot be found or does not belong to you.',
|
523
632
|
_response
|
524
633
|
)
|
525
634
|
elsif _response.status_code == 415
|
526
|
-
raise
|
527
|
-
'We don\'t support that media type.
|
528
|
-
' `application/json`.',
|
635
|
+
raise ApiErrorResponseException.new(
|
636
|
+
'We don\'t support that media type. If a request body is required,' \
|
637
|
+
' please send it to us as `application/json`.',
|
529
638
|
_response
|
530
639
|
)
|
531
640
|
elsif _response.status_code == 429
|
532
|
-
raise
|
641
|
+
raise ApiErrorResponseException.new(
|
533
642
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
534
643
|
' slow your request rate down and try again.',
|
535
644
|
_response
|
536
645
|
)
|
537
646
|
elsif _response.status_code == 500
|
538
|
-
raise
|
647
|
+
raise ApiErrorResponseException.new(
|
539
648
|
'Something unexpected happened. Please try again.',
|
540
649
|
_response
|
541
650
|
)
|
@@ -546,11 +655,339 @@ module Voice
|
|
546
655
|
ApiResponse.new(_response, data: _response.raw_body)
|
547
656
|
end
|
548
657
|
|
549
|
-
#
|
550
|
-
# recordings associated with the specified account
|
658
|
+
# Deletes the specified recording's media
|
551
659
|
# @param [String] account_id Required parameter: Example:
|
660
|
+
# @param [String] call_id Required parameter: Example:
|
661
|
+
# @param [String] recording_id Required parameter: Example:
|
662
|
+
# @return [void] response from the API call
|
663
|
+
def delete_recording_media(account_id,
|
664
|
+
call_id,
|
665
|
+
recording_id)
|
666
|
+
# Prepare query url.
|
667
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
668
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
669
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
670
|
+
_query_builder,
|
671
|
+
'accountId' => account_id,
|
672
|
+
'callId' => call_id,
|
673
|
+
'recordingId' => recording_id
|
674
|
+
)
|
675
|
+
_query_url = APIHelper.clean_url _query_builder
|
676
|
+
|
677
|
+
# Prepare and execute HttpRequest.
|
678
|
+
_request = config.http_client.delete(
|
679
|
+
_query_url
|
680
|
+
)
|
681
|
+
VoiceBasicAuth.apply(config, _request)
|
682
|
+
_response = execute_request(_request)
|
683
|
+
|
684
|
+
# Validate response against endpoint and global error codes.
|
685
|
+
if _response.status_code == 400
|
686
|
+
raise ApiErrorResponseException.new(
|
687
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
688
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
689
|
+
' before trying again.',
|
690
|
+
_response
|
691
|
+
)
|
692
|
+
elsif _response.status_code == 401
|
693
|
+
raise APIException.new(
|
694
|
+
'Please authenticate yourself.',
|
695
|
+
_response
|
696
|
+
)
|
697
|
+
elsif _response.status_code == 403
|
698
|
+
raise ApiErrorResponseException.new(
|
699
|
+
'Your credentials are invalid. Please use your API credentials for' \
|
700
|
+
' the Bandwidth Dashboard.',
|
701
|
+
_response
|
702
|
+
)
|
703
|
+
elsif _response.status_code == 404
|
704
|
+
raise ApiErrorResponseException.new(
|
705
|
+
'The resource specified cannot be found or does not belong to you.',
|
706
|
+
_response
|
707
|
+
)
|
708
|
+
elsif _response.status_code == 415
|
709
|
+
raise ApiErrorResponseException.new(
|
710
|
+
'We don\'t support that media type. If a request body is required,' \
|
711
|
+
' please send it to us as `application/json`.',
|
712
|
+
_response
|
713
|
+
)
|
714
|
+
elsif _response.status_code == 429
|
715
|
+
raise ApiErrorResponseException.new(
|
716
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
717
|
+
' slow your request rate down and try again.',
|
718
|
+
_response
|
719
|
+
)
|
720
|
+
elsif _response.status_code == 500
|
721
|
+
raise ApiErrorResponseException.new(
|
722
|
+
'Something unexpected happened. Please try again.',
|
723
|
+
_response
|
724
|
+
)
|
725
|
+
end
|
726
|
+
validate_response(_response)
|
727
|
+
|
728
|
+
# Return appropriate response type.
|
729
|
+
ApiResponse.new(_response)
|
730
|
+
end
|
731
|
+
|
732
|
+
# Downloads the specified transcription
|
733
|
+
# @param [String] account_id Required parameter: Example:
|
734
|
+
# @param [String] call_id Required parameter: Example:
|
735
|
+
# @param [String] recording_id Required parameter: Example:
|
736
|
+
# @return [TranscriptionResponse] response from the API call
|
737
|
+
def get_recording_transcription(account_id,
|
738
|
+
call_id,
|
739
|
+
recording_id)
|
740
|
+
# Prepare query url.
|
741
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
742
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
743
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
744
|
+
_query_builder,
|
745
|
+
'accountId' => account_id,
|
746
|
+
'callId' => call_id,
|
747
|
+
'recordingId' => recording_id
|
748
|
+
)
|
749
|
+
_query_url = APIHelper.clean_url _query_builder
|
750
|
+
|
751
|
+
# Prepare headers.
|
752
|
+
_headers = {
|
753
|
+
'accept' => 'application/json'
|
754
|
+
}
|
755
|
+
|
756
|
+
# Prepare and execute HttpRequest.
|
757
|
+
_request = config.http_client.get(
|
758
|
+
_query_url,
|
759
|
+
headers: _headers
|
760
|
+
)
|
761
|
+
VoiceBasicAuth.apply(config, _request)
|
762
|
+
_response = execute_request(_request)
|
763
|
+
|
764
|
+
# Validate response against endpoint and global error codes.
|
765
|
+
if _response.status_code == 400
|
766
|
+
raise ApiErrorResponseException.new(
|
767
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
768
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
769
|
+
' before trying again.',
|
770
|
+
_response
|
771
|
+
)
|
772
|
+
elsif _response.status_code == 401
|
773
|
+
raise APIException.new(
|
774
|
+
'Please authenticate yourself.',
|
775
|
+
_response
|
776
|
+
)
|
777
|
+
elsif _response.status_code == 403
|
778
|
+
raise ApiErrorResponseException.new(
|
779
|
+
'Your credentials are invalid. Please use your API credentials for' \
|
780
|
+
' the Bandwidth Dashboard.',
|
781
|
+
_response
|
782
|
+
)
|
783
|
+
elsif _response.status_code == 404
|
784
|
+
raise ApiErrorResponseException.new(
|
785
|
+
'The resource specified cannot be found or does not belong to you.',
|
786
|
+
_response
|
787
|
+
)
|
788
|
+
elsif _response.status_code == 415
|
789
|
+
raise ApiErrorResponseException.new(
|
790
|
+
'We don\'t support that media type. If a request body is required,' \
|
791
|
+
' please send it to us as `application/json`.',
|
792
|
+
_response
|
793
|
+
)
|
794
|
+
elsif _response.status_code == 429
|
795
|
+
raise ApiErrorResponseException.new(
|
796
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
797
|
+
' slow your request rate down and try again.',
|
798
|
+
_response
|
799
|
+
)
|
800
|
+
elsif _response.status_code == 500
|
801
|
+
raise ApiErrorResponseException.new(
|
802
|
+
'Something unexpected happened. Please try again.',
|
803
|
+
_response
|
804
|
+
)
|
805
|
+
end
|
806
|
+
validate_response(_response)
|
807
|
+
|
808
|
+
# Return appropriate response type.
|
809
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
810
|
+
ApiResponse.new(_response, data: TranscriptionResponse.from_hash(decoded))
|
811
|
+
end
|
812
|
+
|
813
|
+
# Requests that the specified recording be transcribed
|
814
|
+
# @param [String] account_id Required parameter: Example:
|
815
|
+
# @param [String] call_id Required parameter: Example:
|
816
|
+
# @param [String] recording_id Required parameter: Example:
|
817
|
+
# @param [ApiTranscribeRecordingRequest] body Optional parameter: Example:
|
818
|
+
# @return [void] response from the API call
|
819
|
+
def create_transcribe_recording(account_id,
|
820
|
+
call_id,
|
821
|
+
recording_id,
|
822
|
+
body: nil)
|
823
|
+
# Prepare query url.
|
824
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
825
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
826
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
827
|
+
_query_builder,
|
828
|
+
'accountId' => account_id,
|
829
|
+
'callId' => call_id,
|
830
|
+
'recordingId' => recording_id
|
831
|
+
)
|
832
|
+
_query_url = APIHelper.clean_url _query_builder
|
833
|
+
|
834
|
+
# Prepare headers.
|
835
|
+
_headers = {
|
836
|
+
'content-type' => 'application/json; charset=utf-8'
|
837
|
+
}
|
838
|
+
|
839
|
+
# Prepare and execute HttpRequest.
|
840
|
+
_request = config.http_client.post(
|
841
|
+
_query_url,
|
842
|
+
headers: _headers,
|
843
|
+
parameters: body.to_json
|
844
|
+
)
|
845
|
+
VoiceBasicAuth.apply(config, _request)
|
846
|
+
_response = execute_request(_request)
|
847
|
+
|
848
|
+
# Validate response against endpoint and global error codes.
|
849
|
+
if _response.status_code == 400
|
850
|
+
raise ApiErrorResponseException.new(
|
851
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
852
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
853
|
+
' before trying again.',
|
854
|
+
_response
|
855
|
+
)
|
856
|
+
elsif _response.status_code == 401
|
857
|
+
raise APIException.new(
|
858
|
+
'Please authenticate yourself.',
|
859
|
+
_response
|
860
|
+
)
|
861
|
+
elsif _response.status_code == 403
|
862
|
+
raise ApiErrorResponseException.new(
|
863
|
+
'Your credentials are invalid. Please use your API credentials for' \
|
864
|
+
' the Bandwidth Dashboard.',
|
865
|
+
_response
|
866
|
+
)
|
867
|
+
elsif _response.status_code == 404
|
868
|
+
raise ApiErrorResponseException.new(
|
869
|
+
'The resource specified cannot be found or does not belong to you.',
|
870
|
+
_response
|
871
|
+
)
|
872
|
+
elsif _response.status_code == 410
|
873
|
+
raise ApiErrorResponseException.new(
|
874
|
+
'The media for this recording has been deleted, so we can\'t' \
|
875
|
+
' transcribe it',
|
876
|
+
_response
|
877
|
+
)
|
878
|
+
elsif _response.status_code == 415
|
879
|
+
raise ApiErrorResponseException.new(
|
880
|
+
'We don\'t support that media type. If a request body is required,' \
|
881
|
+
' please send it to us as `application/json`.',
|
882
|
+
_response
|
883
|
+
)
|
884
|
+
elsif _response.status_code == 429
|
885
|
+
raise ApiErrorResponseException.new(
|
886
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
887
|
+
' slow your request rate down and try again.',
|
888
|
+
_response
|
889
|
+
)
|
890
|
+
elsif _response.status_code == 500
|
891
|
+
raise ApiErrorResponseException.new(
|
892
|
+
'Something unexpected happened. Please try again.',
|
893
|
+
_response
|
894
|
+
)
|
895
|
+
end
|
896
|
+
validate_response(_response)
|
897
|
+
|
898
|
+
# Return appropriate response type.
|
899
|
+
ApiResponse.new(_response)
|
900
|
+
end
|
901
|
+
|
902
|
+
# Deletes the specified recording's transcription
|
903
|
+
# @param [String] account_id Required parameter: Example:
|
904
|
+
# @param [String] call_id Required parameter: Example:
|
905
|
+
# @param [String] recording_id Required parameter: Example:
|
906
|
+
# @return [void] response from the API call
|
907
|
+
def delete_recording_transcription(account_id,
|
908
|
+
call_id,
|
909
|
+
recording_id)
|
910
|
+
# Prepare query url.
|
911
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
912
|
+
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
913
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
914
|
+
_query_builder,
|
915
|
+
'accountId' => account_id,
|
916
|
+
'callId' => call_id,
|
917
|
+
'recordingId' => recording_id
|
918
|
+
)
|
919
|
+
_query_url = APIHelper.clean_url _query_builder
|
920
|
+
|
921
|
+
# Prepare and execute HttpRequest.
|
922
|
+
_request = config.http_client.delete(
|
923
|
+
_query_url
|
924
|
+
)
|
925
|
+
VoiceBasicAuth.apply(config, _request)
|
926
|
+
_response = execute_request(_request)
|
927
|
+
|
928
|
+
# Validate response against endpoint and global error codes.
|
929
|
+
if _response.status_code == 400
|
930
|
+
raise ApiErrorResponseException.new(
|
931
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
932
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
933
|
+
' before trying again.',
|
934
|
+
_response
|
935
|
+
)
|
936
|
+
elsif _response.status_code == 401
|
937
|
+
raise APIException.new(
|
938
|
+
'Please authenticate yourself.',
|
939
|
+
_response
|
940
|
+
)
|
941
|
+
elsif _response.status_code == 403
|
942
|
+
raise ApiErrorResponseException.new(
|
943
|
+
'Your credentials are invalid. Please use your API credentials for' \
|
944
|
+
' the Bandwidth Dashboard.',
|
945
|
+
_response
|
946
|
+
)
|
947
|
+
elsif _response.status_code == 404
|
948
|
+
raise ApiErrorResponseException.new(
|
949
|
+
'The resource specified cannot be found or does not belong to you.',
|
950
|
+
_response
|
951
|
+
)
|
952
|
+
elsif _response.status_code == 415
|
953
|
+
raise ApiErrorResponseException.new(
|
954
|
+
'We don\'t support that media type. If a request body is required,' \
|
955
|
+
' please send it to us as `application/json`.',
|
956
|
+
_response
|
957
|
+
)
|
958
|
+
elsif _response.status_code == 429
|
959
|
+
raise ApiErrorResponseException.new(
|
960
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
961
|
+
' slow your request rate down and try again.',
|
962
|
+
_response
|
963
|
+
)
|
964
|
+
elsif _response.status_code == 500
|
965
|
+
raise ApiErrorResponseException.new(
|
966
|
+
'Something unexpected happened. Please try again.',
|
967
|
+
_response
|
968
|
+
)
|
969
|
+
end
|
970
|
+
validate_response(_response)
|
971
|
+
|
972
|
+
# Return appropriate response type.
|
973
|
+
ApiResponse.new(_response)
|
974
|
+
end
|
975
|
+
|
976
|
+
# Returns a list of metadata for the recordings associated with the
|
977
|
+
# specified account. The list can be filtered by the optional from, to,
|
978
|
+
# minStartTime, and maxStartTime arguments. The list is capped at 1000
|
979
|
+
# entries and may be empty if no recordings match the specified criteria.
|
980
|
+
# @param [String] account_id Required parameter: Example:
|
981
|
+
# @param [String] from Optional parameter: Example:
|
982
|
+
# @param [String] to Optional parameter: Example:
|
983
|
+
# @param [String] min_start_time Optional parameter: Example:
|
984
|
+
# @param [String] max_start_time Optional parameter: Example:
|
552
985
|
# @return [List of RecordingMetadataResponse] response from the API call
|
553
|
-
def get_query_metadata_for_account(account_id
|
986
|
+
def get_query_metadata_for_account(account_id,
|
987
|
+
from: nil,
|
988
|
+
to: nil,
|
989
|
+
min_start_time: nil,
|
990
|
+
max_start_time: nil)
|
554
991
|
# Prepare query url.
|
555
992
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
556
993
|
_query_builder << '/api/v2/accounts/{accountId}/recordings'
|
@@ -558,6 +995,13 @@ module Voice
|
|
558
995
|
_query_builder,
|
559
996
|
'accountId' => account_id
|
560
997
|
)
|
998
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
999
|
+
_query_builder,
|
1000
|
+
'from' => from,
|
1001
|
+
'to' => to,
|
1002
|
+
'minStartTime' => min_start_time,
|
1003
|
+
'maxStartTime' => max_start_time
|
1004
|
+
)
|
561
1005
|
_query_url = APIHelper.clean_url _query_builder
|
562
1006
|
|
563
1007
|
# Prepare headers.
|
@@ -575,36 +1019,42 @@ module Voice
|
|
575
1019
|
|
576
1020
|
# Validate response against endpoint and global error codes.
|
577
1021
|
if _response.status_code == 400
|
578
|
-
raise
|
579
|
-
'Something
|
1022
|
+
raise ApiErrorResponseException.new(
|
1023
|
+
'Something\'s not quite right... Either your request is invalid or' \
|
1024
|
+
' you\'re requesting it at a bad time. Please fix it' \
|
580
1025
|
' before trying again.',
|
581
1026
|
_response
|
582
1027
|
)
|
583
1028
|
elsif _response.status_code == 401
|
584
1029
|
raise APIException.new(
|
585
|
-
'Please authenticate yourself',
|
1030
|
+
'Please authenticate yourself.',
|
586
1031
|
_response
|
587
1032
|
)
|
588
1033
|
elsif _response.status_code == 403
|
589
|
-
raise
|
1034
|
+
raise ApiErrorResponseException.new(
|
590
1035
|
'Your credentials are invalid. Please use your API credentials for' \
|
591
1036
|
' the Bandwidth Dashboard.',
|
592
1037
|
_response
|
593
1038
|
)
|
1039
|
+
elsif _response.status_code == 404
|
1040
|
+
raise ApiErrorResponseException.new(
|
1041
|
+
'The resource specified cannot be found or does not belong to you.',
|
1042
|
+
_response
|
1043
|
+
)
|
594
1044
|
elsif _response.status_code == 415
|
595
|
-
raise
|
596
|
-
'We don\'t support that media type.
|
597
|
-
' `application/json`.',
|
1045
|
+
raise ApiErrorResponseException.new(
|
1046
|
+
'We don\'t support that media type. If a request body is required,' \
|
1047
|
+
' please send it to us as `application/json`.',
|
598
1048
|
_response
|
599
1049
|
)
|
600
1050
|
elsif _response.status_code == 429
|
601
|
-
raise
|
1051
|
+
raise ApiErrorResponseException.new(
|
602
1052
|
'You\'re sending requests to this endpoint too frequently. Please' \
|
603
1053
|
' slow your request rate down and try again.',
|
604
1054
|
_response
|
605
1055
|
)
|
606
1056
|
elsif _response.status_code == 500
|
607
|
-
raise
|
1057
|
+
raise ApiErrorResponseException.new(
|
608
1058
|
'Something unexpected happened. Please try again.',
|
609
1059
|
_response
|
610
1060
|
)
|