bandwidth-sdk 10.1.0 → 10.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 668cc1c385cbaef57a22692979b253aaf3b19847fb9dbf4edd6e72b655c34da2
4
- data.tar.gz: a2c3621b86adccbe0f3a114013c4b3aac2b8d03560f22a8aa135c5de4f64e181
3
+ metadata.gz: 6da05ba4b6e401983ac08107e419d06a018640e84f980eb39aea9f9a8c8458fd
4
+ data.tar.gz: daab0265c2590c6c289b9582d3325f159f3501b66240873c821f269d613e4033
5
5
  SHA512:
6
- metadata.gz: '09c7e3ef8c10db03d7640272be5085dad7b0aa3a812fc5d40b45082992e01ffd5b1de3ed0c03732f343b178ac26489efbc809996087f007c76c106dd4d429ea9'
7
- data.tar.gz: 80a97346a1250ad071570f618318f7aeb9ad523946b899f40b20affd2a3c15791bbefa97a89cd60bb1a9041f76bfb63fc2ecebc4ac610b532ee2f2adcc8c59b0
6
+ metadata.gz: 9cc3ffa14b5c4c6574f26524a8caf74e4efdba60e5ab02f7aa74e8ef6ef70d62ffa5d9c6be66ee715d64a3db9e16e0e94a0bcf829aeccc5f4c240af68e4efc9f
7
+ data.tar.gz: 14d7c3993dd30956d75043799b50db9ac075c505cf3255bd0dd9040ccf3695cc67f51a9ed341acfbbc010dd3326a62eb4cf7244b1e4a52cd49e0c5e635b0852e
data/README.md CHANGED
@@ -7,8 +7,8 @@
7
7
  |:---:|:---:|
8
8
  | Windows 2016 | 2.6, 2.7, 3.0 |
9
9
  | Windows 2019 | 2.6, 2.7, 3.0 |
10
- | Ubuntu 18.04 | 2.6, 2.7, 3.0 |
11
10
  | Ubuntu 20.04 | 2.6, 2.7, 3.0 |
11
+ | Ubuntu 22.04 | 2.6, 2.7, 3.0 |
12
12
 
13
13
  ## Getting Started
14
14
 
@@ -4,7 +4,6 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  require 'faraday/follow_redirects'
7
- require 'faraday/gzip'
8
7
  require 'faraday/http_cache'
9
8
  require 'faraday/multipart'
10
9
  require 'faraday/retry'
@@ -19,10 +18,8 @@ module Bandwidth
19
18
  @connection = Faraday.new do |faraday|
20
19
  faraday.use Faraday::HttpCache, serializer: Marshal if cache
21
20
  faraday.use Faraday::FollowRedirects::Middleware
22
- faraday.request :gzip
23
21
  faraday.request :multipart
24
22
  faraday.request :url_encoded
25
- faraday.ssl[:ca_file] = Certifi.where
26
23
  faraday.ssl[:verify] = verify
27
24
  faraday.request :retry, max: max_retries, interval: retry_interval,
28
25
  backoff_factor: backoff_factor,
@@ -61,6 +61,10 @@ module Bandwidth
61
61
  # @return [String]
62
62
  attr_accessor :priority
63
63
 
64
+ # A string with the date/time value that the message will automatically expire by.
65
+ # @return [String]
66
+ attr_accessor :expiration
67
+
64
68
  # A mapping from model property names to API property names.
65
69
  def self.names
66
70
  @_hash = {} if @_hash.nil?
@@ -76,6 +80,7 @@ module Bandwidth
76
80
  @_hash['text'] = 'text'
77
81
  @_hash['tag'] = 'tag'
78
82
  @_hash['priority'] = 'priority'
83
+ @_hash['expiration'] = 'expiration'
79
84
  @_hash
80
85
  end
81
86
 
@@ -94,6 +99,7 @@ module Bandwidth
94
99
  text
95
100
  tag
96
101
  priority
102
+ expiration
97
103
  ]
98
104
  end
99
105
 
@@ -113,7 +119,8 @@ module Bandwidth
113
119
  media = nil,
114
120
  text = nil,
115
121
  tag = nil,
116
- priority = nil)
122
+ priority = nil,
123
+ expiration = nil)
117
124
  @id = id unless id == SKIP
118
125
  @owner = owner unless owner == SKIP
119
126
  @application_id = application_id unless application_id == SKIP
@@ -126,6 +133,7 @@ module Bandwidth
126
133
  @text = text unless text == SKIP
127
134
  @tag = tag unless tag == SKIP
128
135
  @priority = priority unless priority == SKIP
136
+ @expiration = expiration unless expiration == SKIP
129
137
  end
130
138
 
131
139
  # Creates an instance of the object from a hash.
@@ -145,6 +153,7 @@ module Bandwidth
145
153
  text = hash.key?('text') ? hash['text'] : SKIP
146
154
  tag = hash.key?('tag') ? hash['tag'] : SKIP
147
155
  priority = hash.key?('priority') ? hash['priority'] : SKIP
156
+ expiration = hash.key?('expiration') ? hash['expiration'] : SKIP
148
157
 
149
158
  # Create object from extracted values.
150
159
  BandwidthMessage.new(id,
@@ -158,7 +167,8 @@ module Bandwidth
158
167
  media,
159
168
  text,
160
169
  tag,
161
- priority)
170
+ priority,
171
+ expiration)
162
172
  end
163
173
  end
164
174
  end
@@ -41,6 +41,11 @@ module Bandwidth
41
41
  # @return [PriorityEnum]
42
42
  attr_accessor :priority
43
43
 
44
+ # A string with the date/time value that the message will automatically expire by.
45
+ # This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00.
46
+ # @return [String]
47
+ attr_accessor :expiration
48
+
44
49
  # A mapping from model property names to API property names.
45
50
  def self.names
46
51
  @_hash = {} if @_hash.nil?
@@ -51,6 +56,7 @@ module Bandwidth
51
56
  @_hash['media'] = 'media'
52
57
  @_hash['tag'] = 'tag'
53
58
  @_hash['priority'] = 'priority'
59
+ @_hash['expiration'] = 'expiration'
54
60
  @_hash
55
61
  end
56
62
 
@@ -61,6 +67,7 @@ module Bandwidth
61
67
  media
62
68
  tag
63
69
  priority
70
+ expiration
64
71
  ]
65
72
  end
66
73
 
@@ -75,7 +82,8 @@ module Bandwidth
75
82
  text = nil,
76
83
  media = nil,
77
84
  tag = nil,
78
- priority = nil)
85
+ priority = nil,
86
+ expiration = nil)
79
87
  @application_id = application_id unless application_id == SKIP
80
88
  @to = to unless to == SKIP
81
89
  @from = from unless from == SKIP
@@ -83,6 +91,7 @@ module Bandwidth
83
91
  @media = media unless media == SKIP
84
92
  @tag = tag unless tag == SKIP
85
93
  @priority = priority unless priority == SKIP
94
+ @expiration = expiration unless expiration == SKIP
86
95
  end
87
96
 
88
97
  # Creates an instance of the object from a hash.
@@ -97,6 +106,7 @@ module Bandwidth
97
106
  media = hash.key?('media') ? hash['media'] : SKIP
98
107
  tag = hash.key?('tag') ? hash['tag'] : SKIP
99
108
  priority = hash.key?('priority') ? hash['priority'] : SKIP
109
+ expiration = hash.key?('expiration') ? hash['expiration'] : SKIP
100
110
 
101
111
  # Create object from extracted values.
102
112
  MessageRequest.new(application_id,
@@ -105,7 +115,8 @@ module Bandwidth
105
115
  text,
106
116
  media,
107
117
  tag,
108
- priority)
118
+ priority,
119
+ expiration)
109
120
  end
110
121
  end
111
122
  end
@@ -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
data/lib/bandwidth.rb CHANGED
@@ -6,7 +6,6 @@
6
6
  require 'date'
7
7
  require 'json'
8
8
  require 'faraday'
9
- require 'certifi'
10
9
  require 'logging'
11
10
 
12
11
  require_relative 'bandwidth/api_helper'
@@ -57,7 +57,14 @@ class IntegrationTest < Test::Unit::TestCase
57
57
  body.to = [USER_NUMBER]
58
58
  body.from = BW_NUMBER
59
59
  body.text = "Ruby Integration"
60
+ body.priority = "high"
61
+ body.expiration = "2091-02-01T11:29:18-05:00"
60
62
  response = @bandwidth_client.messaging_client.client.create_message(BW_ACCOUNT_ID, body)
63
+ assert(response.data.to == [USER_NUMBER])
64
+ assert(response.data.from == BW_NUMBER)
65
+ assert(response.data.text == "Ruby Integration")
66
+ assert(response.data.priority == "high")
67
+ assert(response.data.expiration == "2091-02-01T11:29:18-05:00")
61
68
  assert(response.data.id.length > 0, "id value not set") #validate that _some_ id was returned
62
69
  end
63
70
 
@@ -274,7 +281,7 @@ class IntegrationTest < Test::Unit::TestCase
274
281
  assert_equal(expected, actual)
275
282
  end
276
283
 
277
- def test_bxml_speak_sentence_pause
284
+ def test_speak_sentence_pause
278
285
  bxml = Bandwidth::Voice::Bxml.new()
279
286
 
280
287
  speak_sentence = Bandwidth::Voice::SpeakSentence.new({
@@ -690,8 +697,45 @@ class IntegrationTest < Test::Unit::TestCase
690
697
  end
691
698
 
692
699
  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>'
700
+ 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
701
  response = Bandwidth::Voice::Response.new()
702
+
703
+ stream_param1 = Bandwidth::Voice::StreamParam.new({
704
+ :name => "name1",
705
+ :value => "value1"
706
+ })
707
+
708
+ start_stream = Bandwidth::Voice::StartStream.new({
709
+ :destination => "https://www.test.com/stream",
710
+ :name => "test_stream",
711
+ :tracks => "inbound",
712
+ :streamEventUrl => "https://www.test.com/event",
713
+ :streamEventMethod => "POST",
714
+ :username => "username",
715
+ :password => "password",
716
+ :stream_params => stream_param1
717
+ })
718
+
719
+ response.push(start_stream)
720
+ actual = response.to_bxml()
721
+
722
+ assert_equal(expected, actual)
723
+ end
724
+
725
+ def test_start_stream_multiple_nested_stream_params
726
+ 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>'
727
+ response = Bandwidth::Voice::Response.new()
728
+
729
+ stream_param1 = Bandwidth::Voice::StreamParam.new({
730
+ :name => "name1",
731
+ :value => "value1"
732
+ })
733
+
734
+ stream_param2 = Bandwidth::Voice::StreamParam.new({
735
+ :name => "name2",
736
+ :value => "value2"
737
+ })
738
+
695
739
  start_stream = Bandwidth::Voice::StartStream.new({
696
740
  :destination => "https://www.test.com/stream",
697
741
  :name => "test_stream",
@@ -699,8 +743,10 @@ class IntegrationTest < Test::Unit::TestCase
699
743
  :streamEventUrl => "https://www.test.com/event",
700
744
  :streamEventMethod => "POST",
701
745
  :username => "username",
702
- :password => "password"
746
+ :password => "password",
747
+ :nested_verbs => [stream_param1, stream_param2]
703
748
  })
749
+
704
750
  response.push(start_stream)
705
751
  actual = response.to_bxml()
706
752
 
data/test/test_helper.rb CHANGED
@@ -87,8 +87,8 @@ class TestHelper
87
87
  unless @cache.keys.include? url
88
88
  @cache[url] = Tempfile.new('APIMatic')
89
89
  @cache[url].binmode
90
- @cache[url].write(open(url, {ssl_ca_cert: Certifi.where}).read)
90
+ @cache[url].write(open(url).read)
91
91
  end
92
92
  return @cache[url].path
93
93
  end
94
- end
94
+ 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.1.0
4
+ version: 10.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: 2022-08-30 00:00:00.000000000 Z
11
+ date: 2023-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -58,20 +58,6 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0.3'
61
- - !ruby/object:Gem::Dependency
62
- name: faraday-gzip
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: 0.1.0
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: 0.1.0
75
61
  - !ruby/object:Gem::Dependency
76
62
  name: faraday-multipart
77
63
  requirement: !ruby/object:Gem::Requirement
@@ -100,26 +86,6 @@ dependencies:
100
86
  - - "~>"
101
87
  - !ruby/object:Gem::Version
102
88
  version: '1.0'
103
- - !ruby/object:Gem::Dependency
104
- name: certifi
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '2018.1'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 2018.01.18
113
- type: :runtime
114
- prerelease: false
115
- version_requirements: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '2018.1'
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: 2018.01.18
123
89
  - !ruby/object:Gem::Dependency
124
90
  name: faraday-http-cache
125
91
  requirement: !ruby/object:Gem::Requirement
@@ -285,6 +251,7 @@ files:
285
251
  - lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb
286
252
  - lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb
287
253
  - lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb
254
+ - lib/bandwidth/voice_lib/bxml/verbs/stream_param.rb
288
255
  - lib/bandwidth/voice_lib/bxml/verbs/tag.rb
289
256
  - lib/bandwidth/voice_lib/bxml/verbs/transfer.rb
290
257
  - lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb
@@ -362,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
329
  - !ruby/object:Gem::Version
363
330
  version: '0'
364
331
  requirements: []
365
- rubygems_version: 3.3.7
332
+ rubygems_version: 3.4.6
366
333
  signing_key:
367
334
  specification_version: 4
368
335
  summary: Bandwidth