bandwidth-sdk 10.2.0 → 10.4.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 +2 -2
- data/lib/bandwidth/http/faraday_client.rb +0 -3
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +12 -2
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +13 -2
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +1 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +1 -0
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +12 -0
- data/lib/bandwidth.rb +0 -1
- data/test/integration/test_integration.rb +11 -2
- data/test/test_helper.rb +2 -2
- metadata +3 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f011b72b189da15e3b1b43201601250454cbd2c348c9b13629c0f4b8eb02838
|
4
|
+
data.tar.gz: dc058e532b3e089f6591bd41d6b2984cd2ef2ba1d44f61c609e9253c918192cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c76196ab9c8c40578883f4963b2f7b6cd368b63a8304380344f8820deae79569c13a262da25e06ba2cc3f0cf8cfa81f11b6a35080dd829ba978f07b22d6884d5
|
7
|
+
data.tar.gz: 2ee584741d90c28ea2b465dffcccdbed815f7a2b38b8517bcb123ccd5378bbee227a901dff9679449572f5e45ecbda36f47252a10bdb1209697a77101a52f838
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# Bandwidth Ruby SDK
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Nightly Tests](https://github.com/Bandwidth/ruby-sdk/actions/workflows/test-nightly.yml/badge.svg)](https://github.com/Bandwidth/ruby-sdk/actions/workflows/test-nightly.yml)
|
4
4
|
|
5
5
|
|
6
6
|
| **OS** | **Ruby** |
|
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
|
@@ -19,6 +19,7 @@ module Bandwidth
|
|
19
19
|
'maxDuration' => max_duration,
|
20
20
|
'fileFormat' => file_format,
|
21
21
|
'transcribe' => transcribe,
|
22
|
+
'detectLanguage' => detect_language,
|
22
23
|
'transcriptionAvailableUrl' => transcription_available_url,
|
23
24
|
'transcriptionAvailableMethod' => transcription_available_method,
|
24
25
|
'silenceTimeout' => silence_timeout,
|
@@ -16,6 +16,7 @@ module Bandwidth
|
|
16
16
|
'fileFormat' => file_format,
|
17
17
|
'multiChannel' => multi_channel,
|
18
18
|
'transcribe' => transcribe,
|
19
|
+
'detectLanguage' => detect_language,
|
19
20
|
'transcriptionAvailableUrl' => transcription_available_url,
|
20
21
|
'transcriptionAvailableMethod' => transcription_available_method
|
21
22
|
}))
|
@@ -33,6 +33,10 @@ module Bandwidth
|
|
33
33
|
# @return [Float]
|
34
34
|
attr_accessor :callback_timeout
|
35
35
|
|
36
|
+
# TODO: Write general description for this method
|
37
|
+
# @return [Boolean]
|
38
|
+
attr_accessor :detect_language
|
39
|
+
|
36
40
|
# A mapping from model property names to API property names.
|
37
41
|
def self.names
|
38
42
|
@_hash = {} if @_hash.nil?
|
@@ -42,6 +46,7 @@ module Bandwidth
|
|
42
46
|
@_hash['password'] = 'password'
|
43
47
|
@_hash['tag'] = 'tag'
|
44
48
|
@_hash['callback_timeout'] = 'callbackTimeout'
|
49
|
+
@_hash['detect_language'] = 'detectLanguage'
|
45
50
|
@_hash
|
46
51
|
end
|
47
52
|
|
@@ -54,6 +59,7 @@ module Bandwidth
|
|
54
59
|
password
|
55
60
|
tag
|
56
61
|
callback_timeout
|
62
|
+
detect_language
|
57
63
|
]
|
58
64
|
end
|
59
65
|
|
@@ -65,6 +71,7 @@ module Bandwidth
|
|
65
71
|
password
|
66
72
|
tag
|
67
73
|
callback_timeout
|
74
|
+
detect_language
|
68
75
|
]
|
69
76
|
end
|
70
77
|
|
@@ -73,6 +80,7 @@ module Bandwidth
|
|
73
80
|
username = nil,
|
74
81
|
password = nil,
|
75
82
|
tag = nil,
|
83
|
+
detect_language = nil,
|
76
84
|
callback_timeout = nil)
|
77
85
|
@callback_url = callback_url unless callback_url == SKIP
|
78
86
|
@callback_method = callback_method unless callback_method == SKIP
|
@@ -80,6 +88,7 @@ module Bandwidth
|
|
80
88
|
@password = password unless password == SKIP
|
81
89
|
@tag = tag unless tag == SKIP
|
82
90
|
@callback_timeout = callback_timeout unless callback_timeout == SKIP
|
91
|
+
@detect_language = detect_language unless detect_language == SKIP
|
83
92
|
end
|
84
93
|
|
85
94
|
# Creates an instance of the object from a hash.
|
@@ -95,6 +104,8 @@ module Bandwidth
|
|
95
104
|
tag = hash.key?('tag') ? hash['tag'] : SKIP
|
96
105
|
callback_timeout =
|
97
106
|
hash.key?('callbackTimeout') ? hash['callbackTimeout'] : SKIP
|
107
|
+
detect_language =
|
108
|
+
hash.key?('detectLanguage') ? hash['detectLanguage'] : SKIP
|
98
109
|
|
99
110
|
# Create object from extracted values.
|
100
111
|
TranscribeRecordingRequest.new(callback_url,
|
@@ -102,6 +113,7 @@ module Bandwidth
|
|
102
113
|
username,
|
103
114
|
password,
|
104
115
|
tag,
|
116
|
+
detect_language,
|
105
117
|
callback_timeout)
|
106
118
|
end
|
107
119
|
end
|
data/lib/bandwidth.rb
CHANGED
@@ -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
|
|
@@ -115,7 +122,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
115
122
|
assert(response.data.enqueued_time.is_a?(DateTime), "enqueued time is not a DateTime object")
|
116
123
|
|
117
124
|
#Get phone call information
|
118
|
-
sleep
|
125
|
+
sleep(15)
|
119
126
|
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
120
127
|
assert(response.data.state.length > 0, "state value not set")
|
121
128
|
assert_not_nil(response.data.enqueued_time, "enqueued time is nil")
|
@@ -144,6 +151,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
144
151
|
assert(response.data.call_id.length > 0, "call_id value not set")
|
145
152
|
|
146
153
|
#Get phone call information
|
154
|
+
sleep(15)
|
147
155
|
response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
|
148
156
|
assert(response.data.state.length > 0, "state value not set")
|
149
157
|
end
|
@@ -347,6 +355,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
347
355
|
:recording_available_url => "https://available.com",
|
348
356
|
:recording_available_method => "GET",
|
349
357
|
:transcribe => false,
|
358
|
+
:detect_language=> true,
|
350
359
|
:transcription_available_url => "https://transcribe.com",
|
351
360
|
:transcription_available_method => "POST",
|
352
361
|
:username => "user",
|
@@ -364,7 +373,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
364
373
|
|
365
374
|
response = Bandwidth::Voice::Response.new()
|
366
375
|
response.push(record)
|
367
|
-
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Record tag="tag" username="user" password="pass" recordCompleteUrl="https://complete.com" recordCompleteMethod="POST" recordingAvailableUrl="https://available.com" recordingAvailableMethod="GET" terminatingDigits="#" maxDuration="3" fileFormat="wav" transcribe="false" transcriptionAvailableUrl="https://transcribe.com" transcriptionAvailableMethod="POST" silenceTimeout="5" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
|
376
|
+
expected = '<?xml version="1.0" encoding="UTF-8"?><Response><Record tag="tag" username="user" password="pass" recordCompleteUrl="https://complete.com" recordCompleteMethod="POST" recordingAvailableUrl="https://available.com" recordingAvailableMethod="GET" terminatingDigits="#" maxDuration="3" fileFormat="wav" transcribe="false" detectLanguage="true" transcriptionAvailableUrl="https://transcribe.com" transcriptionAvailableMethod="POST" silenceTimeout="5" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
|
368
377
|
actual = response.to_bxml()
|
369
378
|
assert_equal(expected, actual)
|
370
379
|
end
|
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
|
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.
|
4
|
+
version: 10.4.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: 2023-05-23 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
|
@@ -363,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
363
329
|
- !ruby/object:Gem::Version
|
364
330
|
version: '0'
|
365
331
|
requirements: []
|
366
|
-
rubygems_version: 3.
|
332
|
+
rubygems_version: 3.4.10
|
367
333
|
signing_key:
|
368
334
|
specification_version: 4
|
369
335
|
summary: Bandwidth
|