bandwidth-sdk 10.0.0 → 10.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65f5051221fb33aaeeb193511c0fb9b74521f3b045c2441a275534b7b3f990a6
|
4
|
+
data.tar.gz: 21463dabcfd99cc0249b8ee472ea66d7cfa833e221d104c8d81b8474191de6b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfa0184eafdb711138d580e4c3d19c996fecd14f922b4231f54b2a596576b1f167510990b00efb121ac4f140b5dcf54dd81aa4279eaabf062fd13c98de6a8473
|
7
|
+
data.tar.gz: 39d4c810fb556f6fb897656617d7c2cd1e2b3c7a553be506d35f208c7e13e24cd0b293f876776dca022f4b50d8f250f66e6ec31edc0edc3b03379fe572202939
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The StartStream verb allows a segment of a call to be sent off to another destination for additional processing
|
6
|
+
class StartStream
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.StartStream(compact_hash({
|
11
|
+
'destination' => destination,
|
12
|
+
'name' => name,
|
13
|
+
'tracks' => tracks,
|
14
|
+
'streamEventUrl' => streamEventUrl,
|
15
|
+
'streamEventMethod' => streamEventMethod,
|
16
|
+
'username' => username,
|
17
|
+
'password' => password
|
18
|
+
})) do
|
19
|
+
def embedded_xml(xml, property, type)
|
20
|
+
if property
|
21
|
+
s = if property.is_a?(type)
|
22
|
+
then property
|
23
|
+
else type.new(property)
|
24
|
+
end
|
25
|
+
s.to_bxml(xml)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def nest_verbs_list(xml, property)
|
29
|
+
if property
|
30
|
+
property.each do |verb|
|
31
|
+
verb.to_bxml(xml)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
embedded_xml(xml, stream_params, StreamParam)
|
36
|
+
nest_verbs_list(xml, nested_verbs)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The StopStream verb is used to stop a stream that was started with a previous `<StartStream>` verb
|
6
|
+
class StopStream
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.StopStream(compact_hash({
|
11
|
+
'name' => name
|
12
|
+
}))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The StartStream verb allows a segment of a call to be sent off to another destination for additional processing
|
6
|
+
class StreamParam
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.StreamParam(compact_hash({
|
11
|
+
'name' => name,
|
12
|
+
'value' => value
|
13
|
+
}))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -82,7 +82,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
82
82
|
media = "Hello world"
|
83
83
|
|
84
84
|
#media upload
|
85
|
-
@bandwidth_client.messaging_client.client.upload_media(BW_ACCOUNT_ID, media_id, media, :content_type => "
|
85
|
+
@bandwidth_client.messaging_client.client.upload_media(BW_ACCOUNT_ID, media_id, media, :content_type => "text/plain", :cache_control => "no-cache")
|
86
86
|
|
87
87
|
#media download
|
88
88
|
downloaded_media = @bandwidth_client.messaging_client.client.get_media(BW_ACCOUNT_ID, media_id).data
|
@@ -274,7 +274,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
274
274
|
assert_equal(expected, actual)
|
275
275
|
end
|
276
276
|
|
277
|
-
def
|
277
|
+
def test_speak_sentence_pause
|
278
278
|
bxml = Bandwidth::Voice::Bxml.new()
|
279
279
|
|
280
280
|
speak_sentence = Bandwidth::Voice::SpeakSentence.new({
|
@@ -688,4 +688,73 @@ class IntegrationTest < Test::Unit::TestCase
|
|
688
688
|
actual = Bandwidth::WebRtc.generate_transfer_bxml_verb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
|
689
689
|
assert_equal(expected, actual)
|
690
690
|
end
|
691
|
+
|
692
|
+
def test_start_stream_bxml_verb
|
693
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartStream destination="https://www.test.com/stream" name="test_stream" tracks="inbound" streamEventUrl="https://www.test.com/event" streamEventMethod="POST" username="username" password="password"><StreamParam name="name1" value="value1"/></StartStream></Response>'
|
694
|
+
response = Bandwidth::Voice::Response.new()
|
695
|
+
|
696
|
+
stream_param1 = Bandwidth::Voice::StreamParam.new({
|
697
|
+
:name => "name1",
|
698
|
+
:value => "value1"
|
699
|
+
})
|
700
|
+
|
701
|
+
start_stream = Bandwidth::Voice::StartStream.new({
|
702
|
+
:destination => "https://www.test.com/stream",
|
703
|
+
:name => "test_stream",
|
704
|
+
:tracks => "inbound",
|
705
|
+
:streamEventUrl => "https://www.test.com/event",
|
706
|
+
:streamEventMethod => "POST",
|
707
|
+
:username => "username",
|
708
|
+
:password => "password",
|
709
|
+
:stream_params => stream_param1
|
710
|
+
})
|
711
|
+
|
712
|
+
response.push(start_stream)
|
713
|
+
actual = response.to_bxml()
|
714
|
+
|
715
|
+
assert_equal(expected, actual)
|
716
|
+
end
|
717
|
+
|
718
|
+
def test_start_stream_multiple_nested_stream_params
|
719
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StartStream destination="https://www.test.com/stream" name="test_stream" tracks="inbound" streamEventUrl="https://www.test.com/event" streamEventMethod="POST" username="username" password="password"><StreamParam name="name1" value="value1"/><StreamParam name="name2" value="value2"/></StartStream></Response>'
|
720
|
+
response = Bandwidth::Voice::Response.new()
|
721
|
+
|
722
|
+
stream_param1 = Bandwidth::Voice::StreamParam.new({
|
723
|
+
:name => "name1",
|
724
|
+
:value => "value1"
|
725
|
+
})
|
726
|
+
|
727
|
+
stream_param2 = Bandwidth::Voice::StreamParam.new({
|
728
|
+
:name => "name2",
|
729
|
+
:value => "value2"
|
730
|
+
})
|
731
|
+
|
732
|
+
start_stream = Bandwidth::Voice::StartStream.new({
|
733
|
+
:destination => "https://www.test.com/stream",
|
734
|
+
:name => "test_stream",
|
735
|
+
:tracks => "inbound",
|
736
|
+
:streamEventUrl => "https://www.test.com/event",
|
737
|
+
:streamEventMethod => "POST",
|
738
|
+
:username => "username",
|
739
|
+
:password => "password",
|
740
|
+
:nested_verbs => [stream_param1, stream_param2]
|
741
|
+
})
|
742
|
+
|
743
|
+
response.push(start_stream)
|
744
|
+
actual = response.to_bxml()
|
745
|
+
|
746
|
+
assert_equal(expected, actual)
|
747
|
+
end
|
748
|
+
|
749
|
+
def test_stop_stream_bxml_verb
|
750
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopStream name="test_stream"/></Response>'
|
751
|
+
response = Bandwidth::Voice::Response.new()
|
752
|
+
stop_stream = Bandwidth::Voice::StopStream.new({
|
753
|
+
:name => "test_stream"
|
754
|
+
})
|
755
|
+
response.push(stop_stream)
|
756
|
+
actual = response.to_bxml()
|
757
|
+
|
758
|
+
assert_equal(expected, actual)
|
759
|
+
end
|
691
760
|
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: 10.
|
4
|
+
version: 10.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bandwidth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -281,8 +281,11 @@ files:
|
|
281
281
|
- lib/bandwidth/voice_lib/bxml/verbs/speak_sentence.rb
|
282
282
|
- lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb
|
283
283
|
- lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb
|
284
|
+
- lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb
|
284
285
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb
|
285
286
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb
|
287
|
+
- lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb
|
288
|
+
- lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb
|
286
289
|
- lib/bandwidth/voice_lib/bxml/verbs/tag.rb
|
287
290
|
- lib/bandwidth/voice_lib/bxml/verbs/transfer.rb
|
288
291
|
- lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb
|