bandwidth-sdk 11.1.1 → 11.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +33 -31
- data/bandwidth.yml +8 -2
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +70 -18
- data/coverage/index.html +1183 -611
- data/docs/MessageRequest.md +1 -1
- data/lib/bandwidth-sdk/models/bxml/bxml.rb +1 -1
- data/lib/bandwidth-sdk/models/bxml/nestable_verb.rb +2 -2
- data/lib/bandwidth-sdk/models/bxml/response.rb +1 -1
- data/lib/bandwidth-sdk/models/bxml/root.rb +10 -4
- data/lib/bandwidth-sdk/models/bxml/verbs/gather.rb +10 -4
- data/lib/bandwidth-sdk/models/bxml/verbs/start_stream.rb +9 -3
- data/lib/bandwidth-sdk/models/bxml/verbs/start_transcription.rb +9 -3
- data/lib/bandwidth-sdk/models/bxml/verbs/transfer.rb +12 -5
- data/lib/bandwidth-sdk/models/message_request.rb +1 -1
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/spec/models/bxml/bxml_spec.rb +25 -0
- data/spec/models/bxml/response_spec.rb +25 -0
- data/spec/models/bxml/verbs/gather_spec.rb +3 -3
- data/spec/models/bxml/verbs/start_stream_spec.rb +3 -3
- data/spec/models/bxml/verbs/start_transcription_spec.rb +3 -3
- data/spec/models/bxml/verbs/transfer_spec.rb +10 -8
- metadata +34 -34
data/docs/MessageRequest.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
7
|
| **application_id** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | |
|
8
8
|
| **to** | **Array<String>** | The phone number(s) the message should be sent to in E164 format. | |
|
9
|
-
| **from** | **String** |
|
9
|
+
| **from** | **String** | Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter. | |
|
10
10
|
| **text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] |
|
11
11
|
| **media** | **Array<String>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] |
|
12
12
|
| **tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] |
|
@@ -2,7 +2,7 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class Bxml < Bandwidth::Bxml::Root
|
4
4
|
# Initializer
|
5
|
-
# @param nested_verbs [Array<Verb>] XML element children. Defaults to an empty array.
|
5
|
+
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
|
6
6
|
def initialize(nested_verbs = [])
|
7
7
|
super(tag = 'Bxml', nested_verbs)
|
8
8
|
end
|
@@ -6,12 +6,12 @@ module Bandwidth
|
|
6
6
|
# Initializer
|
7
7
|
# @param tag [String] Name of the XML element.
|
8
8
|
# @param content [String] XML element content. Defaults to nil.
|
9
|
-
# @param nested_verbs [Array] XML element children. Defaults to an empty array.
|
9
|
+
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
|
10
10
|
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
|
11
11
|
def initialize(tag, content = nil, nested_verbs = [], attributes = {})
|
12
12
|
@tag = tag
|
13
13
|
@content = content
|
14
|
-
@nested_verbs = nested_verbs
|
14
|
+
@nested_verbs = Array(nested_verbs)
|
15
15
|
@attributes = attributes
|
16
16
|
end
|
17
17
|
|
@@ -2,7 +2,7 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class Response < Bandwidth::Bxml::Root
|
4
4
|
# Initializer
|
5
|
-
# @param nested_verbs [Array<Verb>] XML element children. Defaults to an empty array.
|
5
|
+
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
|
6
6
|
def initialize(nested_verbs = [])
|
7
7
|
super(tag = 'Response', nested_verbs)
|
8
8
|
end
|
@@ -8,10 +8,10 @@ module Bandwidth
|
|
8
8
|
class Root
|
9
9
|
# Initializer
|
10
10
|
# @param tag [String] Name of the XML element.
|
11
|
-
# @param nested_verbs [Array<Verb>] XML element children. Defaults to an empty array.
|
11
|
+
# @param nested_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array.
|
12
12
|
def initialize(tag, nested_verbs = [])
|
13
13
|
@tag = tag
|
14
|
-
@nested_verbs = nested_verbs
|
14
|
+
@nested_verbs = Array(nested_verbs)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Generate an XML element for the BXML response
|
@@ -30,12 +30,18 @@ module Bandwidth
|
|
30
30
|
xml
|
31
31
|
end
|
32
32
|
|
33
|
-
# Add a verb to the nested verbs array
|
33
|
+
# Add a verb or verbs to the nested verbs array
|
34
34
|
# @param *nested_verbs [Verb] or [Array<Verb>] Verb or verbs to add to the array.
|
35
|
-
def
|
35
|
+
def add_verbs(nested_verbs)
|
36
36
|
@nested_verbs.push(*nested_verbs)
|
37
37
|
end
|
38
38
|
|
39
|
+
extend Gem::Deprecate
|
40
|
+
def add_verb(nested_verbs)
|
41
|
+
add_verbs(nested_verbs)
|
42
|
+
end
|
43
|
+
deprecate(:add_verb, 'add_verbs', 2024, 7)
|
44
|
+
|
39
45
|
# Return BXML representaion of this response
|
40
46
|
# @return [String] The XML response in string format.
|
41
47
|
def to_bxml
|
@@ -2,7 +2,7 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class Gather < Bandwidth::Bxml::NestableVerb
|
4
4
|
# Initializer
|
5
|
-
# @param audio_verbs [Array] XML element children. Defaults to an empty array. Valid nested audio verbs are: SpeakSentence, PlayAudio.
|
5
|
+
# @param audio_verbs [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested audio verbs are: SpeakSentence, PlayAudio.
|
6
6
|
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
|
7
7
|
def initialize(audio_verbs = [], attributes = {})
|
8
8
|
super('Gather', nil, audio_verbs, attributes)
|
@@ -32,11 +32,17 @@ module Bandwidth
|
|
32
32
|
bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>') }
|
33
33
|
end
|
34
34
|
|
35
|
-
# Add audio verb
|
36
|
-
# @param audio_verbs [SpeakSentence]
|
37
|
-
def
|
35
|
+
# Add audio verb or verbs to the nested verbs array
|
36
|
+
# @param audio_verbs [SpeakSentence] or [PlayAudio] or [Array<SpeakSentence || PlayAudio>] Verb or verbs to add to the array.
|
37
|
+
def add_audio_verbs(audio_verbs)
|
38
38
|
@nested_verbs.push(*audio_verbs)
|
39
39
|
end
|
40
|
+
|
41
|
+
extend Gem::Deprecate
|
42
|
+
def add_audio_verb(audio_verbs)
|
43
|
+
add_audio_verbs(audio_verbs)
|
44
|
+
end
|
45
|
+
deprecate(:add_audio_verb, 'add_audio_verbs', 2024, 7)
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
@@ -2,7 +2,7 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class StartStream < Bandwidth::Bxml::NestableVerb
|
4
4
|
# Initializer
|
5
|
-
# @param stream_params [Array] XML element children. Defaults to an empty array. Valid nested stream params are: StreamParam. You may specify up to 12 <StreamParam/> elements nested within a <StartStream> tag.
|
5
|
+
# @param stream_params [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested stream params are: StreamParam. You may specify up to 12 <StreamParam/> elements nested within a <StartStream> tag.
|
6
6
|
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
|
7
7
|
def initialize(stream_params = [], attributes = {})
|
8
8
|
super('StartStream', nil, stream_params, attributes)
|
@@ -18,11 +18,17 @@ module Bandwidth
|
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
|
-
# Add stream param
|
21
|
+
# Add stream param or params to the nested verbs array
|
22
22
|
# @param stream_params [StreamParam] or [Array<StreamParam>] Verb or verbs to add to the array.
|
23
|
-
def
|
23
|
+
def add_stream_params(stream_params)
|
24
24
|
@nested_verbs.push(*stream_params)
|
25
25
|
end
|
26
|
+
|
27
|
+
extend Gem::Deprecate
|
28
|
+
def add_stream_param(stream_params)
|
29
|
+
add_stream_params(stream_params)
|
30
|
+
end
|
31
|
+
deprecate(:add_stream_param, 'add_stream_params', 2024, 7)
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
@@ -2,7 +2,7 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class StartTranscription < Bandwidth::Bxml::NestableVerb
|
4
4
|
# Initializer
|
5
|
-
# @param custom_params [Array] XML element children. Defaults to an empty array. Valid nested custom params are: CustomParam. You may specify up to 12 <CustomParam/> elements nested within a <StartTranscription> tag.
|
5
|
+
# @param custom_params [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested custom params are: CustomParam. You may specify up to 12 <CustomParam/> elements nested within a <StartTranscription> tag.
|
6
6
|
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
|
7
7
|
def initialize(custom_params = [], attributes = {})
|
8
8
|
super('StartTranscription', nil, custom_params, attributes)
|
@@ -19,11 +19,17 @@ module Bandwidth
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
-
# Add custom param
|
22
|
+
# Add custom param or params to the nested verbs array
|
23
23
|
# @param custom_params [CustomParam] or [Array<CustomParam>] Verb or verbs to add to the array.
|
24
|
-
def
|
24
|
+
def add_custom_params(custom_params)
|
25
25
|
@nested_verbs.push(*custom_params)
|
26
26
|
end
|
27
|
+
|
28
|
+
extend Gem::Deprecate
|
29
|
+
def add_custom_param(custom_params)
|
30
|
+
add_custom_params(custom_params)
|
31
|
+
end
|
32
|
+
deprecate(:add_custom_param, 'add_custom_params', 2024, 7)
|
27
33
|
end
|
28
34
|
end
|
29
35
|
end
|
@@ -2,14 +2,15 @@ module Bandwidth
|
|
2
2
|
module Bxml
|
3
3
|
class Transfer < Bandwidth::Bxml::NestableVerb
|
4
4
|
# Initializer
|
5
|
-
# @param transfer_to [Array] XML element children. Defaults to an empty array. Valid nested transfer verbs are: PhoneNumber, SipUri.
|
5
|
+
# @param transfer_to [Verb] or [Array<Verb>] XML element children. Defaults to an empty array. Valid nested transfer verbs are: PhoneNumber, SipUri.
|
6
6
|
# @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
|
7
7
|
def initialize(transfer_to = [], attributes = {})
|
8
8
|
super('Transfer', nil, transfer_to, attributes)
|
9
9
|
|
10
10
|
@attribute_map = {
|
11
11
|
transfer_caller_id: 'transferCallerId', # Optional [String]: The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555) or be one of the following strings Restricted, Anonymous, Private, or Unavailable. Leave as default to pass along the number of the remote party. Defaults to None.
|
12
|
-
|
12
|
+
transfer_caller_display_name: 'transferCallerDisplayName', # Optional [String]: The caller display name to use when the call is transferred. May not exceed 256 characters nor contain control characters such as new lines. Defaults to None.
|
13
|
+
call_timeout: 'callTimeout', # Optional [Number]: The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Range: decimal values between 1 - 300. Default value is 30 seconds. Defaults to None.
|
13
14
|
transfer_complete_url: 'transferCompleteUrl', # Optional [String]: URL to send the Transfer Complete event to and request new BXML. Optional but recommended. See below for further details. May be a relative URL. Defaults to None.
|
14
15
|
transfer_complete_method: 'transferCompleteMethod', # Optional [String]: The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Defaults to None.
|
15
16
|
transfer_complete_fallback_url: 'transferCompleteFallbackUrl', # Optional [String]: A fallback url which, if provided, will be used to retry the Transfer Complete callback delivery in case transferCompleteUrl fails to respond. Defaults to None.
|
@@ -24,11 +25,17 @@ module Bandwidth
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
27
|
-
# Add transfer recipient
|
28
|
-
# @param recipients [PhoneNumber]
|
29
|
-
def
|
28
|
+
# Add transfer recipient or recipients to the nested verbs array
|
29
|
+
# @param recipients [PhoneNumber] or [SipUri] or [Array<PhoneNumber || SipUri>] Verb or verbs to add to the array.
|
30
|
+
def add_transfer_recipients(recipients)
|
30
31
|
@nested_verbs.push(*recipients)
|
31
32
|
end
|
33
|
+
|
34
|
+
extend Gem::Deprecate
|
35
|
+
def add_transfer_recipient(recipients)
|
36
|
+
add_transfer_recipients(recipients)
|
37
|
+
end
|
38
|
+
deprecate(:add_transfer_recipient, 'add_transfer_recipients', 2024, 7)
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
@@ -21,7 +21,7 @@ module Bandwidth
|
|
21
21
|
# The phone number(s) the message should be sent to in E164 format.
|
22
22
|
attr_accessor :to
|
23
23
|
|
24
|
-
#
|
24
|
+
# Either an alphanumeric sender ID or the sender's Bandwidth phone number in E.164 format, which must be hosted within Bandwidth and linked to the account that is generating the message. Alphanumeric Sender IDs can contain up to 11 characters, upper-case letters A-Z, lower-case letters a-z, numbers 0-9, space, hyphen -, plus +, underscore _ and ampersand &. Alphanumeric Sender IDs must contain at least one letter.
|
25
25
|
attr_accessor :from
|
26
26
|
|
27
27
|
# The contents of the text message. Must be 2048 characters or less.
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# Unit tests for Bandwidth::Bxml::Bxml
|
2
2
|
describe 'Bandwidth::Bxml::Bxml' do
|
3
3
|
let(:instance) { Bandwidth::Bxml::Bxml.new }
|
4
|
+
let(:pause_recording) { Bandwidth::Bxml::PauseRecording.new }
|
4
5
|
|
5
6
|
describe 'test an instance of Bxml' do
|
6
7
|
it 'validates instance of Bxml' do
|
@@ -8,6 +9,30 @@ describe 'Bandwidth::Bxml::Bxml' do
|
|
8
9
|
expect(instance).to be_a(Bandwidth::Bxml::Root)
|
9
10
|
end
|
10
11
|
|
12
|
+
it 'test initializing with a single nested verb' do
|
13
|
+
instance = Bandwidth::Bxml::Bxml.new(pause_recording)
|
14
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n</Bxml>\n"
|
15
|
+
expect(instance.to_bxml).to eq(expected)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'test initializing with multiple nested verbs' do
|
19
|
+
instance = Bandwidth::Bxml::Bxml.new([pause_recording, pause_recording])
|
20
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n <PauseRecording/>\n</Bxml>\n"
|
21
|
+
expect(instance.to_bxml).to eq(expected)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'test adding a single verb to the Bxml instance' do
|
25
|
+
instance.add_verbs(pause_recording)
|
26
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n</Bxml>\n"
|
27
|
+
expect(instance.to_bxml).to eq(expected)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'test adding multiple verbs to the Bxml instance' do
|
31
|
+
instance.add_verbs([pause_recording, pause_recording])
|
32
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml>\n <PauseRecording/>\n <PauseRecording/>\n</Bxml>\n"
|
33
|
+
expect(instance.to_bxml).to eq(expected)
|
34
|
+
end
|
35
|
+
|
11
36
|
it 'test the to_bxml method of the Bxml instance' do
|
12
37
|
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bxml/>\n"
|
13
38
|
expect(instance.to_bxml).to eq(expected)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# Unit tests for Bandwidth::Bxml::Response
|
2
2
|
describe 'Bandwidth::Bxml::Response' do
|
3
3
|
let(:instance) { Bandwidth::Bxml::Response.new }
|
4
|
+
let(:pause_recording) { Bandwidth::Bxml::PauseRecording.new }
|
4
5
|
|
5
6
|
describe 'test an instance of Response' do
|
6
7
|
it 'validates instance of Response' do
|
@@ -8,6 +9,30 @@ describe 'Bandwidth::Bxml::Response' do
|
|
8
9
|
expect(instance).to be_a(Bandwidth::Bxml::Root)
|
9
10
|
end
|
10
11
|
|
12
|
+
it 'test initializing with a single nested verb' do
|
13
|
+
instance = Bandwidth::Bxml::Response.new(pause_recording)
|
14
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n"
|
15
|
+
expect(instance.to_bxml).to eq(expected)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'test initializing with multiple nested verbs' do
|
19
|
+
instance = Bandwidth::Bxml::Response.new([pause_recording, pause_recording])
|
20
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n"
|
21
|
+
expect(instance.to_bxml).to eq(expected)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'test adding a single verb to the Response instance' do
|
25
|
+
instance.add_verbs(pause_recording)
|
26
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n</Response>\n"
|
27
|
+
expect(instance.to_bxml).to eq(expected)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'test adding multiple verbs to the Response instance' do
|
31
|
+
instance.add_verbs([pause_recording, pause_recording])
|
32
|
+
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <PauseRecording/>\n <PauseRecording/>\n</Response>\n"
|
33
|
+
expect(instance.to_bxml).to eq(expected)
|
34
|
+
end
|
35
|
+
|
11
36
|
it 'test the to_bxml method of the Response instance' do
|
12
37
|
expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response/>\n"
|
13
38
|
expect(instance.to_bxml).to eq(expected)
|
@@ -42,7 +42,7 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
42
42
|
let (:speak_sentence) { Bandwidth::Bxml::SpeakSentence.new('<lang xml:lang="es-MX">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis>') }
|
43
43
|
|
44
44
|
let(:instance) { Bandwidth::Bxml::Gather.new([], initial_attributes) }
|
45
|
-
let(:instance_nested) { Bandwidth::Bxml::Gather.new(
|
45
|
+
let(:instance_nested) { Bandwidth::Bxml::Gather.new(play_audio, initial_attributes) }
|
46
46
|
|
47
47
|
describe 'test an instance of Gather' do
|
48
48
|
it 'validates instance of Gather' do
|
@@ -75,11 +75,11 @@ describe 'Bandwidth::Bxml::Gather' do
|
|
75
75
|
|
76
76
|
it 'tests the add_verb method of the nested Gather instance' do
|
77
77
|
expected_single = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n</Gather>\n"
|
78
|
-
instance_nested.
|
78
|
+
instance_nested.add_audio_verbs(speak_sentence)
|
79
79
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
80
80
|
|
81
81
|
expected_multiple = "\n<Gather gatherUrl=\"https://initial.com\" gatherMethod=\"POST\" gatherFallbackUrl=\"https://initial.com\" gatherFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" terminatingDigits=\"5\" maxDigits=\"5\" interDigitTimeout=\"5\" firstDigitTimeout=\"5\" repeatCount=\"5\">\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <SpeakSentence><lang xml:lang=\"es-MX\">Hola</lang>ruby speak sentence <emphasis>SSML test</emphasis></SpeakSentence>\n <PlayAudio>https://audio.url/audio1.wav</PlayAudio>\n</Gather>\n"
|
82
|
-
instance_nested.
|
82
|
+
instance_nested.add_audio_verbs([speak_sentence, play_audio])
|
83
83
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
84
84
|
end
|
85
85
|
end
|
@@ -28,7 +28,7 @@ describe 'Bandwidth::Bxml::StartStream' do
|
|
28
28
|
let (:stream_param_2) { Bandwidth::Bxml::StreamParam.new({ name: 'stream_param_name_2', value: 'stream_param_value_2' }) }
|
29
29
|
|
30
30
|
let(:instance) { Bandwidth::Bxml::StartStream.new([], initial_attributes) }
|
31
|
-
let(:instance_nested) { Bandwidth::Bxml::StartStream.new(
|
31
|
+
let(:instance_nested) { Bandwidth::Bxml::StartStream.new(stream_param_1, initial_attributes) }
|
32
32
|
|
33
33
|
describe 'test an instance of StartStream' do
|
34
34
|
it 'validates instance of StartStream' do
|
@@ -61,11 +61,11 @@ describe 'Bandwidth::Bxml::StartStream' do
|
|
61
61
|
|
62
62
|
it 'tests the add_stream_param method of the nested StartStream instance' do
|
63
63
|
expected_single = "\n<StartStream name=\"initial_name\" tracks=\"inbound\" destination=\"https://initial.com\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
|
64
|
-
instance_nested.
|
64
|
+
instance_nested.add_stream_params(stream_param_2)
|
65
65
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
66
66
|
|
67
67
|
expected_multiple = "\n<StartStream name=\"initial_name\" tracks=\"inbound\" destination=\"https://initial.com\" streamEventUrl=\"https://initial.com\" streamEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\">\n <StreamParam name=\"stream_param_name_1\" value=\"stream_param_value_1\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n <StreamParam name=\"stream_param_name_2\" value=\"stream_param_value_2\"/>\n</StartStream>\n"
|
68
|
-
instance_nested.
|
68
|
+
instance_nested.add_stream_params([stream_param_2, stream_param_2])
|
69
69
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
70
70
|
end
|
71
71
|
end
|
@@ -30,7 +30,7 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
30
30
|
let (:custom_param_2) { Bandwidth::Bxml::CustomParam.new({ name: 'custom_param_name_2', value: 'custom_param_value_2' }) }
|
31
31
|
|
32
32
|
let(:instance) { Bandwidth::Bxml::StartTranscription.new([], initial_attributes) }
|
33
|
-
let(:instance_nested) { Bandwidth::Bxml::StartTranscription.new(
|
33
|
+
let(:instance_nested) { Bandwidth::Bxml::StartTranscription.new(custom_param_1, initial_attributes) }
|
34
34
|
|
35
35
|
describe 'test an instance of StartTranscription' do
|
36
36
|
it 'validates instance of StartTranscription' do
|
@@ -63,11 +63,11 @@ describe 'Bandwidth::Bxml::StartTranscription' do
|
|
63
63
|
|
64
64
|
it 'tests the add_custom_param method of the nested StartTranscription instance' do
|
65
65
|
expected_single = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
66
|
-
instance_nested.
|
66
|
+
instance_nested.add_custom_params(custom_param_2)
|
67
67
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
68
68
|
|
69
69
|
expected_multiple = "\n<StartTranscription name=\"initial_name\" tracks=\"inbound\" transcriptionEventUrl=\"https://initial.com\" transcriptionEventMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" destination=\"https://initial.com\" stabilized=\"true\">\n <CustomParam name=\"custom_param_name_1\" value=\"custom_param_value_1\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n <CustomParam name=\"custom_param_name_2\" value=\"custom_param_value_2\"/>\n</StartTranscription>\n"
|
70
|
-
instance_nested.
|
70
|
+
instance_nested.add_custom_params([custom_param_2, custom_param_2])
|
71
71
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
72
72
|
end
|
73
73
|
end
|
@@ -3,6 +3,7 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
3
3
|
let(:initial_attributes) {
|
4
4
|
{
|
5
5
|
transfer_caller_id: '+19195551234',
|
6
|
+
transfer_caller_display_name: 'initial_caller',
|
6
7
|
call_timeout: 5,
|
7
8
|
transfer_complete_url: 'https://initial.com',
|
8
9
|
transfer_complete_method: 'POST',
|
@@ -21,6 +22,7 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
21
22
|
let(:new_attributes) {
|
22
23
|
{
|
23
24
|
transfer_caller_id: '+19195554321',
|
25
|
+
transfer_caller_display_name: 'new_caller',
|
24
26
|
call_timeout: 10,
|
25
27
|
transfer_complete_url: 'https://new.com',
|
26
28
|
transfer_complete_method: 'POST',
|
@@ -40,7 +42,7 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
40
42
|
let(:sip_uri) { Bandwidth::Bxml::SipUri.new('sip:1-999-123-4567@voip-provider.example.net') }
|
41
43
|
|
42
44
|
let(:instance) { Bandwidth::Bxml::Transfer.new([], initial_attributes) }
|
43
|
-
let(:instance_nested) { Bandwidth::Bxml::Transfer.new(
|
45
|
+
let(:instance_nested) { Bandwidth::Bxml::Transfer.new(phone_number, initial_attributes) }
|
44
46
|
|
45
47
|
describe 'test an instance of Transfer' do
|
46
48
|
it 'validates instance of Transfer' do
|
@@ -49,13 +51,13 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
49
51
|
end
|
50
52
|
|
51
53
|
it 'tests the to_bxml method of the Transfer instance' do
|
52
|
-
expected = "\n<Transfer transferCallerId=\"+19195551234\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\"/>\n"
|
54
|
+
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\"/>\n"
|
53
55
|
expect(instance.to_bxml).to eq(expected)
|
54
56
|
end
|
55
57
|
|
56
58
|
it 'tests the set_attributes method of the Transfer instance' do
|
57
59
|
instance.set_attributes(new_attributes)
|
58
|
-
expected = "\n<Transfer transferCallerId=\"+19195554321\" callTimeout=\"10\" transferCompleteUrl=\"https://new.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://new.com\" transferCompleteFallbackMethod=\"POST\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" diversionTreatment=\"stack\" diversionReason=\"no-answer\"/>\n"
|
60
|
+
expected = "\n<Transfer transferCallerId=\"+19195554321\" transferCallerDisplayName=\"new_caller\" callTimeout=\"10\" transferCompleteUrl=\"https://new.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://new.com\" transferCompleteFallbackMethod=\"POST\" username=\"new_username\" password=\"new_password\" fallbackUsername=\"new_fallback_username\" fallbackPassword=\"new_fallback_password\" tag=\"new_tag\" diversionTreatment=\"stack\" diversionReason=\"no-answer\"/>\n"
|
59
61
|
expect(instance.to_bxml).to eq(expected)
|
60
62
|
end
|
61
63
|
end
|
@@ -67,17 +69,17 @@ describe 'Bandwidth::Bxml::Transfer' do
|
|
67
69
|
end
|
68
70
|
|
69
71
|
it 'tests the to_bxml method of the nested Transfer instance' do
|
70
|
-
expected = "\n<Transfer transferCallerId=\"+19195551234\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
72
|
+
expected = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
71
73
|
expect(instance_nested.to_bxml).to eq(expected)
|
72
74
|
end
|
73
75
|
|
74
76
|
it 'tests the add_verb method of the nested Transfer instance' do
|
75
|
-
expected_single = "\n<Transfer transferCallerId=\"+19195551234\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n</Transfer>\n"
|
76
|
-
instance_nested.
|
77
|
+
expected_single = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n</Transfer>\n"
|
78
|
+
instance_nested.add_transfer_recipients(sip_uri)
|
77
79
|
expect(instance_nested.to_bxml).to eq(expected_single)
|
78
80
|
|
79
|
-
expected_multiple = "\n<Transfer transferCallerId=\"+19195551234\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
80
|
-
instance_nested.
|
81
|
+
expected_multiple = "\n<Transfer transferCallerId=\"+19195551234\" transferCallerDisplayName=\"initial_caller\" callTimeout=\"5\" transferCompleteUrl=\"https://initial.com\" transferCompleteMethod=\"POST\" transferCompleteFallbackUrl=\"https://initial.com\" transferCompleteFallbackMethod=\"POST\" username=\"initial_username\" password=\"initial_password\" fallbackUsername=\"initial_fallback_username\" fallbackPassword=\"initial_fallback_password\" tag=\"initial_tag\" diversionTreatment=\"propagate\" diversionReason=\"user-busy\">\n <PhoneNumber>+19195551234</PhoneNumber>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <SipUri>sip:1-999-123-4567@voip-provider.example.net</SipUri>\n <PhoneNumber>+19195551234</PhoneNumber>\n</Transfer>\n"
|
82
|
+
instance_nested.add_transfer_recipients([sip_uri, phone_number])
|
81
83
|
expect(instance_nested.to_bxml).to eq(expected_multiple)
|
82
84
|
end
|
83
85
|
end
|
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: 11.
|
4
|
+
version: 11.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bandwidth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -461,61 +461,61 @@ specification_version: 4
|
|
461
461
|
summary: Bandwidth Ruby SDK
|
462
462
|
test_files:
|
463
463
|
- spec/api/recordings_api_spec.rb
|
464
|
-
- spec/api/phone_number_lookup_api_spec.rb
|
465
|
-
- spec/api/messages_api_spec.rb
|
466
|
-
- spec/api/statistics_api_spec.rb
|
467
|
-
- spec/api/calls_api_spec.rb
|
468
|
-
- spec/api/media_api_spec.rb
|
469
464
|
- spec/api/mfa_api_spec.rb
|
465
|
+
- spec/api/calls_api_spec.rb
|
470
466
|
- spec/api/conferences_api_spec.rb
|
467
|
+
- spec/api/statistics_api_spec.rb
|
468
|
+
- spec/api/media_api_spec.rb
|
469
|
+
- spec/api/phone_number_lookup_api_spec.rb
|
470
|
+
- spec/api/messages_api_spec.rb
|
471
471
|
- spec/api_client_spec.rb
|
472
472
|
- spec/api_error_spec.rb
|
473
473
|
- spec/call_utils.rb
|
474
474
|
- spec/configuration_spec.rb
|
475
475
|
- spec/fixtures/ruby_cat.jpeg
|
476
476
|
- spec/integration/mfa_api_integration_spec.rb
|
477
|
-
- spec/integration/media_api_integration_spec.rb
|
478
|
-
- spec/integration/messages_api_integration_spec.rb
|
479
477
|
- spec/integration/calls_api_integration_spec.rb
|
478
|
+
- spec/integration/recordings_api_integration_spec.rb
|
480
479
|
- spec/integration/conferences_api_integration_spec.rb
|
480
|
+
- spec/integration/messages_api_integration_spec.rb
|
481
481
|
- spec/integration/phone_number_lookup_api_integration_spec.rb
|
482
|
-
- spec/integration/
|
482
|
+
- spec/integration/media_api_integration_spec.rb
|
483
483
|
- spec/integration/statistics_api_integration_spec.rb
|
484
484
|
- spec/models/deferred_result_spec.rb
|
485
485
|
- spec/models/verify_code_request_spec.rb
|
486
486
|
- spec/models/call_state_enum_spec.rb
|
487
487
|
- spec/models/call_state_spec.rb
|
488
|
-
- spec/models/
|
488
|
+
- spec/models/bxml/bxml_spec.rb
|
489
489
|
- spec/models/bxml/response_spec.rb
|
490
|
-
- spec/models/bxml/
|
491
|
-
- spec/models/bxml/verbs/
|
492
|
-
- spec/models/bxml/verbs/
|
493
|
-
- spec/models/bxml/verbs/
|
494
|
-
- spec/models/bxml/verbs/pause_recording_spec.rb
|
495
|
-
- spec/models/bxml/verbs/stop_gather_spec.rb
|
496
|
-
- spec/models/bxml/verbs/conference_spec.rb
|
497
|
-
- spec/models/bxml/verbs/sip_uri_spec.rb
|
498
|
-
- spec/models/bxml/verbs/resume_recording_spec.rb
|
499
|
-
- spec/models/bxml/verbs/tag_spec.rb
|
490
|
+
- spec/models/bxml/verb_spec.rb
|
491
|
+
- spec/models/bxml/verbs/stop_stream_spec.rb
|
492
|
+
- spec/models/bxml/verbs/start_recording_spec.rb
|
493
|
+
- spec/models/bxml/verbs/send_dtmf_spec.rb
|
500
494
|
- spec/models/bxml/verbs/speak_sentence_spec.rb
|
495
|
+
- spec/models/bxml/verbs/custom_param_spec.rb
|
501
496
|
- spec/models/bxml/verbs/start_stream_spec.rb
|
502
|
-
- spec/models/bxml/verbs/transfer_spec.rb
|
503
497
|
- spec/models/bxml/verbs/start_transcription_spec.rb
|
504
|
-
- spec/models/bxml/verbs/
|
498
|
+
- spec/models/bxml/verbs/pause_recording_spec.rb
|
499
|
+
- spec/models/bxml/verbs/phone_number_spec.rb
|
500
|
+
- spec/models/bxml/verbs/stream_param_spec.rb
|
501
|
+
- spec/models/bxml/verbs/bridge_spec.rb
|
505
502
|
- spec/models/bxml/verbs/record_spec.rb
|
506
|
-
- spec/models/bxml/verbs/
|
503
|
+
- spec/models/bxml/verbs/pause_spec.rb
|
504
|
+
- spec/models/bxml/verbs/play_audio_spec.rb
|
505
|
+
- spec/models/bxml/verbs/stop_recording_spec.rb
|
506
|
+
- spec/models/bxml/verbs/forward_spec.rb
|
507
507
|
- spec/models/bxml/verbs/stop_transcription_spec.rb
|
508
|
-
- spec/models/bxml/verbs/send_dtmf_spec.rb
|
509
|
-
- spec/models/bxml/verbs/custom_param_spec.rb
|
510
|
-
- spec/models/bxml/verbs/gather_spec.rb
|
511
508
|
- spec/models/bxml/verbs/ring_spec.rb
|
512
|
-
- spec/models/bxml/verbs/
|
509
|
+
- spec/models/bxml/verbs/tag_spec.rb
|
510
|
+
- spec/models/bxml/verbs/sip_uri_spec.rb
|
511
|
+
- spec/models/bxml/verbs/redirect_spec.rb
|
512
|
+
- spec/models/bxml/verbs/conference_spec.rb
|
513
|
+
- spec/models/bxml/verbs/stop_gather_spec.rb
|
514
|
+
- spec/models/bxml/verbs/gather_spec.rb
|
515
|
+
- spec/models/bxml/verbs/resume_recording_spec.rb
|
513
516
|
- spec/models/bxml/verbs/start_gather_spec.rb
|
514
|
-
- spec/models/bxml/verbs/
|
515
|
-
- spec/models/bxml/verbs/
|
516
|
-
- spec/models/bxml/verbs/phone_number_spec.rb
|
517
|
-
- spec/models/bxml/verbs/pause_spec.rb
|
517
|
+
- spec/models/bxml/verbs/transfer_spec.rb
|
518
|
+
- spec/models/bxml/verbs/hangup_spec.rb
|
518
519
|
- spec/models/bxml/nestable_verb_spec.rb
|
519
|
-
- spec/models/
|
520
|
-
- spec/models/bxml/verb_spec.rb
|
520
|
+
- spec/models/message_spec.rb
|
521
521
|
- spec/spec_helper.rb
|