bandwidth-sdk 9.4.0 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/bandwidth/http/faraday_client.rb +6 -3
- data/lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb +22 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb +16 -0
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +19 -2
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +10 -10
- data/test/integration/test_integration.rb +35 -1
- metadata +66 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 668cc1c385cbaef57a22692979b253aaf3b19847fb9dbf4edd6e72b655c34da2
|
4
|
+
data.tar.gz: a2c3621b86adccbe0f3a114013c4b3aac2b8d03560f22a8aa135c5de4f64e181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c7e3ef8c10db03d7640272be5085dad7b0aa3a812fc5d40b45082992e01ffd5b1de3ed0c03732f343b178ac26489efbc809996087f007c76c106dd4d429ea9'
|
7
|
+
data.tar.gz: 80a97346a1250ad071570f618318f7aeb9ad523946b899f40b20affd2a3c15791bbefa97a89cd60bb1a9041f76bfb63fc2ecebc4ac610b532ee2f2adcc8c59b0
|
data/README.md
CHANGED
@@ -156,7 +156,10 @@ create_participant_response = web_rtc_client.create_participant(account_id, :bod
|
|
156
156
|
participant_id = create_participant_response.data.participant.id
|
157
157
|
puts participant_id
|
158
158
|
|
159
|
-
|
159
|
+
body = Subscriptions.new
|
160
|
+
body.session_id = "1234-abcd"
|
161
|
+
|
162
|
+
web_rtc_client.add_participant_to_session(account_id, session_id, participant_id, body: body)
|
160
163
|
```
|
161
164
|
|
162
165
|
## Supported Ruby Versions
|
@@ -3,8 +3,11 @@
|
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
+
require 'faraday/follow_redirects'
|
7
|
+
require 'faraday/gzip'
|
6
8
|
require 'faraday/http_cache'
|
7
|
-
require '
|
9
|
+
require 'faraday/multipart'
|
10
|
+
require 'faraday/retry'
|
8
11
|
|
9
12
|
module Bandwidth
|
10
13
|
# An implementation of HttpClient.
|
@@ -15,8 +18,8 @@ module Bandwidth
|
|
15
18
|
cache: false, verify: true)
|
16
19
|
@connection = Faraday.new do |faraday|
|
17
20
|
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
18
|
-
faraday.use
|
19
|
-
faraday.
|
21
|
+
faraday.use Faraday::FollowRedirects::Middleware
|
22
|
+
faraday.request :gzip
|
20
23
|
faraday.request :multipart
|
21
24
|
faraday.request :url_encoded
|
22
25
|
faraday.ssl[:ca_file] = Certifi.where
|
@@ -0,0 +1,22 @@
|
|
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
|
+
}))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
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
|
@@ -62,6 +62,9 @@ module Bandwidth
|
|
62
62
|
# @return [DateTime]
|
63
63
|
attr_accessor :start_time
|
64
64
|
|
65
|
+
# @return [DateTime]
|
66
|
+
attr_accessor :enqueued_time
|
67
|
+
|
65
68
|
# The current state of the call. Current possible values are 'initiated',
|
66
69
|
# 'answered' and 'disconnected'. Additional states may be added in the
|
67
70
|
# future, so your application must be tolerant of unknown values.
|
@@ -124,6 +127,7 @@ module Bandwidth
|
|
124
127
|
@_hash['identity'] = 'identity'
|
125
128
|
@_hash['stir_shaken'] = 'stirShaken'
|
126
129
|
@_hash['start_time'] = 'startTime'
|
130
|
+
@_hash['enqueued_time'] = 'enqueuedTime'
|
127
131
|
@_hash['answer_time'] = 'answerTime'
|
128
132
|
@_hash['end_time'] = 'endTime'
|
129
133
|
@_hash['disconnect_cause'] = 'disconnectCause'
|
@@ -147,6 +151,7 @@ module Bandwidth
|
|
147
151
|
identity
|
148
152
|
stir_shaken
|
149
153
|
start_time
|
154
|
+
enqueued_time
|
150
155
|
answer_time
|
151
156
|
end_time
|
152
157
|
disconnect_cause
|
@@ -180,6 +185,7 @@ module Bandwidth
|
|
180
185
|
identity = nil,
|
181
186
|
stir_shaken = nil,
|
182
187
|
start_time = nil,
|
188
|
+
enqueued_time = nil,
|
183
189
|
answer_time = nil,
|
184
190
|
end_time = nil,
|
185
191
|
disconnect_cause = nil,
|
@@ -197,6 +203,7 @@ module Bandwidth
|
|
197
203
|
@identity = identity unless identity == SKIP
|
198
204
|
@stir_shaken = stir_shaken unless stir_shaken == SKIP
|
199
205
|
@start_time = start_time unless start_time == SKIP
|
206
|
+
@enqueued_time = enqueued_time unless enqueued_time == SKIP
|
200
207
|
@answer_time = answer_time unless answer_time == SKIP
|
201
208
|
@end_time = end_time unless end_time == SKIP
|
202
209
|
@disconnect_cause = disconnect_cause unless disconnect_cause == SKIP
|
@@ -221,17 +228,22 @@ module Bandwidth
|
|
221
228
|
identity = hash.key?('identity') ? hash['identity'] : SKIP
|
222
229
|
stir_shaken = hash.key?('stirShaken') ? hash['stirShaken'] : SKIP
|
223
230
|
start_time = if hash.key?('startTime')
|
224
|
-
|
231
|
+
(DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
|
225
232
|
else
|
226
233
|
SKIP
|
227
234
|
end
|
235
|
+
enqueued_time = if hash.key?('enqueuedTime')
|
236
|
+
(DateTimeHelper.from_rfc3339(hash['enqueuedTime']) if hash['enqueuedTime'])
|
237
|
+
else
|
238
|
+
SKIP
|
239
|
+
end
|
228
240
|
answer_time = if hash.key?('answerTime')
|
229
241
|
(DateTimeHelper.from_rfc3339(hash['answerTime']) if hash['answerTime'])
|
230
242
|
else
|
231
243
|
SKIP
|
232
244
|
end
|
233
245
|
end_time = if hash.key?('endTime')
|
234
|
-
|
246
|
+
(DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'])
|
235
247
|
else
|
236
248
|
SKIP
|
237
249
|
end
|
@@ -257,6 +269,7 @@ module Bandwidth
|
|
257
269
|
identity,
|
258
270
|
stir_shaken,
|
259
271
|
start_time,
|
272
|
+
enqueued_time,
|
260
273
|
answer_time,
|
261
274
|
end_time,
|
262
275
|
disconnect_cause,
|
@@ -269,6 +282,10 @@ module Bandwidth
|
|
269
282
|
DateTimeHelper.to_rfc3339(start_time)
|
270
283
|
end
|
271
284
|
|
285
|
+
def to_enqueued_time
|
286
|
+
DateTimeHelper.to_rfc3339(enqueued_time)
|
287
|
+
end
|
288
|
+
|
272
289
|
def to_answer_time
|
273
290
|
DateTimeHelper.to_rfc3339(answer_time)
|
274
291
|
end
|
@@ -32,7 +32,7 @@ module Bandwidth
|
|
32
32
|
|
33
33
|
# TODO: Write general description for this method
|
34
34
|
# @return [DateTime]
|
35
|
-
attr_accessor :
|
35
|
+
attr_accessor :enqueued_time
|
36
36
|
|
37
37
|
# TODO: Write general description for this method
|
38
38
|
# @return [String]
|
@@ -101,7 +101,7 @@ module Bandwidth
|
|
101
101
|
@_hash['application_id'] = 'applicationId'
|
102
102
|
@_hash['to'] = 'to'
|
103
103
|
@_hash['from'] = 'from'
|
104
|
-
@_hash['
|
104
|
+
@_hash['enqueued_time'] = 'enqueuedTime '
|
105
105
|
@_hash['call_url'] = 'callUrl'
|
106
106
|
@_hash['call_timeout'] = 'callTimeout'
|
107
107
|
@_hash['callback_timeout'] = 'callbackTimeout'
|
@@ -123,7 +123,7 @@ module Bandwidth
|
|
123
123
|
# An array for optional fields
|
124
124
|
def optionals
|
125
125
|
%w[
|
126
|
-
|
126
|
+
enqueued_time
|
127
127
|
call_timeout
|
128
128
|
callback_timeout
|
129
129
|
answer_fallback_url
|
@@ -163,7 +163,7 @@ module Bandwidth
|
|
163
163
|
answer_url = nil,
|
164
164
|
answer_method = nil,
|
165
165
|
disconnect_method = nil,
|
166
|
-
|
166
|
+
enqueued_time = nil,
|
167
167
|
call_timeout = nil,
|
168
168
|
callback_timeout = nil,
|
169
169
|
answer_fallback_url = nil,
|
@@ -180,7 +180,7 @@ module Bandwidth
|
|
180
180
|
@application_id = application_id unless application_id == SKIP
|
181
181
|
@to = to unless to == SKIP
|
182
182
|
@from = from unless from == SKIP
|
183
|
-
@
|
183
|
+
@enqueued_time = enqueued_time unless enqueued_time == SKIP
|
184
184
|
@call_url = call_url unless call_url == SKIP
|
185
185
|
@call_timeout = call_timeout unless call_timeout == SKIP
|
186
186
|
@callback_timeout = callback_timeout unless callback_timeout == SKIP
|
@@ -213,8 +213,8 @@ module Bandwidth
|
|
213
213
|
answer_method = hash.key?('answerMethod') ? hash['answerMethod'] : SKIP
|
214
214
|
disconnect_method =
|
215
215
|
hash.key?('disconnectMethod') ? hash['disconnectMethod'] : SKIP
|
216
|
-
|
217
|
-
(DateTimeHelper.from_rfc3339(hash['
|
216
|
+
enqueued_time = if hash.key?('enqueuedTime')
|
217
|
+
(DateTimeHelper.from_rfc3339(hash['enqueuedTime']) if hash['enqueuedTime'])
|
218
218
|
else
|
219
219
|
SKIP
|
220
220
|
end
|
@@ -245,7 +245,7 @@ module Bandwidth
|
|
245
245
|
answer_url,
|
246
246
|
answer_method,
|
247
247
|
disconnect_method,
|
248
|
-
|
248
|
+
enqueued_time,
|
249
249
|
call_timeout,
|
250
250
|
callback_timeout,
|
251
251
|
answer_fallback_url,
|
@@ -259,8 +259,8 @@ module Bandwidth
|
|
259
259
|
priority)
|
260
260
|
end
|
261
261
|
|
262
|
-
def
|
263
|
-
DateTimeHelper.to_rfc3339(
|
262
|
+
def to_enqueued_time
|
263
|
+
DateTimeHelper.to_rfc3339(enqueued_time)
|
264
264
|
end
|
265
265
|
end
|
266
266
|
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
|
@@ -111,11 +111,15 @@ class IntegrationTest < Test::Unit::TestCase
|
|
111
111
|
body.answer_url = BASE_CALLBACK_URL
|
112
112
|
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
|
113
113
|
assert(response.data.call_id.length > 0, "call_id value not set")
|
114
|
+
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
115
|
+
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
114
116
|
|
115
117
|
#Get phone call information
|
116
118
|
sleep 1
|
117
119
|
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
118
120
|
assert(response.data.state.length > 0, "state value not set")
|
121
|
+
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
122
|
+
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
119
123
|
end
|
120
124
|
|
121
125
|
def test_create_call_with_amd_and_get_call_state
|
@@ -684,4 +688,34 @@ class IntegrationTest < Test::Unit::TestCase
|
|
684
688
|
actual = Bandwidth::WebRtc.generate_transfer_bxml_verb('asdf', 'c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4')
|
685
689
|
assert_equal(expected, actual)
|
686
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"/></Response>'
|
694
|
+
response = Bandwidth::Voice::Response.new()
|
695
|
+
start_stream = Bandwidth::Voice::StartStream.new({
|
696
|
+
:destination => "https://www.test.com/stream",
|
697
|
+
:name => "test_stream",
|
698
|
+
:tracks => "inbound",
|
699
|
+
:streamEventUrl => "https://www.test.com/event",
|
700
|
+
:streamEventMethod => "POST",
|
701
|
+
:username => "username",
|
702
|
+
:password => "password"
|
703
|
+
})
|
704
|
+
response.push(start_stream)
|
705
|
+
actual = response.to_bxml()
|
706
|
+
|
707
|
+
assert_equal(expected, actual)
|
708
|
+
end
|
709
|
+
|
710
|
+
def test_stop_stream_bxml_verb
|
711
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><StopStream name="test_stream"/></Response>'
|
712
|
+
response = Bandwidth::Voice::Response.new()
|
713
|
+
stop_stream = Bandwidth::Voice::StopStream.new({
|
714
|
+
:name => "test_stream"
|
715
|
+
})
|
716
|
+
response.push(stop_stream)
|
717
|
+
actual = response.to_bxml()
|
718
|
+
|
719
|
+
assert_equal(expected, actual)
|
720
|
+
end
|
687
721
|
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:
|
4
|
+
version: 10.1.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-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -28,24 +28,66 @@ dependencies:
|
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3.0'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
33
43
|
version: '1.0'
|
34
|
-
- - "
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: faraday-follow_redirects
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.3'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.3'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: faraday-gzip
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
35
66
|
- !ruby/object:Gem::Version
|
36
|
-
version: 1.
|
67
|
+
version: 0.1.0
|
37
68
|
type: :runtime
|
38
69
|
prerelease: false
|
39
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.1.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: faraday-multipart
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
40
78
|
requirements:
|
41
79
|
- - "~>"
|
42
80
|
- !ruby/object:Gem::Version
|
43
81
|
version: '1.0'
|
44
|
-
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
45
87
|
- !ruby/object:Gem::Version
|
46
|
-
version: 1.
|
88
|
+
version: '1.0'
|
47
89
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
90
|
+
name: faraday-retry
|
49
91
|
requirement: !ruby/object:Gem::Requirement
|
50
92
|
requirements:
|
51
93
|
- - "~>"
|
@@ -140,6 +182,20 @@ dependencies:
|
|
140
182
|
- - "~>"
|
141
183
|
- !ruby/object:Gem::Version
|
142
184
|
version: '1.0'
|
185
|
+
- !ruby/object:Gem::Dependency
|
186
|
+
name: test-unit
|
187
|
+
requirement: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
type: :development
|
193
|
+
prerelease: false
|
194
|
+
version_requirements: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
143
199
|
description: The official client SDK for Bandwidht's Voice, Messaging, MFA, and WebRTC
|
144
200
|
APIs
|
145
201
|
email: dx@bandwidth.com
|
@@ -225,8 +281,10 @@ files:
|
|
225
281
|
- lib/bandwidth/voice_lib/bxml/verbs/speak_sentence.rb
|
226
282
|
- lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb
|
227
283
|
- lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb
|
284
|
+
- lib/bandwidth/voice_lib/bxml/verbs/start_stream.rb
|
228
285
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb
|
229
286
|
- lib/bandwidth/voice_lib/bxml/verbs/stop_recording.rb
|
287
|
+
- lib/bandwidth/voice_lib/bxml/verbs/stop_stream.rb
|
230
288
|
- lib/bandwidth/voice_lib/bxml/verbs/tag.rb
|
231
289
|
- lib/bandwidth/voice_lib/bxml/verbs/transfer.rb
|
232
290
|
- lib/bandwidth/voice_lib/bxml/verbs/xml_verb.rb
|