bandwidth-sdk 3.5.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bandwidth.rb +2 -0
- data/lib/bandwidth/api_helper.rb +14 -9
- data/lib/bandwidth/client.rb +13 -2
- data/lib/bandwidth/configuration.rb +46 -9
- data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
- data/lib/bandwidth/messaging_lib/messaging/client.rb +9 -2
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +18 -12
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +9 -2
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +14 -9
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +28 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
- data/lib/bandwidth/voice_lib/voice.rb +8 -2
- data/lib/bandwidth/voice_lib/voice/client.rb +9 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +625 -55
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
- data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +74 -2
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +32 -4
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +4 -1
- data/lib/bandwidth/voice_lib/voice/models/{status2_enum.rb → status3_enum.rb} +3 -3
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +34 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
- metadata +43 -11
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The Bridge verb allows you to connect 2 calls
|
6
|
+
class Bridge
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.Bridge(call_id, compact_hash({
|
11
|
+
'bridgeCompleteUrl' => bridge_complete_url,
|
12
|
+
'bridgeCompleteMethod' => bridge_complete_method,
|
13
|
+
'bridgeTargetCompleteUrl' => bridge_target_complete_url,
|
14
|
+
'bridgeTargetCompleteMethod' => bridge_target_complete_method,
|
15
|
+
'username' => username,
|
16
|
+
'password' => password,
|
17
|
+
'tag' => tag,
|
18
|
+
'bridgeCompleteFallbackUrl' => bridge_complete_fallback_url,
|
19
|
+
'bridgeCompleteFallbackMethod' => bridge_complete_fallback_method,
|
20
|
+
'bridgeTargetCompleteFallbackUrl' => bridge_target_complete_fallback_url,
|
21
|
+
'bridgeTargetCompleteFallbackMethod' => bridge_target_complete_fallback_method,
|
22
|
+
'fallbackUsername' => fallback_username,
|
23
|
+
'fallbackPassword' => fallback_password
|
24
|
+
}))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -20,7 +20,11 @@ module Bandwidth
|
|
20
20
|
'conferenceEventMethod' => conference_event_method,
|
21
21
|
'username' => username,
|
22
22
|
'password' => password,
|
23
|
-
'tag' => tag
|
23
|
+
'tag' => tag,
|
24
|
+
'conferenceEventFallbackUrl' => conference_event_fallback_url,
|
25
|
+
'conferenceEventFallbackMethod' => conference_event_fallback_method,
|
26
|
+
'fallbackUsername' => fallback_username,
|
27
|
+
'fallbackPassword' => fallback_password
|
24
28
|
}))
|
25
29
|
end
|
26
30
|
end
|
@@ -17,7 +17,11 @@ module Bandwidth
|
|
17
17
|
'username' => username,
|
18
18
|
'password' => password,
|
19
19
|
'firstDigitTimeout' => first_digit_timeout,
|
20
|
-
'repeatCount' => repeat_count
|
20
|
+
'repeatCount' => repeat_count,
|
21
|
+
'gatherFallbackUrl' => gather_fallback_url,
|
22
|
+
'gatherFallbackMethod' => gather_fallback_method,
|
23
|
+
'fallbackUsername' => fallback_username,
|
24
|
+
'fallbackPassword' => fallback_password
|
21
25
|
})) do
|
22
26
|
def embedded_xml(xml, property, type)
|
23
27
|
if property
|
@@ -12,7 +12,11 @@ module Bandwidth
|
|
12
12
|
'transferDisconnectMethod' => transfer_disconnect_method,
|
13
13
|
'username' => username,
|
14
14
|
'password' => password,
|
15
|
-
'tag' => tag
|
15
|
+
'tag' => tag,
|
16
|
+
'transferAnswerFallbackUrl' => transfer_answer_fallback_url,
|
17
|
+
'transferAnswerFallbackMethod' => transfer_answer_fallback_method,
|
18
|
+
'fallbackUsername' => fallback_username,
|
19
|
+
'fallbackPassword' => fallback_password
|
16
20
|
}))
|
17
21
|
end
|
18
22
|
end
|
@@ -21,7 +21,11 @@ module Bandwidth
|
|
21
21
|
'transcribe' => transcribe,
|
22
22
|
'transcriptionAvailableUrl' => transcription_available_url,
|
23
23
|
'transcriptionAvailableMethod' => transcription_available_method,
|
24
|
-
'silenceTimeout' => silence_timeout
|
24
|
+
'silenceTimeout' => silence_timeout,
|
25
|
+
'recordCompleteFallbackUrl' => record_complete_fallback_url,
|
26
|
+
'recordCompleteFallbackMethod' => record_complete_fallback_method,
|
27
|
+
'fallbackUsername' => fallback_username,
|
28
|
+
'fallbackPassword' => fallback_password
|
25
29
|
}))
|
26
30
|
end
|
27
31
|
end
|
@@ -12,7 +12,11 @@ module Bandwidth
|
|
12
12
|
'redirectMethod' => redirect_method,
|
13
13
|
'tag' => tag,
|
14
14
|
'username' => username,
|
15
|
-
'password' => password
|
15
|
+
'password' => password,
|
16
|
+
'redirectFallbackUrl' => redirect_fallback_url,
|
17
|
+
'redirectFallbackMethod' => redirect_fallback_method,
|
18
|
+
'fallbackUsername' => fallback_username,
|
19
|
+
'fallbackPassword' => fallback_password
|
16
20
|
}))
|
17
21
|
end
|
18
22
|
end
|
@@ -16,7 +16,11 @@ module Bandwidth
|
|
16
16
|
'username' => username,
|
17
17
|
'password' => password,
|
18
18
|
'diversionTreatment' => diversion_treatment,
|
19
|
-
'diversionReason' => diversion_reason
|
19
|
+
'diversionReason' => diversion_reason,
|
20
|
+
'transferCompleteFallbackUrl' => transfer_complete_fallback_url,
|
21
|
+
'transferCompleteFallbackMethod' => transfer_complete_fallback_method,
|
22
|
+
'fallbackUsername' => fallback_username,
|
23
|
+
'fallbackPassword' => fallback_password
|
20
24
|
})) do
|
21
25
|
def embedded_xml(xml, property, type)
|
22
26
|
if property
|
@@ -11,26 +11,32 @@ require_relative 'voice/models/api_call_response.rb'
|
|
11
11
|
require_relative 'voice/models/api_call_state_response.rb'
|
12
12
|
require_relative 'voice/models/api_create_call_request.rb'
|
13
13
|
require_relative 'voice/models/api_modify_call_request.rb'
|
14
|
-
require_relative 'voice/models/api_transcribe_recording_request.rb'
|
15
14
|
require_relative 'voice/models/call_engine_modify_conference_request.rb'
|
15
|
+
require_relative 'voice/models/api_transcribe_recording_request.rb'
|
16
|
+
require_relative 'voice/models/conference_detail.rb'
|
17
|
+
require_relative 'voice/models/conference_member_detail.rb'
|
18
|
+
require_relative 'voice/models/conference_recording_metadata_response.rb'
|
16
19
|
require_relative 'voice/models/modify_call_recording_state.rb'
|
17
20
|
require_relative 'voice/models/recording_metadata_response.rb'
|
18
21
|
require_relative 'voice/models/transcript.rb'
|
19
22
|
require_relative 'voice/models/transcription.rb'
|
20
23
|
require_relative 'voice/models/transcription_response.rb'
|
24
|
+
require_relative 'voice/models/answer_fallback_method_enum.rb'
|
21
25
|
require_relative 'voice/models/answer_method_enum.rb'
|
22
26
|
require_relative 'voice/models/callback_method_enum.rb'
|
27
|
+
require_relative 'voice/models/conference_event_method_enum.rb'
|
23
28
|
require_relative 'voice/models/direction_enum.rb'
|
24
29
|
require_relative 'voice/models/disconnect_cause_enum.rb'
|
25
30
|
require_relative 'voice/models/disconnect_method_enum.rb'
|
26
31
|
require_relative 'voice/models/file_format_enum.rb'
|
32
|
+
require_relative 'voice/models/redirect_fallback_method_enum.rb'
|
27
33
|
require_relative 'voice/models/redirect_method_enum.rb'
|
28
34
|
require_relative 'voice/models/state_enum.rb'
|
29
35
|
require_relative 'voice/models/state1_enum.rb'
|
30
36
|
require_relative 'voice/models/state2_enum.rb'
|
31
37
|
require_relative 'voice/models/status_enum.rb'
|
32
38
|
require_relative 'voice/models/status1_enum.rb'
|
33
|
-
require_relative 'voice/models/
|
39
|
+
require_relative 'voice/models/status3_enum.rb'
|
34
40
|
|
35
41
|
# Exceptions
|
36
42
|
require_relative 'voice/exceptions/api_error_response_exception.rb'
|
@@ -17,24 +17,31 @@ module Bandwidth
|
|
17
17
|
|
18
18
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
19
19
|
backoff_factor: 1, environment: Environment::PRODUCTION,
|
20
|
+
base_url: 'https://www.example.com',
|
20
21
|
messaging_basic_auth_user_name: 'TODO: Replace',
|
21
22
|
messaging_basic_auth_password: 'TODO: Replace',
|
22
23
|
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
23
24
|
two_factor_auth_basic_auth_password: 'TODO: Replace',
|
24
25
|
voice_basic_auth_user_name: 'TODO: Replace',
|
25
|
-
voice_basic_auth_password: 'TODO: Replace',
|
26
|
+
voice_basic_auth_password: 'TODO: Replace',
|
27
|
+
web_rtc_basic_auth_user_name: 'TODO: Replace',
|
28
|
+
web_rtc_basic_auth_password: 'TODO: Replace',
|
29
|
+
config: nil)
|
26
30
|
@config = if config.nil?
|
27
31
|
Configuration.new(timeout: timeout,
|
28
32
|
max_retries: max_retries,
|
29
33
|
retry_interval: retry_interval,
|
30
34
|
backoff_factor: backoff_factor,
|
31
35
|
environment: environment,
|
36
|
+
base_url: base_url,
|
32
37
|
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
|
33
38
|
messaging_basic_auth_password: messaging_basic_auth_password,
|
34
39
|
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
|
35
40
|
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
|
36
41
|
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
37
|
-
voice_basic_auth_password: voice_basic_auth_password
|
42
|
+
voice_basic_auth_password: voice_basic_auth_password,
|
43
|
+
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
|
44
|
+
web_rtc_basic_auth_password: web_rtc_basic_auth_password)
|
38
45
|
else
|
39
46
|
config
|
40
47
|
end
|
@@ -22,7 +22,7 @@ module Voice
|
|
22
22
|
_query_builder << '/api/v2/accounts/{accountId}/calls'
|
23
23
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
24
24
|
_query_builder,
|
25
|
-
'accountId' => account_id
|
25
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
26
26
|
)
|
27
27
|
_query_url = APIHelper.clean_url _query_builder
|
28
28
|
|
@@ -86,7 +86,9 @@ module Voice
|
|
86
86
|
|
87
87
|
# Return appropriate response type.
|
88
88
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
89
|
-
ApiResponse.new(
|
89
|
+
ApiResponse.new(
|
90
|
+
_response, data: ApiCallResponse.from_hash(decoded)
|
91
|
+
)
|
90
92
|
end
|
91
93
|
|
92
94
|
# Returns near-realtime metadata about the specified call
|
@@ -100,8 +102,8 @@ module Voice
|
|
100
102
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
101
103
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
102
104
|
_query_builder,
|
103
|
-
'accountId' => account_id,
|
104
|
-
'callId' => call_id
|
105
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
106
|
+
'callId' => { 'value' => call_id, 'encode' => true }
|
105
107
|
)
|
106
108
|
_query_url = APIHelper.clean_url _query_builder
|
107
109
|
|
@@ -163,7 +165,9 @@ module Voice
|
|
163
165
|
|
164
166
|
# Return appropriate response type.
|
165
167
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
166
|
-
ApiResponse.new(
|
168
|
+
ApiResponse.new(
|
169
|
+
_response, data: ApiCallStateResponse.from_hash(decoded)
|
170
|
+
)
|
167
171
|
end
|
168
172
|
|
169
173
|
# Interrupts and replaces an active call's BXML document
|
@@ -179,8 +183,8 @@ module Voice
|
|
179
183
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}'
|
180
184
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
181
185
|
_query_builder,
|
182
|
-
'accountId' => account_id,
|
183
|
-
'callId' => call_id
|
186
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
187
|
+
'callId' => { 'value' => call_id, 'encode' => true }
|
184
188
|
)
|
185
189
|
_query_url = APIHelper.clean_url _query_builder
|
186
190
|
|
@@ -258,8 +262,8 @@ module Voice
|
|
258
262
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recording'
|
259
263
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
260
264
|
_query_builder,
|
261
|
-
'accountId' => account_id,
|
262
|
-
'callId' => call_id
|
265
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
266
|
+
'callId' => { 'value' => call_id, 'encode' => true }
|
263
267
|
)
|
264
268
|
_query_url = APIHelper.clean_url _query_builder
|
265
269
|
|
@@ -328,31 +332,16 @@ module Voice
|
|
328
332
|
# took place during the specified call
|
329
333
|
# @param [String] account_id Required parameter: Example:
|
330
334
|
# @param [String] call_id Required parameter: Example:
|
331
|
-
# @param [String] from Optional parameter: Example:
|
332
|
-
# @param [String] to Optional parameter: Example:
|
333
|
-
# @param [String] min_start_time Optional parameter: Example:
|
334
|
-
# @param [String] max_start_time Optional parameter: Example:
|
335
335
|
# @return [List of RecordingMetadataResponse] response from the API call
|
336
336
|
def get_query_metadata_for_account_and_call(account_id,
|
337
|
-
call_id
|
338
|
-
from: nil,
|
339
|
-
to: nil,
|
340
|
-
min_start_time: nil,
|
341
|
-
max_start_time: nil)
|
337
|
+
call_id)
|
342
338
|
# Prepare query url.
|
343
339
|
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
344
340
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings'
|
345
341
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
346
342
|
_query_builder,
|
347
|
-
'accountId' => account_id,
|
348
|
-
'callId' => call_id
|
349
|
-
)
|
350
|
-
_query_builder = APIHelper.append_url_with_query_parameters(
|
351
|
-
_query_builder,
|
352
|
-
'from' => from,
|
353
|
-
'to' => to,
|
354
|
-
'minStartTime' => min_start_time,
|
355
|
-
'maxStartTime' => max_start_time
|
343
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
344
|
+
'callId' => { 'value' => call_id, 'encode' => true }
|
356
345
|
)
|
357
346
|
_query_url = APIHelper.clean_url _query_builder
|
358
347
|
|
@@ -433,9 +422,9 @@ module Voice
|
|
433
422
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
434
423
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
435
424
|
_query_builder,
|
436
|
-
'accountId' => account_id,
|
437
|
-
'callId' => call_id,
|
438
|
-
'recordingId' => recording_id
|
425
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
426
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
427
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
439
428
|
)
|
440
429
|
_query_url = APIHelper.clean_url _query_builder
|
441
430
|
|
@@ -497,8 +486,9 @@ module Voice
|
|
497
486
|
|
498
487
|
# Return appropriate response type.
|
499
488
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
500
|
-
ApiResponse.new(
|
501
|
-
|
489
|
+
ApiResponse.new(
|
490
|
+
_response, data: RecordingMetadataResponse.from_hash(decoded)
|
491
|
+
)
|
502
492
|
end
|
503
493
|
|
504
494
|
# Deletes the specified recording
|
@@ -514,9 +504,9 @@ module Voice
|
|
514
504
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}'
|
515
505
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
516
506
|
_query_builder,
|
517
|
-
'accountId' => account_id,
|
518
|
-
'callId' => call_id,
|
519
|
-
'recordingId' => recording_id
|
507
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
508
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
509
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
520
510
|
)
|
521
511
|
_query_url = APIHelper.clean_url _query_builder
|
522
512
|
|
@@ -587,9 +577,9 @@ module Voice
|
|
587
577
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
588
578
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
589
579
|
_query_builder,
|
590
|
-
'accountId' => account_id,
|
591
|
-
'callId' => call_id,
|
592
|
-
'recordingId' => recording_id
|
580
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
581
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
582
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
593
583
|
)
|
594
584
|
_query_url = APIHelper.clean_url _query_builder
|
595
585
|
|
@@ -644,7 +634,9 @@ module Voice
|
|
644
634
|
validate_response(_response)
|
645
635
|
|
646
636
|
# Return appropriate response type.
|
647
|
-
ApiResponse.new(
|
637
|
+
ApiResponse.new(
|
638
|
+
_response, data: _response.raw_body
|
639
|
+
)
|
648
640
|
end
|
649
641
|
|
650
642
|
# Deletes the specified recording's media
|
@@ -660,9 +652,9 @@ module Voice
|
|
660
652
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media'
|
661
653
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
662
654
|
_query_builder,
|
663
|
-
'accountId' => account_id,
|
664
|
-
'callId' => call_id,
|
665
|
-
'recordingId' => recording_id
|
655
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
656
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
657
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
666
658
|
)
|
667
659
|
_query_url = APIHelper.clean_url _query_builder
|
668
660
|
|
@@ -733,9 +725,9 @@ module Voice
|
|
733
725
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
734
726
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
735
727
|
_query_builder,
|
736
|
-
'accountId' => account_id,
|
737
|
-
'callId' => call_id,
|
738
|
-
'recordingId' => recording_id
|
728
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
729
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
730
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
739
731
|
)
|
740
732
|
_query_url = APIHelper.clean_url _query_builder
|
741
733
|
|
@@ -797,7 +789,9 @@ module Voice
|
|
797
789
|
|
798
790
|
# Return appropriate response type.
|
799
791
|
decoded = APIHelper.json_deserialize(_response.raw_body)
|
800
|
-
ApiResponse.new(
|
792
|
+
ApiResponse.new(
|
793
|
+
_response, data: TranscriptionResponse.from_hash(decoded)
|
794
|
+
)
|
801
795
|
end
|
802
796
|
|
803
797
|
# Requests that the specified recording be transcribed
|
@@ -815,9 +809,9 @@ module Voice
|
|
815
809
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
816
810
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
817
811
|
_query_builder,
|
818
|
-
'accountId' => account_id,
|
819
|
-
'callId' => call_id,
|
820
|
-
'recordingId' => recording_id
|
812
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
813
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
814
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
821
815
|
)
|
822
816
|
_query_url = APIHelper.clean_url _query_builder
|
823
817
|
|
@@ -901,9 +895,9 @@ module Voice
|
|
901
895
|
_query_builder << '/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription'
|
902
896
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
903
897
|
_query_builder,
|
904
|
-
'accountId' => account_id,
|
905
|
-
'callId' => call_id,
|
906
|
-
'recordingId' => recording_id
|
898
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
899
|
+
'callId' => { 'value' => call_id, 'encode' => true },
|
900
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
907
901
|
)
|
908
902
|
_query_url = APIHelper.clean_url _query_builder
|
909
903
|
|
@@ -961,6 +955,180 @@ module Voice
|
|
961
955
|
ApiResponse.new(_response)
|
962
956
|
end
|
963
957
|
|
958
|
+
# Returns information about the conferences in the account
|
959
|
+
# @param [String] account_id Required parameter: Example:
|
960
|
+
# @param [Integer] page_size Optional parameter: Example:1000
|
961
|
+
# @param [String] page_token Optional parameter: Example:
|
962
|
+
# @param [String] name Optional parameter: Example:
|
963
|
+
# @param [String] min_created_time Optional parameter: Example:
|
964
|
+
# @param [String] max_created_time Optional parameter: Example:
|
965
|
+
# @return [List of ConferenceDetail] response from the API call
|
966
|
+
def get_conferences_by_account(account_id,
|
967
|
+
page_size: 1000,
|
968
|
+
page_token: nil,
|
969
|
+
name: nil,
|
970
|
+
min_created_time: nil,
|
971
|
+
max_created_time: nil)
|
972
|
+
# Prepare query url.
|
973
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
974
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences'
|
975
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
976
|
+
_query_builder,
|
977
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
978
|
+
)
|
979
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
980
|
+
_query_builder,
|
981
|
+
'pageSize' => page_size,
|
982
|
+
'pageToken' => page_token,
|
983
|
+
'name' => name,
|
984
|
+
'minCreatedTime' => min_created_time,
|
985
|
+
'maxCreatedTime' => max_created_time
|
986
|
+
)
|
987
|
+
_query_url = APIHelper.clean_url _query_builder
|
988
|
+
|
989
|
+
# Prepare headers.
|
990
|
+
_headers = {
|
991
|
+
'accept' => 'application/json'
|
992
|
+
}
|
993
|
+
|
994
|
+
# Prepare and execute HttpRequest.
|
995
|
+
_request = config.http_client.get(
|
996
|
+
_query_url,
|
997
|
+
headers: _headers
|
998
|
+
)
|
999
|
+
VoiceBasicAuth.apply(config, _request)
|
1000
|
+
_response = execute_request(_request)
|
1001
|
+
|
1002
|
+
# Validate response against endpoint and global error codes.
|
1003
|
+
if _response.status_code == 400
|
1004
|
+
raise ApiErrorResponseException.new(
|
1005
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1006
|
+
' fix it before trying again.',
|
1007
|
+
_response
|
1008
|
+
)
|
1009
|
+
elsif _response.status_code == 401
|
1010
|
+
raise APIException.new(
|
1011
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1012
|
+
' credentials to authenticate to the API.',
|
1013
|
+
_response
|
1014
|
+
)
|
1015
|
+
elsif _response.status_code == 403
|
1016
|
+
raise ApiErrorResponseException.new(
|
1017
|
+
'User unauthorized to perform this action.',
|
1018
|
+
_response
|
1019
|
+
)
|
1020
|
+
elsif _response.status_code == 404
|
1021
|
+
raise ApiErrorResponseException.new(
|
1022
|
+
'The resource specified cannot be found or does not belong to you.',
|
1023
|
+
_response
|
1024
|
+
)
|
1025
|
+
elsif _response.status_code == 415
|
1026
|
+
raise ApiErrorResponseException.new(
|
1027
|
+
'We don\'t support that media type. If a request body is required,' \
|
1028
|
+
' please send it to us as `application/json`.',
|
1029
|
+
_response
|
1030
|
+
)
|
1031
|
+
elsif _response.status_code == 429
|
1032
|
+
raise ApiErrorResponseException.new(
|
1033
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1034
|
+
' slow your request rate down and try again.',
|
1035
|
+
_response
|
1036
|
+
)
|
1037
|
+
elsif _response.status_code == 500
|
1038
|
+
raise ApiErrorResponseException.new(
|
1039
|
+
'Something unexpected happened. Please try again.',
|
1040
|
+
_response
|
1041
|
+
)
|
1042
|
+
end
|
1043
|
+
validate_response(_response)
|
1044
|
+
|
1045
|
+
# Return appropriate response type.
|
1046
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1047
|
+
ApiResponse.new(
|
1048
|
+
_response,
|
1049
|
+
data: decoded.map { |element| ConferenceDetail.from_hash(element) }
|
1050
|
+
)
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
# Returns information about the specified conference
|
1054
|
+
# @param [String] account_id Required parameter: Example:
|
1055
|
+
# @param [String] conference_id Required parameter: Example:
|
1056
|
+
# @return [ConferenceDetail] response from the API call
|
1057
|
+
def get_conference_by_id(account_id,
|
1058
|
+
conference_id)
|
1059
|
+
# Prepare query url.
|
1060
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1061
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
1062
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1063
|
+
_query_builder,
|
1064
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1065
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true }
|
1066
|
+
)
|
1067
|
+
_query_url = APIHelper.clean_url _query_builder
|
1068
|
+
|
1069
|
+
# Prepare headers.
|
1070
|
+
_headers = {
|
1071
|
+
'accept' => 'application/json'
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
# Prepare and execute HttpRequest.
|
1075
|
+
_request = config.http_client.get(
|
1076
|
+
_query_url,
|
1077
|
+
headers: _headers
|
1078
|
+
)
|
1079
|
+
VoiceBasicAuth.apply(config, _request)
|
1080
|
+
_response = execute_request(_request)
|
1081
|
+
|
1082
|
+
# Validate response against endpoint and global error codes.
|
1083
|
+
if _response.status_code == 400
|
1084
|
+
raise ApiErrorResponseException.new(
|
1085
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1086
|
+
' fix it before trying again.',
|
1087
|
+
_response
|
1088
|
+
)
|
1089
|
+
elsif _response.status_code == 401
|
1090
|
+
raise APIException.new(
|
1091
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1092
|
+
' credentials to authenticate to the API.',
|
1093
|
+
_response
|
1094
|
+
)
|
1095
|
+
elsif _response.status_code == 403
|
1096
|
+
raise ApiErrorResponseException.new(
|
1097
|
+
'User unauthorized to perform this action.',
|
1098
|
+
_response
|
1099
|
+
)
|
1100
|
+
elsif _response.status_code == 404
|
1101
|
+
raise ApiErrorResponseException.new(
|
1102
|
+
'The resource specified cannot be found or does not belong to you.',
|
1103
|
+
_response
|
1104
|
+
)
|
1105
|
+
elsif _response.status_code == 415
|
1106
|
+
raise ApiErrorResponseException.new(
|
1107
|
+
'We don\'t support that media type. If a request body is required,' \
|
1108
|
+
' please send it to us as `application/json`.',
|
1109
|
+
_response
|
1110
|
+
)
|
1111
|
+
elsif _response.status_code == 429
|
1112
|
+
raise ApiErrorResponseException.new(
|
1113
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1114
|
+
' slow your request rate down and try again.',
|
1115
|
+
_response
|
1116
|
+
)
|
1117
|
+
elsif _response.status_code == 500
|
1118
|
+
raise ApiErrorResponseException.new(
|
1119
|
+
'Something unexpected happened. Please try again.',
|
1120
|
+
_response
|
1121
|
+
)
|
1122
|
+
end
|
1123
|
+
validate_response(_response)
|
1124
|
+
|
1125
|
+
# Return appropriate response type.
|
1126
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1127
|
+
ApiResponse.new(
|
1128
|
+
_response, data: ConferenceDetail.from_hash(decoded)
|
1129
|
+
)
|
1130
|
+
end
|
1131
|
+
|
964
1132
|
# Modify the conference state
|
965
1133
|
# @param [String] account_id Required parameter: Example:
|
966
1134
|
# @param [String] conference_id Required parameter: Example:
|
@@ -975,8 +1143,8 @@ module Voice
|
|
975
1143
|
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
976
1144
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
977
1145
|
_query_builder,
|
978
|
-
'accountId' => account_id,
|
979
|
-
'conferenceId' => conference_id
|
1146
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1147
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true }
|
980
1148
|
)
|
981
1149
|
_query_url = APIHelper.clean_url _query_builder
|
982
1150
|
|
@@ -1041,6 +1209,408 @@ module Voice
|
|
1041
1209
|
ApiResponse.new(_response)
|
1042
1210
|
end
|
1043
1211
|
|
1212
|
+
# Updates settings for a particular conference member
|
1213
|
+
# @param [String] account_id Required parameter: Example:
|
1214
|
+
# @param [String] conference_id Required parameter: Example:
|
1215
|
+
# @param [String] call_id Required parameter: Example:
|
1216
|
+
# @param [ConferenceMemberDetail] body Optional parameter: Example:
|
1217
|
+
# @return [void] response from the API call
|
1218
|
+
def modify_conference_member(account_id,
|
1219
|
+
conference_id,
|
1220
|
+
call_id,
|
1221
|
+
body: nil)
|
1222
|
+
# Prepare query url.
|
1223
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1224
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}'
|
1225
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1226
|
+
_query_builder,
|
1227
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1228
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true },
|
1229
|
+
'callId' => { 'value' => call_id, 'encode' => true }
|
1230
|
+
)
|
1231
|
+
_query_url = APIHelper.clean_url _query_builder
|
1232
|
+
|
1233
|
+
# Prepare headers.
|
1234
|
+
_headers = {
|
1235
|
+
'content-type' => 'application/json; charset=utf-8'
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
# Prepare and execute HttpRequest.
|
1239
|
+
_request = config.http_client.put(
|
1240
|
+
_query_url,
|
1241
|
+
headers: _headers,
|
1242
|
+
parameters: body.to_json
|
1243
|
+
)
|
1244
|
+
VoiceBasicAuth.apply(config, _request)
|
1245
|
+
_response = execute_request(_request)
|
1246
|
+
|
1247
|
+
# Validate response against endpoint and global error codes.
|
1248
|
+
if _response.status_code == 400
|
1249
|
+
raise ApiErrorResponseException.new(
|
1250
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1251
|
+
' fix it before trying again.',
|
1252
|
+
_response
|
1253
|
+
)
|
1254
|
+
elsif _response.status_code == 401
|
1255
|
+
raise APIException.new(
|
1256
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1257
|
+
' credentials to authenticate to the API.',
|
1258
|
+
_response
|
1259
|
+
)
|
1260
|
+
elsif _response.status_code == 403
|
1261
|
+
raise ApiErrorResponseException.new(
|
1262
|
+
'User unauthorized to perform this action.',
|
1263
|
+
_response
|
1264
|
+
)
|
1265
|
+
elsif _response.status_code == 404
|
1266
|
+
raise ApiErrorResponseException.new(
|
1267
|
+
'The resource specified cannot be found or does not belong to you.',
|
1268
|
+
_response
|
1269
|
+
)
|
1270
|
+
elsif _response.status_code == 415
|
1271
|
+
raise ApiErrorResponseException.new(
|
1272
|
+
'We don\'t support that media type. If a request body is required,' \
|
1273
|
+
' please send it to us as `application/json`.',
|
1274
|
+
_response
|
1275
|
+
)
|
1276
|
+
elsif _response.status_code == 429
|
1277
|
+
raise ApiErrorResponseException.new(
|
1278
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1279
|
+
' slow your request rate down and try again.',
|
1280
|
+
_response
|
1281
|
+
)
|
1282
|
+
elsif _response.status_code == 500
|
1283
|
+
raise ApiErrorResponseException.new(
|
1284
|
+
'Something unexpected happened. Please try again.',
|
1285
|
+
_response
|
1286
|
+
)
|
1287
|
+
end
|
1288
|
+
validate_response(_response)
|
1289
|
+
|
1290
|
+
# Return appropriate response type.
|
1291
|
+
ApiResponse.new(_response)
|
1292
|
+
end
|
1293
|
+
|
1294
|
+
# Returns information about the specified conference member
|
1295
|
+
# @param [String] account_id Required parameter: Example:
|
1296
|
+
# @param [String] conference_id Required parameter: Example:
|
1297
|
+
# @param [String] member_id Required parameter: Example:
|
1298
|
+
# @return [ConferenceMemberDetail] response from the API call
|
1299
|
+
def get_conference_member(account_id,
|
1300
|
+
conference_id,
|
1301
|
+
member_id)
|
1302
|
+
# Prepare query url.
|
1303
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1304
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}'
|
1305
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1306
|
+
_query_builder,
|
1307
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1308
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true },
|
1309
|
+
'memberId' => { 'value' => member_id, 'encode' => true }
|
1310
|
+
)
|
1311
|
+
_query_url = APIHelper.clean_url _query_builder
|
1312
|
+
|
1313
|
+
# Prepare headers.
|
1314
|
+
_headers = {
|
1315
|
+
'accept' => 'application/json'
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
# Prepare and execute HttpRequest.
|
1319
|
+
_request = config.http_client.get(
|
1320
|
+
_query_url,
|
1321
|
+
headers: _headers
|
1322
|
+
)
|
1323
|
+
VoiceBasicAuth.apply(config, _request)
|
1324
|
+
_response = execute_request(_request)
|
1325
|
+
|
1326
|
+
# Validate response against endpoint and global error codes.
|
1327
|
+
if _response.status_code == 400
|
1328
|
+
raise ApiErrorResponseException.new(
|
1329
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1330
|
+
' fix it before trying again.',
|
1331
|
+
_response
|
1332
|
+
)
|
1333
|
+
elsif _response.status_code == 401
|
1334
|
+
raise APIException.new(
|
1335
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1336
|
+
' credentials to authenticate to the API.',
|
1337
|
+
_response
|
1338
|
+
)
|
1339
|
+
elsif _response.status_code == 403
|
1340
|
+
raise ApiErrorResponseException.new(
|
1341
|
+
'User unauthorized to perform this action.',
|
1342
|
+
_response
|
1343
|
+
)
|
1344
|
+
elsif _response.status_code == 404
|
1345
|
+
raise ApiErrorResponseException.new(
|
1346
|
+
'The resource specified cannot be found or does not belong to you.',
|
1347
|
+
_response
|
1348
|
+
)
|
1349
|
+
elsif _response.status_code == 415
|
1350
|
+
raise ApiErrorResponseException.new(
|
1351
|
+
'We don\'t support that media type. If a request body is required,' \
|
1352
|
+
' please send it to us as `application/json`.',
|
1353
|
+
_response
|
1354
|
+
)
|
1355
|
+
elsif _response.status_code == 429
|
1356
|
+
raise ApiErrorResponseException.new(
|
1357
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1358
|
+
' slow your request rate down and try again.',
|
1359
|
+
_response
|
1360
|
+
)
|
1361
|
+
elsif _response.status_code == 500
|
1362
|
+
raise ApiErrorResponseException.new(
|
1363
|
+
'Something unexpected happened. Please try again.',
|
1364
|
+
_response
|
1365
|
+
)
|
1366
|
+
end
|
1367
|
+
validate_response(_response)
|
1368
|
+
|
1369
|
+
# Return appropriate response type.
|
1370
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1371
|
+
ApiResponse.new(
|
1372
|
+
_response, data: ConferenceMemberDetail.from_hash(decoded)
|
1373
|
+
)
|
1374
|
+
end
|
1375
|
+
|
1376
|
+
# Returns a (potentially empty) list of metadata for the recordings that
|
1377
|
+
# took place during the specified conference
|
1378
|
+
# @param [String] account_id Required parameter: Example:
|
1379
|
+
# @param [String] conference_id Required parameter: Example:
|
1380
|
+
# @return [List of ConferenceRecordingMetadataResponse] response from the API call
|
1381
|
+
def get_query_metadata_for_account_and_conference(account_id,
|
1382
|
+
conference_id)
|
1383
|
+
# Prepare query url.
|
1384
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1385
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings'
|
1386
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1387
|
+
_query_builder,
|
1388
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1389
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true }
|
1390
|
+
)
|
1391
|
+
_query_url = APIHelper.clean_url _query_builder
|
1392
|
+
|
1393
|
+
# Prepare headers.
|
1394
|
+
_headers = {
|
1395
|
+
'accept' => 'application/json'
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
# Prepare and execute HttpRequest.
|
1399
|
+
_request = config.http_client.get(
|
1400
|
+
_query_url,
|
1401
|
+
headers: _headers
|
1402
|
+
)
|
1403
|
+
VoiceBasicAuth.apply(config, _request)
|
1404
|
+
_response = execute_request(_request)
|
1405
|
+
|
1406
|
+
# Validate response against endpoint and global error codes.
|
1407
|
+
if _response.status_code == 400
|
1408
|
+
raise ApiErrorResponseException.new(
|
1409
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1410
|
+
' fix it before trying again.',
|
1411
|
+
_response
|
1412
|
+
)
|
1413
|
+
elsif _response.status_code == 401
|
1414
|
+
raise APIException.new(
|
1415
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1416
|
+
' credentials to authenticate to the API.',
|
1417
|
+
_response
|
1418
|
+
)
|
1419
|
+
elsif _response.status_code == 403
|
1420
|
+
raise ApiErrorResponseException.new(
|
1421
|
+
'User unauthorized to perform this action.',
|
1422
|
+
_response
|
1423
|
+
)
|
1424
|
+
elsif _response.status_code == 404
|
1425
|
+
raise ApiErrorResponseException.new(
|
1426
|
+
'The resource specified cannot be found or does not belong to you.',
|
1427
|
+
_response
|
1428
|
+
)
|
1429
|
+
elsif _response.status_code == 415
|
1430
|
+
raise ApiErrorResponseException.new(
|
1431
|
+
'We don\'t support that media type. If a request body is required,' \
|
1432
|
+
' please send it to us as `application/json`.',
|
1433
|
+
_response
|
1434
|
+
)
|
1435
|
+
elsif _response.status_code == 429
|
1436
|
+
raise ApiErrorResponseException.new(
|
1437
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1438
|
+
' slow your request rate down and try again.',
|
1439
|
+
_response
|
1440
|
+
)
|
1441
|
+
elsif _response.status_code == 500
|
1442
|
+
raise ApiErrorResponseException.new(
|
1443
|
+
'Something unexpected happened. Please try again.',
|
1444
|
+
_response
|
1445
|
+
)
|
1446
|
+
end
|
1447
|
+
validate_response(_response)
|
1448
|
+
|
1449
|
+
# Return appropriate response type.
|
1450
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1451
|
+
ApiResponse.new(
|
1452
|
+
_response,
|
1453
|
+
data: decoded.map { |element| ConferenceRecordingMetadataResponse.from_hash(element) }
|
1454
|
+
)
|
1455
|
+
end
|
1456
|
+
|
1457
|
+
# Returns metadata for the specified recording
|
1458
|
+
# @param [String] account_id Required parameter: Example:
|
1459
|
+
# @param [String] conference_id Required parameter: Example:
|
1460
|
+
# @param [String] recording_id Required parameter: Example:
|
1461
|
+
# @return [RecordingMetadataResponse] response from the API call
|
1462
|
+
def get_metadata_for_conference_recording(account_id,
|
1463
|
+
conference_id,
|
1464
|
+
recording_id)
|
1465
|
+
# Prepare query url.
|
1466
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1467
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}'
|
1468
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1469
|
+
_query_builder,
|
1470
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1471
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true },
|
1472
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
1473
|
+
)
|
1474
|
+
_query_url = APIHelper.clean_url _query_builder
|
1475
|
+
|
1476
|
+
# Prepare headers.
|
1477
|
+
_headers = {
|
1478
|
+
'accept' => 'application/json'
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
# Prepare and execute HttpRequest.
|
1482
|
+
_request = config.http_client.get(
|
1483
|
+
_query_url,
|
1484
|
+
headers: _headers
|
1485
|
+
)
|
1486
|
+
VoiceBasicAuth.apply(config, _request)
|
1487
|
+
_response = execute_request(_request)
|
1488
|
+
|
1489
|
+
# Validate response against endpoint and global error codes.
|
1490
|
+
if _response.status_code == 400
|
1491
|
+
raise ApiErrorResponseException.new(
|
1492
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1493
|
+
' fix it before trying again.',
|
1494
|
+
_response
|
1495
|
+
)
|
1496
|
+
elsif _response.status_code == 401
|
1497
|
+
raise APIException.new(
|
1498
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1499
|
+
' credentials to authenticate to the API.',
|
1500
|
+
_response
|
1501
|
+
)
|
1502
|
+
elsif _response.status_code == 403
|
1503
|
+
raise ApiErrorResponseException.new(
|
1504
|
+
'User unauthorized to perform this action.',
|
1505
|
+
_response
|
1506
|
+
)
|
1507
|
+
elsif _response.status_code == 404
|
1508
|
+
raise ApiErrorResponseException.new(
|
1509
|
+
'The resource specified cannot be found or does not belong to you.',
|
1510
|
+
_response
|
1511
|
+
)
|
1512
|
+
elsif _response.status_code == 415
|
1513
|
+
raise ApiErrorResponseException.new(
|
1514
|
+
'We don\'t support that media type. If a request body is required,' \
|
1515
|
+
' please send it to us as `application/json`.',
|
1516
|
+
_response
|
1517
|
+
)
|
1518
|
+
elsif _response.status_code == 429
|
1519
|
+
raise ApiErrorResponseException.new(
|
1520
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1521
|
+
' slow your request rate down and try again.',
|
1522
|
+
_response
|
1523
|
+
)
|
1524
|
+
elsif _response.status_code == 500
|
1525
|
+
raise ApiErrorResponseException.new(
|
1526
|
+
'Something unexpected happened. Please try again.',
|
1527
|
+
_response
|
1528
|
+
)
|
1529
|
+
end
|
1530
|
+
validate_response(_response)
|
1531
|
+
|
1532
|
+
# Return appropriate response type.
|
1533
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
1534
|
+
ApiResponse.new(
|
1535
|
+
_response, data: RecordingMetadataResponse.from_hash(decoded)
|
1536
|
+
)
|
1537
|
+
end
|
1538
|
+
|
1539
|
+
# Downloads the specified recording
|
1540
|
+
# @param [String] account_id Required parameter: Example:
|
1541
|
+
# @param [String] conference_id Required parameter: Example:
|
1542
|
+
# @param [String] recording_id Required parameter: Example:
|
1543
|
+
# @return [Binary] response from the API call
|
1544
|
+
def get_stream_conference_recording_media(account_id,
|
1545
|
+
conference_id,
|
1546
|
+
recording_id)
|
1547
|
+
# Prepare query url.
|
1548
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
1549
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'
|
1550
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
1551
|
+
_query_builder,
|
1552
|
+
'accountId' => { 'value' => account_id, 'encode' => true },
|
1553
|
+
'conferenceId' => { 'value' => conference_id, 'encode' => true },
|
1554
|
+
'recordingId' => { 'value' => recording_id, 'encode' => true }
|
1555
|
+
)
|
1556
|
+
_query_url = APIHelper.clean_url _query_builder
|
1557
|
+
|
1558
|
+
# Prepare and execute HttpRequest.
|
1559
|
+
_request = config.http_client.get(
|
1560
|
+
_query_url
|
1561
|
+
)
|
1562
|
+
VoiceBasicAuth.apply(config, _request)
|
1563
|
+
_response = execute_request(_request, binary: true)
|
1564
|
+
|
1565
|
+
# Validate response against endpoint and global error codes.
|
1566
|
+
if _response.status_code == 400
|
1567
|
+
raise ApiErrorResponseException.new(
|
1568
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1569
|
+
' fix it before trying again.',
|
1570
|
+
_response
|
1571
|
+
)
|
1572
|
+
elsif _response.status_code == 401
|
1573
|
+
raise APIException.new(
|
1574
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1575
|
+
' credentials to authenticate to the API.',
|
1576
|
+
_response
|
1577
|
+
)
|
1578
|
+
elsif _response.status_code == 403
|
1579
|
+
raise ApiErrorResponseException.new(
|
1580
|
+
'User unauthorized to perform this action.',
|
1581
|
+
_response
|
1582
|
+
)
|
1583
|
+
elsif _response.status_code == 404
|
1584
|
+
raise ApiErrorResponseException.new(
|
1585
|
+
'The resource specified cannot be found or does not belong to you.',
|
1586
|
+
_response
|
1587
|
+
)
|
1588
|
+
elsif _response.status_code == 415
|
1589
|
+
raise ApiErrorResponseException.new(
|
1590
|
+
'We don\'t support that media type. If a request body is required,' \
|
1591
|
+
' please send it to us as `application/json`.',
|
1592
|
+
_response
|
1593
|
+
)
|
1594
|
+
elsif _response.status_code == 429
|
1595
|
+
raise ApiErrorResponseException.new(
|
1596
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
1597
|
+
' slow your request rate down and try again.',
|
1598
|
+
_response
|
1599
|
+
)
|
1600
|
+
elsif _response.status_code == 500
|
1601
|
+
raise ApiErrorResponseException.new(
|
1602
|
+
'Something unexpected happened. Please try again.',
|
1603
|
+
_response
|
1604
|
+
)
|
1605
|
+
end
|
1606
|
+
validate_response(_response)
|
1607
|
+
|
1608
|
+
# Return appropriate response type.
|
1609
|
+
ApiResponse.new(
|
1610
|
+
_response, data: _response.raw_body
|
1611
|
+
)
|
1612
|
+
end
|
1613
|
+
|
1044
1614
|
# Returns a list of metadata for the recordings associated with the
|
1045
1615
|
# specified account. The list can be filtered by the optional from, to,
|
1046
1616
|
# minStartTime, and maxStartTime arguments. The list is capped at 1000
|
@@ -1061,7 +1631,7 @@ module Voice
|
|
1061
1631
|
_query_builder << '/api/v2/accounts/{accountId}/recordings'
|
1062
1632
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
1063
1633
|
_query_builder,
|
1064
|
-
'accountId' => account_id
|
1634
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
1065
1635
|
)
|
1066
1636
|
_query_builder = APIHelper.append_url_with_query_parameters(
|
1067
1637
|
_query_builder,
|