bandwidth-sdk 10.1.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: 668cc1c385cbaef57a22692979b253aaf3b19847fb9dbf4edd6e72b655c34da2
4
- data.tar.gz: a2c3621b86adccbe0f3a114013c4b3aac2b8d03560f22a8aa135c5de4f64e181
3
+ metadata.gz: 65f5051221fb33aaeeb193511c0fb9b74521f3b045c2441a275534b7b3f990a6
4
+ data.tar.gz: 21463dabcfd99cc0249b8ee472ea66d7cfa833e221d104c8d81b8474191de6b7
5
5
  SHA512:
6
- metadata.gz: '09c7e3ef8c10db03d7640272be5085dad7b0aa3a812fc5d40b45082992e01ffd5b1de3ed0c03732f343b178ac26489efbc809996087f007c76c106dd4d429ea9'
7
- data.tar.gz: 80a97346a1250ad071570f618318f7aeb9ad523946b899f40b20affd2a3c15791bbefa97a89cd60bb1a9041f76bfb63fc2ecebc4ac610b532ee2f2adcc8c59b0
6
+ metadata.gz: dfa0184eafdb711138d580e4c3d19c996fecd14f922b4231f54b2a596576b1f167510990b00efb121ac4f140b5dcf54dd81aa4279eaabf062fd13c98de6a8473
7
+ data.tar.gz: 39d4c810fb556f6fb897656617d7c2cd1e2b3c7a553be506d35f208c7e13e24cd0b293f876776dca022f4b50d8f250f66e6ec31edc0edc3b03379fe572202939
@@ -15,7 +15,26 @@ module Bandwidth
15
15
  'streamEventMethod' => streamEventMethod,
16
16
  'username' => username,
17
17
  'password' => password
18
- }))
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
19
38
  end
20
39
  end
21
40
  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
@@ -274,7 +274,7 @@ class IntegrationTest < Test::Unit::TestCase
274
274
  assert_equal(expected, actual)
275
275
  end
276
276
 
277
- def test_bxml_speak_sentence_pause
277
+ def test_speak_sentence_pause
278
278
  bxml = Bandwidth::Voice::Bxml.new()
279
279
 
280
280
  speak_sentence = Bandwidth::Voice::SpeakSentence.new({
@@ -690,8 +690,45 @@ class IntegrationTest < Test::Unit::TestCase
690
690
  end
691
691
 
692
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"/></Response>'
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
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
+
695
732
  start_stream = Bandwidth::Voice::StartStream.new({
696
733
  :destination => "https://www.test.com/stream",
697
734
  :name => "test_stream",
@@ -699,8 +736,10 @@ class IntegrationTest < Test::Unit::TestCase
699
736
  :streamEventUrl => "https://www.test.com/event",
700
737
  :streamEventMethod => "POST",
701
738
  :username => "username",
702
- :password => "password"
739
+ :password => "password",
740
+ :nested_verbs => [stream_param1, stream_param2]
703
741
  })
742
+
704
743
  response.push(start_stream)
705
744
  actual = response.to_bxml()
706
745
 
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.1.0
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-08-30 00:00:00.000000000 Z
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -285,6 +285,7 @@ files:
285
285
  - lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb
286
286
  - lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb
287
287
  - lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb
288
+ - lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb
288
289
  - lib/bandwidth/voice_lib/bxml/verbs/tag.rb
289
290
  - lib/bandwidth/voice_lib/bxml/verbs/transfer.rb
290
291
  - lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb