bandwidth-sdk 3.2.0 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandwidth.rb +2 -0
- data/lib/bandwidth/client.rb +11 -2
- data/lib/bandwidth/configuration.rb +23 -5
- data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
- data/lib/bandwidth/messaging_lib/messaging/client.rb +7 -2
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +1 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +7 -2
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +24 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +30 -4
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +33 -10
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +22 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +28 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +8 -0
- data/lib/bandwidth/voice_lib/voice.rb +2 -0
- data/lib/bandwidth/voice_lib/voice/client.rb +7 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +145 -78
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +20 -2
- data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +35 -0
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +4 -1
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +8 -14
- data/lib/bandwidth/voice_lib/voice/models/status2_enum.rb +32 -0
- data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +4 -13
- 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 +49 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +682 -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 +19 -2
@@ -0,0 +1,22 @@
|
|
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
|
+
}))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The Conference verb is used to add callees to conferences
|
6
|
+
class Conference
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
if not call_ids_to_coach.nil?
|
11
|
+
coach_ids = call_ids_to_coach.instance_of?(String) ? call_ids_to_coach : call_ids_to_coach.join(",")
|
12
|
+
else
|
13
|
+
coach_ids = nil
|
14
|
+
end
|
15
|
+
xml.Conference(conference_name, compact_hash({
|
16
|
+
'mute' => mute,
|
17
|
+
'hold' => hold,
|
18
|
+
'callIdsToCoach' => coach_ids,
|
19
|
+
'conferenceEventUrl' => conference_event_url,
|
20
|
+
'conferenceEventMethod' => conference_event_method,
|
21
|
+
'username' => username,
|
22
|
+
'password' => password,
|
23
|
+
'tag' => tag
|
24
|
+
}))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -28,8 +28,16 @@ module Bandwidth
|
|
28
28
|
s.to_bxml(xml)
|
29
29
|
end
|
30
30
|
end
|
31
|
+
def nest_verbs_list(xml, property)
|
32
|
+
if property
|
33
|
+
property.each do |verb|
|
34
|
+
verb.to_bxml(xml)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
31
38
|
embedded_xml(xml, speak_sentence, SpeakSentence)
|
32
39
|
embedded_xml(xml, play_audio, PlayAudio)
|
40
|
+
nest_verbs_list(xml, nested_verbs)
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
@@ -12,6 +12,7 @@ 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
14
|
require_relative 'voice/models/api_transcribe_recording_request.rb'
|
15
|
+
require_relative 'voice/models/call_engine_modify_conference_request.rb'
|
15
16
|
require_relative 'voice/models/modify_call_recording_state.rb'
|
16
17
|
require_relative 'voice/models/recording_metadata_response.rb'
|
17
18
|
require_relative 'voice/models/transcript.rb'
|
@@ -29,6 +30,7 @@ require_relative 'voice/models/state1_enum.rb'
|
|
29
30
|
require_relative 'voice/models/state2_enum.rb'
|
30
31
|
require_relative 'voice/models/status_enum.rb'
|
31
32
|
require_relative 'voice/models/status1_enum.rb'
|
33
|
+
require_relative 'voice/models/status2_enum.rb'
|
32
34
|
|
33
35
|
# Exceptions
|
34
36
|
require_relative 'voice/exceptions/api_error_response_exception.rb'
|
@@ -22,7 +22,10 @@ module Bandwidth
|
|
22
22
|
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
23
23
|
two_factor_auth_basic_auth_password: 'TODO: Replace',
|
24
24
|
voice_basic_auth_user_name: 'TODO: Replace',
|
25
|
-
voice_basic_auth_password: 'TODO: Replace',
|
25
|
+
voice_basic_auth_password: 'TODO: Replace',
|
26
|
+
web_rtc_basic_auth_user_name: 'TODO: Replace',
|
27
|
+
web_rtc_basic_auth_password: 'TODO: Replace',
|
28
|
+
config: nil)
|
26
29
|
@config = if config.nil?
|
27
30
|
Configuration.new(timeout: timeout,
|
28
31
|
max_retries: max_retries,
|
@@ -34,7 +37,9 @@ module Bandwidth
|
|
34
37
|
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
|
35
38
|
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
|
36
39
|
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
37
|
-
voice_basic_auth_password: voice_basic_auth_password
|
40
|
+
voice_basic_auth_password: voice_basic_auth_password,
|
41
|
+
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
|
42
|
+
web_rtc_basic_auth_password: web_rtc_basic_auth_password)
|
38
43
|
else
|
39
44
|
config
|
40
45
|
end
|
@@ -44,20 +44,19 @@ module Voice
|
|
44
44
|
# Validate response against endpoint and global error codes.
|
45
45
|
if _response.status_code == 400
|
46
46
|
raise ApiErrorResponseException.new(
|
47
|
-
'Something\'s not quite right...
|
48
|
-
'
|
49
|
-
' before trying again.',
|
47
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
48
|
+
' fix it before trying again.',
|
50
49
|
_response
|
51
50
|
)
|
52
51
|
elsif _response.status_code == 401
|
53
52
|
raise APIException.new(
|
54
|
-
'Please
|
53
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
54
|
+
' credentials to authenticate to the API.',
|
55
55
|
_response
|
56
56
|
)
|
57
57
|
elsif _response.status_code == 403
|
58
58
|
raise ApiErrorResponseException.new(
|
59
|
-
'
|
60
|
-
' the Bandwidth Dashboard.',
|
59
|
+
'User unauthorized to perform this action.',
|
61
60
|
_response
|
62
61
|
)
|
63
62
|
elsif _response.status_code == 404
|
@@ -122,20 +121,19 @@ module Voice
|
|
122
121
|
# Validate response against endpoint and global error codes.
|
123
122
|
if _response.status_code == 400
|
124
123
|
raise ApiErrorResponseException.new(
|
125
|
-
'Something\'s not quite right...
|
126
|
-
'
|
127
|
-
' before trying again.',
|
124
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
125
|
+
' fix it before trying again.',
|
128
126
|
_response
|
129
127
|
)
|
130
128
|
elsif _response.status_code == 401
|
131
129
|
raise APIException.new(
|
132
|
-
'Please
|
130
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
131
|
+
' credentials to authenticate to the API.',
|
133
132
|
_response
|
134
133
|
)
|
135
134
|
elsif _response.status_code == 403
|
136
135
|
raise ApiErrorResponseException.new(
|
137
|
-
'
|
138
|
-
' the Bandwidth Dashboard.',
|
136
|
+
'User unauthorized to perform this action.',
|
139
137
|
_response
|
140
138
|
)
|
141
139
|
elsif _response.status_code == 404
|
@@ -203,20 +201,19 @@ module Voice
|
|
203
201
|
# Validate response against endpoint and global error codes.
|
204
202
|
if _response.status_code == 400
|
205
203
|
raise ApiErrorResponseException.new(
|
206
|
-
'Something\'s not quite right...
|
207
|
-
'
|
208
|
-
' before trying again.',
|
204
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
205
|
+
' fix it before trying again.',
|
209
206
|
_response
|
210
207
|
)
|
211
208
|
elsif _response.status_code == 401
|
212
209
|
raise APIException.new(
|
213
|
-
'Please
|
210
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
211
|
+
' credentials to authenticate to the API.',
|
214
212
|
_response
|
215
213
|
)
|
216
214
|
elsif _response.status_code == 403
|
217
215
|
raise ApiErrorResponseException.new(
|
218
|
-
'
|
219
|
-
' the Bandwidth Dashboard.',
|
216
|
+
'User unauthorized to perform this action.',
|
220
217
|
_response
|
221
218
|
)
|
222
219
|
elsif _response.status_code == 404
|
@@ -283,20 +280,19 @@ module Voice
|
|
283
280
|
# Validate response against endpoint and global error codes.
|
284
281
|
if _response.status_code == 400
|
285
282
|
raise ApiErrorResponseException.new(
|
286
|
-
'Something\'s not quite right...
|
287
|
-
'
|
288
|
-
' before trying again.',
|
283
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
284
|
+
' fix it before trying again.',
|
289
285
|
_response
|
290
286
|
)
|
291
287
|
elsif _response.status_code == 401
|
292
288
|
raise APIException.new(
|
293
|
-
'Please
|
289
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
290
|
+
' credentials to authenticate to the API.',
|
294
291
|
_response
|
295
292
|
)
|
296
293
|
elsif _response.status_code == 403
|
297
294
|
raise ApiErrorResponseException.new(
|
298
|
-
'
|
299
|
-
' the Bandwidth Dashboard.',
|
295
|
+
'User unauthorized to perform this action.',
|
300
296
|
_response
|
301
297
|
)
|
302
298
|
elsif _response.status_code == 404
|
@@ -376,20 +372,19 @@ module Voice
|
|
376
372
|
# Validate response against endpoint and global error codes.
|
377
373
|
if _response.status_code == 400
|
378
374
|
raise ApiErrorResponseException.new(
|
379
|
-
'Something\'s not quite right...
|
380
|
-
'
|
381
|
-
' before trying again.',
|
375
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
376
|
+
' fix it before trying again.',
|
382
377
|
_response
|
383
378
|
)
|
384
379
|
elsif _response.status_code == 401
|
385
380
|
raise APIException.new(
|
386
|
-
'Please
|
381
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
382
|
+
' credentials to authenticate to the API.',
|
387
383
|
_response
|
388
384
|
)
|
389
385
|
elsif _response.status_code == 403
|
390
386
|
raise ApiErrorResponseException.new(
|
391
|
-
'
|
392
|
-
' the Bandwidth Dashboard.',
|
387
|
+
'User unauthorized to perform this action.',
|
393
388
|
_response
|
394
389
|
)
|
395
390
|
elsif _response.status_code == 404
|
@@ -460,20 +455,19 @@ module Voice
|
|
460
455
|
# Validate response against endpoint and global error codes.
|
461
456
|
if _response.status_code == 400
|
462
457
|
raise ApiErrorResponseException.new(
|
463
|
-
'Something\'s not quite right...
|
464
|
-
'
|
465
|
-
' before trying again.',
|
458
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
459
|
+
' fix it before trying again.',
|
466
460
|
_response
|
467
461
|
)
|
468
462
|
elsif _response.status_code == 401
|
469
463
|
raise APIException.new(
|
470
|
-
'Please
|
464
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
465
|
+
' credentials to authenticate to the API.',
|
471
466
|
_response
|
472
467
|
)
|
473
468
|
elsif _response.status_code == 403
|
474
469
|
raise ApiErrorResponseException.new(
|
475
|
-
'
|
476
|
-
' the Bandwidth Dashboard.',
|
470
|
+
'User unauthorized to perform this action.',
|
477
471
|
_response
|
478
472
|
)
|
479
473
|
elsif _response.status_code == 404
|
@@ -536,20 +530,19 @@ module Voice
|
|
536
530
|
# Validate response against endpoint and global error codes.
|
537
531
|
if _response.status_code == 400
|
538
532
|
raise ApiErrorResponseException.new(
|
539
|
-
'Something\'s not quite right...
|
540
|
-
'
|
541
|
-
' before trying again.',
|
533
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
534
|
+
' fix it before trying again.',
|
542
535
|
_response
|
543
536
|
)
|
544
537
|
elsif _response.status_code == 401
|
545
538
|
raise APIException.new(
|
546
|
-
'Please
|
539
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
540
|
+
' credentials to authenticate to the API.',
|
547
541
|
_response
|
548
542
|
)
|
549
543
|
elsif _response.status_code == 403
|
550
544
|
raise ApiErrorResponseException.new(
|
551
|
-
'
|
552
|
-
' the Bandwidth Dashboard.',
|
545
|
+
'User unauthorized to perform this action.',
|
553
546
|
_response
|
554
547
|
)
|
555
548
|
elsif _response.status_code == 404
|
@@ -610,20 +603,19 @@ module Voice
|
|
610
603
|
# Validate response against endpoint and global error codes.
|
611
604
|
if _response.status_code == 400
|
612
605
|
raise ApiErrorResponseException.new(
|
613
|
-
'Something\'s not quite right...
|
614
|
-
'
|
615
|
-
' before trying again.',
|
606
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
607
|
+
' fix it before trying again.',
|
616
608
|
_response
|
617
609
|
)
|
618
610
|
elsif _response.status_code == 401
|
619
611
|
raise APIException.new(
|
620
|
-
'Please
|
612
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
613
|
+
' credentials to authenticate to the API.',
|
621
614
|
_response
|
622
615
|
)
|
623
616
|
elsif _response.status_code == 403
|
624
617
|
raise ApiErrorResponseException.new(
|
625
|
-
'
|
626
|
-
' the Bandwidth Dashboard.',
|
618
|
+
'User unauthorized to perform this action.',
|
627
619
|
_response
|
628
620
|
)
|
629
621
|
elsif _response.status_code == 404
|
@@ -684,20 +676,19 @@ module Voice
|
|
684
676
|
# Validate response against endpoint and global error codes.
|
685
677
|
if _response.status_code == 400
|
686
678
|
raise ApiErrorResponseException.new(
|
687
|
-
'Something\'s not quite right...
|
688
|
-
'
|
689
|
-
' before trying again.',
|
679
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
680
|
+
' fix it before trying again.',
|
690
681
|
_response
|
691
682
|
)
|
692
683
|
elsif _response.status_code == 401
|
693
684
|
raise APIException.new(
|
694
|
-
'Please
|
685
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
686
|
+
' credentials to authenticate to the API.',
|
695
687
|
_response
|
696
688
|
)
|
697
689
|
elsif _response.status_code == 403
|
698
690
|
raise ApiErrorResponseException.new(
|
699
|
-
'
|
700
|
-
' the Bandwidth Dashboard.',
|
691
|
+
'User unauthorized to perform this action.',
|
701
692
|
_response
|
702
693
|
)
|
703
694
|
elsif _response.status_code == 404
|
@@ -764,20 +755,19 @@ module Voice
|
|
764
755
|
# Validate response against endpoint and global error codes.
|
765
756
|
if _response.status_code == 400
|
766
757
|
raise ApiErrorResponseException.new(
|
767
|
-
'Something\'s not quite right...
|
768
|
-
'
|
769
|
-
' before trying again.',
|
758
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
759
|
+
' fix it before trying again.',
|
770
760
|
_response
|
771
761
|
)
|
772
762
|
elsif _response.status_code == 401
|
773
763
|
raise APIException.new(
|
774
|
-
'Please
|
764
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
765
|
+
' credentials to authenticate to the API.',
|
775
766
|
_response
|
776
767
|
)
|
777
768
|
elsif _response.status_code == 403
|
778
769
|
raise ApiErrorResponseException.new(
|
779
|
-
'
|
780
|
-
' the Bandwidth Dashboard.',
|
770
|
+
'User unauthorized to perform this action.',
|
781
771
|
_response
|
782
772
|
)
|
783
773
|
elsif _response.status_code == 404
|
@@ -848,20 +838,19 @@ module Voice
|
|
848
838
|
# Validate response against endpoint and global error codes.
|
849
839
|
if _response.status_code == 400
|
850
840
|
raise ApiErrorResponseException.new(
|
851
|
-
'Something\'s not quite right...
|
852
|
-
'
|
853
|
-
' before trying again.',
|
841
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
842
|
+
' fix it before trying again.',
|
854
843
|
_response
|
855
844
|
)
|
856
845
|
elsif _response.status_code == 401
|
857
846
|
raise APIException.new(
|
858
|
-
'Please
|
847
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
848
|
+
' credentials to authenticate to the API.',
|
859
849
|
_response
|
860
850
|
)
|
861
851
|
elsif _response.status_code == 403
|
862
852
|
raise ApiErrorResponseException.new(
|
863
|
-
'
|
864
|
-
' the Bandwidth Dashboard.',
|
853
|
+
'User unauthorized to perform this action.',
|
865
854
|
_response
|
866
855
|
)
|
867
856
|
elsif _response.status_code == 404
|
@@ -928,20 +917,99 @@ module Voice
|
|
928
917
|
# Validate response against endpoint and global error codes.
|
929
918
|
if _response.status_code == 400
|
930
919
|
raise ApiErrorResponseException.new(
|
931
|
-
'Something\'s not quite right...
|
932
|
-
'
|
933
|
-
' before trying again.',
|
920
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
921
|
+
' fix it before trying again.',
|
934
922
|
_response
|
935
923
|
)
|
936
924
|
elsif _response.status_code == 401
|
937
925
|
raise APIException.new(
|
938
|
-
'Please
|
926
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
927
|
+
' credentials to authenticate to the API.',
|
939
928
|
_response
|
940
929
|
)
|
941
930
|
elsif _response.status_code == 403
|
942
931
|
raise ApiErrorResponseException.new(
|
943
|
-
'
|
944
|
-
|
932
|
+
'User unauthorized to perform this action.',
|
933
|
+
_response
|
934
|
+
)
|
935
|
+
elsif _response.status_code == 404
|
936
|
+
raise ApiErrorResponseException.new(
|
937
|
+
'The resource specified cannot be found or does not belong to you.',
|
938
|
+
_response
|
939
|
+
)
|
940
|
+
elsif _response.status_code == 415
|
941
|
+
raise ApiErrorResponseException.new(
|
942
|
+
'We don\'t support that media type. If a request body is required,' \
|
943
|
+
' please send it to us as `application/json`.',
|
944
|
+
_response
|
945
|
+
)
|
946
|
+
elsif _response.status_code == 429
|
947
|
+
raise ApiErrorResponseException.new(
|
948
|
+
'You\'re sending requests to this endpoint too frequently. Please' \
|
949
|
+
' slow your request rate down and try again.',
|
950
|
+
_response
|
951
|
+
)
|
952
|
+
elsif _response.status_code == 500
|
953
|
+
raise ApiErrorResponseException.new(
|
954
|
+
'Something unexpected happened. Please try again.',
|
955
|
+
_response
|
956
|
+
)
|
957
|
+
end
|
958
|
+
validate_response(_response)
|
959
|
+
|
960
|
+
# Return appropriate response type.
|
961
|
+
ApiResponse.new(_response)
|
962
|
+
end
|
963
|
+
|
964
|
+
# Modify the conference state
|
965
|
+
# @param [String] account_id Required parameter: Example:
|
966
|
+
# @param [String] conference_id Required parameter: Example:
|
967
|
+
# @param [CallEngineModifyConferenceRequest] body Optional parameter:
|
968
|
+
# Example:
|
969
|
+
# @return [void] response from the API call
|
970
|
+
def modify_conference(account_id,
|
971
|
+
conference_id,
|
972
|
+
body: nil)
|
973
|
+
# Prepare query url.
|
974
|
+
_query_builder = config.get_base_uri(Server::VOICEDEFAULT)
|
975
|
+
_query_builder << '/api/v2/accounts/{accountId}/conferences/{conferenceId}'
|
976
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
977
|
+
_query_builder,
|
978
|
+
'accountId' => account_id,
|
979
|
+
'conferenceId' => conference_id
|
980
|
+
)
|
981
|
+
_query_url = APIHelper.clean_url _query_builder
|
982
|
+
|
983
|
+
# Prepare headers.
|
984
|
+
_headers = {
|
985
|
+
'content-type' => 'application/json; charset=utf-8'
|
986
|
+
}
|
987
|
+
|
988
|
+
# Prepare and execute HttpRequest.
|
989
|
+
_request = config.http_client.post(
|
990
|
+
_query_url,
|
991
|
+
headers: _headers,
|
992
|
+
parameters: body.to_json
|
993
|
+
)
|
994
|
+
VoiceBasicAuth.apply(config, _request)
|
995
|
+
_response = execute_request(_request)
|
996
|
+
|
997
|
+
# Validate response against endpoint and global error codes.
|
998
|
+
if _response.status_code == 400
|
999
|
+
raise ApiErrorResponseException.new(
|
1000
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1001
|
+
' fix it before trying again.',
|
1002
|
+
_response
|
1003
|
+
)
|
1004
|
+
elsif _response.status_code == 401
|
1005
|
+
raise APIException.new(
|
1006
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1007
|
+
' credentials to authenticate to the API.',
|
1008
|
+
_response
|
1009
|
+
)
|
1010
|
+
elsif _response.status_code == 403
|
1011
|
+
raise ApiErrorResponseException.new(
|
1012
|
+
'User unauthorized to perform this action.',
|
945
1013
|
_response
|
946
1014
|
)
|
947
1015
|
elsif _response.status_code == 404
|
@@ -1020,20 +1088,19 @@ module Voice
|
|
1020
1088
|
# Validate response against endpoint and global error codes.
|
1021
1089
|
if _response.status_code == 400
|
1022
1090
|
raise ApiErrorResponseException.new(
|
1023
|
-
'Something\'s not quite right...
|
1024
|
-
'
|
1025
|
-
' before trying again.',
|
1091
|
+
'Something\'s not quite right... Your request is invalid. Please' \
|
1092
|
+
' fix it before trying again.',
|
1026
1093
|
_response
|
1027
1094
|
)
|
1028
1095
|
elsif _response.status_code == 401
|
1029
1096
|
raise APIException.new(
|
1030
|
-
'Please
|
1097
|
+
'Your credentials are invalid. Please use your Bandwidth dashboard' \
|
1098
|
+
' credentials to authenticate to the API.',
|
1031
1099
|
_response
|
1032
1100
|
)
|
1033
1101
|
elsif _response.status_code == 403
|
1034
1102
|
raise ApiErrorResponseException.new(
|
1035
|
-
'
|
1036
|
-
' the Bandwidth Dashboard.',
|
1103
|
+
'User unauthorized to perform this action.',
|
1037
1104
|
_response
|
1038
1105
|
)
|
1039
1106
|
elsif _response.status_code == 404
|