bandwidth-sdk 3.0.0 → 3.5.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 -1
- data/lib/bandwidth/client.rb +9 -0
- data/lib/bandwidth/configuration.rb +22 -4
- data/lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb +22 -0
- data/lib/bandwidth/messaging_lib/messaging/client.rb +4 -0
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +20 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +44 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +153 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
- 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 +88 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +94 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -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/bxml/verbs/record.rb +2 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
- data/lib/bandwidth/voice_lib/voice.rb +2 -0
- data/lib/bandwidth/voice_lib/voice/client.rb +4 -0
- 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
- metadata +18 -4
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# InvalidRequest class.
|
8
|
+
class InvalidRequestException < APIException
|
9
|
+
# An error message pertaining to what the issue could be
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :result
|
12
|
+
|
13
|
+
# The constructor.
|
14
|
+
# @param [String] The reason for raising an exception.
|
15
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
16
|
+
def initialize(reason, response)
|
17
|
+
super(reason, response)
|
18
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
19
|
+
unbox(hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Populates this object by extracting properties from a hash.
|
23
|
+
# @param [Hash] The deserialized response sent by the server in the
|
24
|
+
# response body.
|
25
|
+
def unbox(hash)
|
26
|
+
@result = hash['result']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorCodeRequestSchema Model.
|
8
|
+
class TwoFactorCodeRequestSchema < BaseModel
|
9
|
+
# The phone number to send the 2fa code to.
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :to
|
12
|
+
|
13
|
+
# The application phone number, the sender of the 2fa code.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :from
|
16
|
+
|
17
|
+
# The application unique ID, obtained from Bandwidth.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :application_id
|
20
|
+
|
21
|
+
# An optional field to denote what scope or action the 2fa code is
|
22
|
+
# addressing. If not supplied, defaults to "2FA".
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :scope
|
25
|
+
|
26
|
+
# The message format of the 2fa code. There are three values that the
|
27
|
+
# system will replace "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" and
|
28
|
+
# "{NAME} value template are optional, while "{CODE}" must be supplied. As
|
29
|
+
# the name would suggest, code will be replace with the actual 2fa code.
|
30
|
+
# Name is replaced with the application name, configured during provisioning
|
31
|
+
# of 2fa. The scope value is the same value sent during the call and
|
32
|
+
# partitioned by the server.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :message
|
35
|
+
|
36
|
+
# The number of digits for your 2fa code. The valid number ranges from 2 to
|
37
|
+
# 8, inclusively.
|
38
|
+
# @return [Float]
|
39
|
+
attr_accessor :digits
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['to'] = 'to'
|
45
|
+
@_hash['from'] = 'from'
|
46
|
+
@_hash['application_id'] = 'applicationId'
|
47
|
+
@_hash['scope'] = 'scope'
|
48
|
+
@_hash['message'] = 'message'
|
49
|
+
@_hash['digits'] = 'digits'
|
50
|
+
@_hash
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize(to = nil,
|
54
|
+
from = nil,
|
55
|
+
application_id = nil,
|
56
|
+
message = nil,
|
57
|
+
digits = nil,
|
58
|
+
scope = nil)
|
59
|
+
@to = to
|
60
|
+
@from = from
|
61
|
+
@application_id = application_id
|
62
|
+
@scope = scope
|
63
|
+
@message = message
|
64
|
+
@digits = digits
|
65
|
+
end
|
66
|
+
|
67
|
+
# Creates an instance of the object from a hash.
|
68
|
+
def self.from_hash(hash)
|
69
|
+
return nil unless hash
|
70
|
+
|
71
|
+
# Extract variables from the hash.
|
72
|
+
to = hash['to']
|
73
|
+
from = hash['from']
|
74
|
+
application_id = hash['applicationId']
|
75
|
+
message = hash['message']
|
76
|
+
digits = hash['digits']
|
77
|
+
scope = hash['scope']
|
78
|
+
|
79
|
+
# Create object from extracted values.
|
80
|
+
TwoFactorCodeRequestSchema.new(to,
|
81
|
+
from,
|
82
|
+
application_id,
|
83
|
+
message,
|
84
|
+
digits,
|
85
|
+
scope)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorMessagingResponse Model.
|
8
|
+
class TwoFactorMessagingResponse < BaseModel
|
9
|
+
# TODO: Write general description for this method
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :message_id
|
12
|
+
|
13
|
+
# A mapping from model property names to API property names.
|
14
|
+
def self.names
|
15
|
+
@_hash = {} if @_hash.nil?
|
16
|
+
@_hash['message_id'] = 'messageId'
|
17
|
+
@_hash
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(message_id = nil)
|
21
|
+
@message_id = message_id
|
22
|
+
end
|
23
|
+
|
24
|
+
# Creates an instance of the object from a hash.
|
25
|
+
def self.from_hash(hash)
|
26
|
+
return nil unless hash
|
27
|
+
|
28
|
+
# Extract variables from the hash.
|
29
|
+
message_id = hash['messageId']
|
30
|
+
|
31
|
+
# Create object from extracted values.
|
32
|
+
TwoFactorMessagingResponse.new(message_id)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorVerifyCodeResponse Model.
|
8
|
+
class TwoFactorVerifyCodeResponse < BaseModel
|
9
|
+
# TODO: Write general description for this method
|
10
|
+
# @return [Boolean]
|
11
|
+
attr_accessor :valid
|
12
|
+
|
13
|
+
# A mapping from model property names to API property names.
|
14
|
+
def self.names
|
15
|
+
@_hash = {} if @_hash.nil?
|
16
|
+
@_hash['valid'] = 'valid'
|
17
|
+
@_hash
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(valid = nil)
|
21
|
+
@valid = valid
|
22
|
+
end
|
23
|
+
|
24
|
+
# Creates an instance of the object from a hash.
|
25
|
+
def self.from_hash(hash)
|
26
|
+
return nil unless hash
|
27
|
+
|
28
|
+
# Extract variables from the hash.
|
29
|
+
valid = hash['valid']
|
30
|
+
|
31
|
+
# Create object from extracted values.
|
32
|
+
TwoFactorVerifyCodeResponse.new(valid)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorVerifyRequestSchema Model.
|
8
|
+
class TwoFactorVerifyRequestSchema < BaseModel
|
9
|
+
# The phone number to send the 2fa code to.
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :to
|
12
|
+
|
13
|
+
# The application phone number, the sender of the 2fa code.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :from
|
16
|
+
|
17
|
+
# The application unique ID, obtained from Bandwidth.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :application_id
|
20
|
+
|
21
|
+
# An optional field to denote what scope or action the 2fa code is
|
22
|
+
# addressing. If not supplied, defaults to "2FA".
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :scope
|
25
|
+
|
26
|
+
# The number of digits for your 2fa code. The valid number ranges from 2 to
|
27
|
+
# 8, inclusively.
|
28
|
+
# @return [Float]
|
29
|
+
attr_accessor :digits
|
30
|
+
|
31
|
+
# The time period, in minutes, to validate the 2fa code. By setting this to
|
32
|
+
# 3 minutes, it will mean any code generated within the last 3 minutes are
|
33
|
+
# still valid. The valid range for expiration time is between 0 and 15
|
34
|
+
# minutes, exclusively and inclusively, respectively.
|
35
|
+
# @return [Float]
|
36
|
+
attr_accessor :expiration_time_in_minutes
|
37
|
+
|
38
|
+
# The generated 2fa code to check if valid
|
39
|
+
# @return [String]
|
40
|
+
attr_accessor :code
|
41
|
+
|
42
|
+
# A mapping from model property names to API property names.
|
43
|
+
def self.names
|
44
|
+
@_hash = {} if @_hash.nil?
|
45
|
+
@_hash['to'] = 'to'
|
46
|
+
@_hash['from'] = 'from'
|
47
|
+
@_hash['application_id'] = 'applicationId'
|
48
|
+
@_hash['scope'] = 'scope'
|
49
|
+
@_hash['digits'] = 'digits'
|
50
|
+
@_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
|
51
|
+
@_hash['code'] = 'code'
|
52
|
+
@_hash
|
53
|
+
end
|
54
|
+
|
55
|
+
def initialize(to = nil,
|
56
|
+
from = nil,
|
57
|
+
application_id = nil,
|
58
|
+
digits = nil,
|
59
|
+
expiration_time_in_minutes = nil,
|
60
|
+
code = nil,
|
61
|
+
scope = nil)
|
62
|
+
@to = to
|
63
|
+
@from = from
|
64
|
+
@application_id = application_id
|
65
|
+
@scope = scope
|
66
|
+
@digits = digits
|
67
|
+
@expiration_time_in_minutes = expiration_time_in_minutes
|
68
|
+
@code = code
|
69
|
+
end
|
70
|
+
|
71
|
+
# Creates an instance of the object from a hash.
|
72
|
+
def self.from_hash(hash)
|
73
|
+
return nil unless hash
|
74
|
+
|
75
|
+
# Extract variables from the hash.
|
76
|
+
to = hash['to']
|
77
|
+
from = hash['from']
|
78
|
+
application_id = hash['applicationId']
|
79
|
+
digits = hash['digits']
|
80
|
+
expiration_time_in_minutes = hash['expirationTimeInMinutes']
|
81
|
+
code = hash['code']
|
82
|
+
scope = hash['scope']
|
83
|
+
|
84
|
+
# Create object from extracted values.
|
85
|
+
TwoFactorVerifyRequestSchema.new(to,
|
86
|
+
from,
|
87
|
+
application_id,
|
88
|
+
digits,
|
89
|
+
expiration_time_in_minutes,
|
90
|
+
code,
|
91
|
+
scope)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorVoiceResponse Model.
|
8
|
+
class TwoFactorVoiceResponse < BaseModel
|
9
|
+
# TODO: Write general description for this method
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :call_id
|
12
|
+
|
13
|
+
# A mapping from model property names to API property names.
|
14
|
+
def self.names
|
15
|
+
@_hash = {} if @_hash.nil?
|
16
|
+
@_hash['call_id'] = 'callId'
|
17
|
+
@_hash
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(call_id = nil)
|
21
|
+
@call_id = call_id
|
22
|
+
end
|
23
|
+
|
24
|
+
# Creates an instance of the object from a hash.
|
25
|
+
def self.from_hash(hash)
|
26
|
+
return nil unless hash
|
27
|
+
|
28
|
+
# Extract variables from the hash.
|
29
|
+
call_id = hash['callId']
|
30
|
+
|
31
|
+
# Create object from extracted values.
|
32
|
+
TwoFactorVoiceResponse.new(call_id)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
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
|
@@ -20,7 +20,8 @@ module Bandwidth
|
|
20
20
|
'fileFormat' => file_format,
|
21
21
|
'transcribe' => transcribe,
|
22
22
|
'transcriptionAvailableUrl' => transcription_available_url,
|
23
|
-
'transcriptionAvailableMethod' => transcription_available_method
|
23
|
+
'transcriptionAvailableMethod' => transcription_available_method,
|
24
|
+
'silenceTimeout' => silence_timeout
|
24
25
|
}))
|
25
26
|
end
|
26
27
|
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'
|
@@ -19,6 +19,8 @@ module Bandwidth
|
|
19
19
|
backoff_factor: 1, environment: Environment::PRODUCTION,
|
20
20
|
messaging_basic_auth_user_name: 'TODO: Replace',
|
21
21
|
messaging_basic_auth_password: 'TODO: Replace',
|
22
|
+
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
23
|
+
two_factor_auth_basic_auth_password: 'TODO: Replace',
|
22
24
|
voice_basic_auth_user_name: 'TODO: Replace',
|
23
25
|
voice_basic_auth_password: 'TODO: Replace', config: nil)
|
24
26
|
@config = if config.nil?
|
@@ -29,6 +31,8 @@ module Bandwidth
|
|
29
31
|
environment: environment,
|
30
32
|
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
|
31
33
|
messaging_basic_auth_password: messaging_basic_auth_password,
|
34
|
+
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
|
35
|
+
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
|
32
36
|
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
33
37
|
voice_basic_auth_password: voice_basic_auth_password)
|
34
38
|
else
|
@@ -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
|