bandwidth-sdk 8.0.0 → 9.0.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/api_helper.rb +19 -17
- data/lib/bandwidth/configuration.rb +7 -19
- data/lib/bandwidth/http/faraday_client.rb +1 -1
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +53 -42
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +65 -32
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
- data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +23 -6
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
- data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
- data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
- data/lib/bandwidth/models/base_model.rb +11 -0
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb +21 -16
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +5 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +4 -1
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +4 -1
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_code_request_schema.rb +27 -12
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_messaging_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_code_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_verify_request_schema.rb +29 -10
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/models/two_factor_voice_response.rb +17 -2
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
- data/lib/bandwidth/utilities/date_time_helper.rb +2 -2
- data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +171 -150
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb +6 -3
- data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
- data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +78 -37
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +94 -42
- data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_member_state.rb +35 -12
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +55 -24
- data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +54 -17
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +173 -96
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +85 -41
- data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
- data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb +15 -2
- data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +59 -19
- data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +55 -18
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +40 -12
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +26 -8
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
- data/lib/bandwidth/voice_lib/voice.rb +7 -1
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +61 -50
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
- data/lib/bandwidth.rb +19 -18
- data/test/integration/test_integration.rb +75 -53
- metadata +9 -2
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# ParticipantSubscription Model.
|
8
8
|
class ParticipantSubscription < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# Participant the subscriber should be subscribed to
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :participant_id
|
@@ -17,8 +20,18 @@ module Bandwidth
|
|
17
20
|
@_hash
|
18
21
|
end
|
19
22
|
|
23
|
+
# An array for optional fields
|
24
|
+
def optionals
|
25
|
+
[]
|
26
|
+
end
|
27
|
+
|
28
|
+
# An array for nullable fields
|
29
|
+
def nullables
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
|
20
33
|
def initialize(participant_id = nil)
|
21
|
-
@participant_id = participant_id
|
34
|
+
@participant_id = participant_id unless participant_id == SKIP
|
22
35
|
end
|
23
36
|
|
24
37
|
# Creates an instance of the object from a hash.
|
@@ -26,7 +39,7 @@ module Bandwidth
|
|
26
39
|
return nil unless hash
|
27
40
|
|
28
41
|
# Extract variables from the hash.
|
29
|
-
participant_id = hash['participantId']
|
42
|
+
participant_id = hash.key?('participantId') ? hash['participantId'] : SKIP
|
30
43
|
|
31
44
|
# Create object from extracted values.
|
32
45
|
ParticipantSubscription.new(participant_id)
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# A session object
|
8
8
|
class Session < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# Unique id of the session
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :id
|
@@ -22,10 +25,23 @@ module Bandwidth
|
|
22
25
|
@_hash
|
23
26
|
end
|
24
27
|
|
28
|
+
# An array for optional fields
|
29
|
+
def optionals
|
30
|
+
%w[
|
31
|
+
id
|
32
|
+
tag
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
# An array for nullable fields
|
37
|
+
def nullables
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
25
41
|
def initialize(id = nil,
|
26
42
|
tag = nil)
|
27
|
-
@id = id
|
28
|
-
@tag = tag
|
43
|
+
@id = id unless id == SKIP
|
44
|
+
@tag = tag unless tag == SKIP
|
29
45
|
end
|
30
46
|
|
31
47
|
# Creates an instance of the object from a hash.
|
@@ -33,8 +49,8 @@ module Bandwidth
|
|
33
49
|
return nil unless hash
|
34
50
|
|
35
51
|
# Extract variables from the hash.
|
36
|
-
id = hash['id']
|
37
|
-
tag = hash['tag']
|
52
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
53
|
+
tag = hash.key?('tag') ? hash['tag'] : SKIP
|
38
54
|
|
39
55
|
# Create object from extracted values.
|
40
56
|
Session.new(id,
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# Subscriptions Model.
|
8
8
|
class Subscriptions < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# Session the subscriptions are associated with
|
10
13
|
# If this is the only field, the subscriber will be subscribed to all
|
11
14
|
# participants in the session (including any participants that are later
|
@@ -25,10 +28,22 @@ module Bandwidth
|
|
25
28
|
@_hash
|
26
29
|
end
|
27
30
|
|
31
|
+
# An array for optional fields
|
32
|
+
def optionals
|
33
|
+
%w[
|
34
|
+
participants
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
# An array for nullable fields
|
39
|
+
def nullables
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
|
28
43
|
def initialize(session_id = nil,
|
29
44
|
participants = nil)
|
30
|
-
@session_id = session_id
|
31
|
-
@participants = participants
|
45
|
+
@session_id = session_id unless session_id == SKIP
|
46
|
+
@participants = participants unless participants == SKIP
|
32
47
|
end
|
33
48
|
|
34
49
|
# Creates an instance of the object from a hash.
|
@@ -36,7 +51,7 @@ module Bandwidth
|
|
36
51
|
return nil unless hash
|
37
52
|
|
38
53
|
# Extract variables from the hash.
|
39
|
-
session_id = hash['sessionId']
|
54
|
+
session_id = hash.key?('sessionId') ? hash['sessionId'] : SKIP
|
40
55
|
# Parameter is an array, so we need to iterate through it
|
41
56
|
participants = nil
|
42
57
|
unless hash['participants'].nil?
|
@@ -46,6 +61,8 @@ module Bandwidth
|
|
46
61
|
end
|
47
62
|
end
|
48
63
|
|
64
|
+
participants = SKIP unless hash.key?('participants')
|
65
|
+
|
49
66
|
# Create object from extracted values.
|
50
67
|
Subscriptions.new(session_id,
|
51
68
|
participants)
|
data/lib/bandwidth.rb
CHANGED
@@ -9,40 +9,41 @@ require 'faraday'
|
|
9
9
|
require 'certifi'
|
10
10
|
require 'logging'
|
11
11
|
|
12
|
-
require_relative 'bandwidth/api_helper
|
13
|
-
require_relative 'bandwidth/client
|
12
|
+
require_relative 'bandwidth/api_helper'
|
13
|
+
require_relative 'bandwidth/client'
|
14
14
|
|
15
15
|
# Utilities
|
16
|
-
require_relative 'bandwidth/utilities/file_wrapper
|
17
|
-
require_relative 'bandwidth/utilities/date_time_helper
|
16
|
+
require_relative 'bandwidth/utilities/file_wrapper'
|
17
|
+
require_relative 'bandwidth/utilities/date_time_helper'
|
18
18
|
|
19
19
|
# Http
|
20
|
-
require_relative 'bandwidth/http/api_response
|
21
|
-
require_relative 'bandwidth/http/http_call_back
|
22
|
-
require_relative 'bandwidth/http/http_client
|
23
|
-
require_relative 'bandwidth/http/faraday_client
|
24
|
-
require_relative 'bandwidth/http/http_method_enum
|
25
|
-
require_relative 'bandwidth/http/http_request
|
26
|
-
require_relative 'bandwidth/http/http_response
|
20
|
+
require_relative 'bandwidth/http/api_response'
|
21
|
+
require_relative 'bandwidth/http/http_call_back'
|
22
|
+
require_relative 'bandwidth/http/http_client'
|
23
|
+
require_relative 'bandwidth/http/faraday_client'
|
24
|
+
require_relative 'bandwidth/http/http_method_enum'
|
25
|
+
require_relative 'bandwidth/http/http_request'
|
26
|
+
require_relative 'bandwidth/http/http_response'
|
27
27
|
|
28
28
|
# Models
|
29
|
-
require_relative 'bandwidth/models/base_model
|
29
|
+
require_relative 'bandwidth/models/base_model'
|
30
30
|
|
31
31
|
# Exceptions
|
32
|
-
require_relative 'bandwidth/exceptions/api_exception
|
32
|
+
require_relative 'bandwidth/exceptions/api_exception'
|
33
33
|
|
34
|
-
require_relative 'bandwidth/configuration
|
34
|
+
require_relative 'bandwidth/configuration'
|
35
35
|
|
36
36
|
# Namespaces
|
37
37
|
require_relative 'bandwidth/messaging_lib/messaging'
|
38
|
-
require_relative 'bandwidth/http/auth/messaging_basic_auth
|
38
|
+
require_relative 'bandwidth/http/auth/messaging_basic_auth'
|
39
39
|
require_relative 'bandwidth/multi_factor_auth_lib/multi_factor_auth'
|
40
|
-
require_relative 'bandwidth/http/auth/multi_factor_auth_basic_auth
|
40
|
+
require_relative 'bandwidth/http/auth/multi_factor_auth_basic_auth'
|
41
41
|
require_relative 'bandwidth/phone_number_lookup_lib/phone_number_lookup'
|
42
|
-
require_relative 'bandwidth/http/auth/phone_number_lookup_basic_auth
|
42
|
+
require_relative 'bandwidth/http/auth/phone_number_lookup_basic_auth'
|
43
43
|
require_relative 'bandwidth/voice_lib/voice'
|
44
|
-
require_relative 'bandwidth/http/auth/voice_basic_auth
|
44
|
+
require_relative 'bandwidth/http/auth/voice_basic_auth'
|
45
45
|
require_relative 'bandwidth/web_rtc_lib/web_rtc'
|
46
|
+
require_relative 'bandwidth/http/auth/web_rtc_basic_auth'
|
46
47
|
require_relative 'bandwidth/http/auth/web_rtc_basic_auth.rb'
|
47
48
|
|
48
49
|
# External Files
|
@@ -12,17 +12,14 @@ include Bandwidth::MultiFactorAuth
|
|
12
12
|
include Bandwidth::WebRtc
|
13
13
|
|
14
14
|
begin
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
MFA_MESSAGING_APPLICATION_ID = ENV.fetch("MFA_MESSAGING_APPLICATION_ID")
|
24
|
-
MFA_VOICE_APPLICATION_ID = ENV.fetch("MFA_VOICE_APPLICATION_ID")
|
25
|
-
PHONE_NUMBER_MFA = ENV.fetch("PHONE_NUMBER_MFA")
|
15
|
+
BW_USERNAME = ENV.fetch("BW_USERNAME")
|
16
|
+
BW_PASSWORD = ENV.fetch("BW_PASSWORD")
|
17
|
+
BW_ACCOUNT_ID = ENV.fetch("BW_ACCOUNT_ID")
|
18
|
+
BW_VOICE_APPLICATION_ID = ENV.fetch("BW_VOICE_APPLICATION_ID")
|
19
|
+
BW_MESSAGING_APPLICATION_ID = ENV.fetch("BW_MESSAGING_APPLICATION_ID")
|
20
|
+
BASE_CALLBACK_URL = ENV.fetch("BASE_CALLBACK_URL")
|
21
|
+
BW_NUMBER = ENV.fetch("BW_NUMBER")
|
22
|
+
USER_NUMBER = ENV.fetch("USER_NUMBER")
|
26
23
|
rescue
|
27
24
|
puts "Environmental variables not found"
|
28
25
|
exit(-1)
|
@@ -31,35 +28,35 @@ end
|
|
31
28
|
class IntegrationTest < Test::Unit::TestCase
|
32
29
|
def setup
|
33
30
|
@bandwidth_client = Bandwidth::Client.new(
|
34
|
-
voice_basic_auth_user_name:
|
35
|
-
voice_basic_auth_password:
|
36
|
-
messaging_basic_auth_user_name:
|
37
|
-
messaging_basic_auth_password:
|
38
|
-
multi_factor_auth_basic_auth_user_name:
|
39
|
-
multi_factor_auth_basic_auth_password:
|
40
|
-
phone_number_lookup_basic_auth_user_name:
|
41
|
-
phone_number_lookup_basic_auth_password:
|
31
|
+
voice_basic_auth_user_name: BW_USERNAME,
|
32
|
+
voice_basic_auth_password: BW_PASSWORD,
|
33
|
+
messaging_basic_auth_user_name: BW_USERNAME,
|
34
|
+
messaging_basic_auth_password: BW_PASSWORD,
|
35
|
+
multi_factor_auth_basic_auth_user_name: BW_USERNAME,
|
36
|
+
multi_factor_auth_basic_auth_password: BW_PASSWORD,
|
37
|
+
phone_number_lookup_basic_auth_user_name: BW_USERNAME,
|
38
|
+
phone_number_lookup_basic_auth_password: BW_PASSWORD
|
42
39
|
)
|
43
40
|
end
|
44
41
|
|
45
42
|
def test_create_message
|
46
43
|
body = MessageRequest.new
|
47
|
-
body.application_id =
|
48
|
-
body.to = [
|
49
|
-
body.from =
|
44
|
+
body.application_id = BW_MESSAGING_APPLICATION_ID
|
45
|
+
body.to = [USER_NUMBER]
|
46
|
+
body.from = BW_NUMBER
|
50
47
|
body.text = "Ruby Integration"
|
51
|
-
response = @bandwidth_client.messaging_client.client.create_message(
|
48
|
+
response = @bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
|
52
49
|
assert(response.data.id.length > 0, "id value not set") #validate that _some_ id was returned
|
53
50
|
end
|
54
51
|
|
55
52
|
def test_create_message_invalid_phone_number
|
56
53
|
body = MessageRequest.new
|
57
|
-
body.application_id =
|
54
|
+
body.application_id = BW_MESSAGING_APPLICATION_ID
|
58
55
|
body.to = ["+1invalid"]
|
59
|
-
body.from =
|
56
|
+
body.from = BW_NUMBER
|
60
57
|
body.text = "Ruby Integration"
|
61
58
|
begin
|
62
|
-
@bandwidth_client.messaging_client.client.create_message(
|
59
|
+
@bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
|
63
60
|
#workaround to make sure that if the above error is not raised, the build will fail
|
64
61
|
assert(false, "Expected exception not raised")
|
65
62
|
rescue MessagingException => e
|
@@ -73,37 +70,62 @@ class IntegrationTest < Test::Unit::TestCase
|
|
73
70
|
media_file = '12345' #todo: check a binary string
|
74
71
|
|
75
72
|
#media upload
|
76
|
-
@bandwidth_client.messaging_client.client.upload_media(
|
73
|
+
@bandwidth_client.messaging_client.client.upload_media(BW_ACCOUNT_ID, media_file_name, media_file, :content_type => "application/octet-stream", :cache_control => "no-cache")
|
77
74
|
|
78
75
|
#media download
|
79
|
-
downloaded_media_file = @bandwidth_client.messaging_client.client.get_media(
|
76
|
+
downloaded_media_file = @bandwidth_client.messaging_client.client.get_media(BW_ACCOUNT_ID, media_file_name).data
|
80
77
|
|
81
78
|
assert_equal(downloaded_media_file, media_file, "Downloaded media file not equal to upload")
|
82
79
|
end
|
83
80
|
|
84
81
|
def test_create_call_and_get_call_state
|
85
82
|
body = CreateCallRequest.new
|
86
|
-
body.from =
|
87
|
-
body.to =
|
88
|
-
body.application_id =
|
89
|
-
body.answer_url =
|
90
|
-
response = @bandwidth_client.voice_client.client.create_call(
|
83
|
+
body.from = BW_NUMBER
|
84
|
+
body.to = USER_NUMBER
|
85
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
86
|
+
body.answer_url = BASE_CALLBACK_URL
|
87
|
+
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
91
88
|
assert(response.data.call_id.length > 0, "call_id value not set")
|
92
89
|
|
93
90
|
#Get phone call information
|
94
|
-
response = @bandwidth_client.voice_client.client.get_call(
|
91
|
+
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
92
|
+
assert(response.data.state.length > 0, "state value not set")
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_create_call_with_amd_and_get_call_state
|
96
|
+
machine_detection = MachineDetectionConfiguration.new
|
97
|
+
machine_detection.mode = 'async'
|
98
|
+
machine_detection.detection_timeout = 5.0
|
99
|
+
machine_detection.silence_timeout = 5.0
|
100
|
+
machine_detection.speech_threshold = 5.0
|
101
|
+
machine_detection.speech_end_threshold = 5.0
|
102
|
+
machine_detection.delay_result = true
|
103
|
+
machine_detection.callback_url = BASE_CALLBACK_URL + '/machineDetection'
|
104
|
+
machine_detection.callback_method = 'POST'
|
105
|
+
|
106
|
+
body = CreateCallRequest.new
|
107
|
+
body.from = BW_NUMBER
|
108
|
+
body.to = USER_NUMBER
|
109
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
110
|
+
body.answer_url = BASE_CALLBACK_URL
|
111
|
+
body.machine_detection = machine_detection
|
112
|
+
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
113
|
+
assert(response.data.call_id.length > 0, "call_id value not set")
|
114
|
+
|
115
|
+
#Get phone call information
|
116
|
+
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
95
117
|
assert(response.data.state.length > 0, "state value not set")
|
96
118
|
end
|
97
119
|
|
98
120
|
def test_create_call_invalid_phone_number
|
99
121
|
body = CreateCallRequest.new
|
100
|
-
body.from =
|
122
|
+
body.from = BW_NUMBER
|
101
123
|
body.to = "+1invalid"
|
102
|
-
body.application_id =
|
103
|
-
body.answer_url =
|
124
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
125
|
+
body.answer_url = BASE_CALLBACK_URL
|
104
126
|
|
105
127
|
begin
|
106
|
-
@bandwidth_client.voice_client.client.create_call(
|
128
|
+
@bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, :body => body)
|
107
129
|
#workaround to make sure that if the above error is not raised, the build will fail
|
108
130
|
assert(false, "Expected exception not raised")
|
109
131
|
rescue ApiErrorException => e
|
@@ -467,38 +489,38 @@ class IntegrationTest < Test::Unit::TestCase
|
|
467
489
|
|
468
490
|
def test_mfa_messaging
|
469
491
|
body = TwoFactorCodeRequestSchema.new
|
470
|
-
body.from =
|
471
|
-
body.to =
|
472
|
-
body.application_id =
|
492
|
+
body.from = BW_NUMBER
|
493
|
+
body.to = USER_NUMBER
|
494
|
+
body.application_id = BW_MESSAGING_APPLICATION_ID
|
473
495
|
body.scope = "scope"
|
474
496
|
body.digits = 6
|
475
497
|
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
|
476
498
|
|
477
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_messaging_two_factor(
|
499
|
+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_messaging_two_factor(BW_ACCOUNT_ID, body)
|
478
500
|
assert(response.data.message_id.length > 0, "message id value not set")
|
479
501
|
end
|
480
502
|
|
481
503
|
def test_mfa_voice
|
482
504
|
body = TwoFactorCodeRequestSchema.new
|
483
|
-
body.from =
|
484
|
-
body.to =
|
485
|
-
body.application_id =
|
505
|
+
body.from = BW_NUMBER
|
506
|
+
body.to = USER_NUMBER
|
507
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
486
508
|
body.scope = "scope"
|
487
509
|
body.digits = 6
|
488
510
|
body.message = "Your temporary {NAME} {SCOPE} code is {CODE}"
|
489
511
|
|
490
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_voice_two_factor(
|
512
|
+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_voice_two_factor(BW_ACCOUNT_ID, body)
|
491
513
|
assert(response.data.call_id.length > 0, "call id value not set")
|
492
514
|
end
|
493
515
|
|
494
516
|
def test_mfa_verify
|
495
517
|
body = TwoFactorVerifyRequestSchema.new
|
496
|
-
body.to =
|
497
|
-
body.application_id =
|
518
|
+
body.to = USER_NUMBER
|
519
|
+
body.application_id = BW_VOICE_APPLICATION_ID
|
498
520
|
body.scope = "scope"
|
499
521
|
body.code = "123456"
|
500
522
|
body.expiration_time_in_minutes = 3
|
501
|
-
response = @bandwidth_client.multi_factor_auth_client.mfa.create_verify_two_factor(
|
523
|
+
response = @bandwidth_client.multi_factor_auth_client.mfa.create_verify_two_factor(BW_ACCOUNT_ID, body)
|
502
524
|
#Ruby has no check to see if variables are of type boolean
|
503
525
|
#An explicit true/false check is required
|
504
526
|
assert(response.data.valid == true || response.data.valid == false, "'valid' variable is not a boolean")
|
@@ -559,7 +581,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
559
581
|
actual = response.to_bxml()
|
560
582
|
assert_equal(expected, actual)
|
561
583
|
end
|
562
|
-
|
584
|
+
|
563
585
|
def test_stop_gather
|
564
586
|
stop_gather = Bandwidth::Voice::StopGather.new()
|
565
587
|
|
@@ -573,12 +595,12 @@ class IntegrationTest < Test::Unit::TestCase
|
|
573
595
|
|
574
596
|
def test_tn_lookup
|
575
597
|
body = OrderRequest.new
|
576
|
-
body.tns = [
|
577
|
-
create_response = @bandwidth_client.phone_number_lookup_client.client.create_lookup_request(
|
598
|
+
body.tns = [BW_NUMBER]
|
599
|
+
create_response = @bandwidth_client.phone_number_lookup_client.client.create_lookup_request(BW_ACCOUNT_ID, body)
|
578
600
|
assert(create_response.data.request_id.length > 0, "request_id value not set")
|
579
601
|
|
580
602
|
request_id = create_response.data.request_id
|
581
|
-
get_response = @bandwidth_client.phone_number_lookup_client.client.get_lookup_request_status(
|
603
|
+
get_response = @bandwidth_client.phone_number_lookup_client.client.get_lookup_request_status(BW_ACCOUNT_ID, request_id)
|
582
604
|
assert(get_response.data.status.length > 0, "status value not set")
|
583
605
|
end
|
584
606
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandwidth-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- APIMatic SDK Generator
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -235,9 +235,11 @@ files:
|
|
235
235
|
- lib/bandwidth/voice_lib/voice/exceptions/api_error_exception.rb
|
236
236
|
- lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb
|
237
237
|
- lib/bandwidth/voice_lib/voice/models/answer_method_enum.rb
|
238
|
+
- lib/bandwidth/voice_lib/voice/models/call_callback.rb
|
238
239
|
- lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb
|
239
240
|
- lib/bandwidth/voice_lib/voice/models/call_state.rb
|
240
241
|
- lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb
|
242
|
+
- lib/bandwidth/voice_lib/voice/models/conference_callback.rb
|
241
243
|
- lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb
|
242
244
|
- lib/bandwidth/voice_lib/voice/models/conference_member_state.rb
|
243
245
|
- lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb
|
@@ -246,7 +248,11 @@ files:
|
|
246
248
|
- lib/bandwidth/voice_lib/voice/models/create_call_response.rb
|
247
249
|
- lib/bandwidth/voice_lib/voice/models/direction_enum.rb
|
248
250
|
- lib/bandwidth/voice_lib/voice/models/disconnect_method_enum.rb
|
251
|
+
- lib/bandwidth/voice_lib/voice/models/diversion.rb
|
252
|
+
- lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb
|
249
253
|
- lib/bandwidth/voice_lib/voice/models/file_format_enum.rb
|
254
|
+
- lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb
|
255
|
+
- lib/bandwidth/voice_lib/voice/models/mode_enum.rb
|
250
256
|
- lib/bandwidth/voice_lib/voice/models/modify_call_recording_request.rb
|
251
257
|
- lib/bandwidth/voice_lib/voice/models/modify_call_request.rb
|
252
258
|
- lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb
|
@@ -257,6 +263,7 @@ files:
|
|
257
263
|
- lib/bandwidth/voice_lib/voice/models/status_enum.rb
|
258
264
|
- lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb
|
259
265
|
- lib/bandwidth/voice_lib/voice/models/transcript.rb
|
266
|
+
- lib/bandwidth/voice_lib/voice/models/transcription.rb
|
260
267
|
- lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb
|
261
268
|
- lib/bandwidth/voice_lib/voice/models/transcription_response.rb
|
262
269
|
- lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb
|