vonage 7.6.0 → 7.7.2
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 +4 -4
- data/lib/vonage/json.rb +1 -1
- data/lib/vonage/logger.rb +1 -1
- data/lib/vonage/namespace.rb +2 -2
- data/lib/vonage/numbers.rb +27 -3
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/voice.rb +17 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d7253aa212d9f85a8dc7e53da784d9277d5c1ef56b554b558967d19e2358a6a
|
4
|
+
data.tar.gz: 3c7882f459e88fcc1576c9c93e86908db09d405995f3d4908f5ba299c2558257
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97ccb9cbc712896509d5910074592c3a545049e94c4168b5b2a997f5ffcc760054e2ca9b3ef05c33a19e530fe1aec59694b5e741042076e7c6a3f1de51788b9
|
7
|
+
data.tar.gz: c93e485c0410b15454c2c984d323f087efd2f3d28d768ba7e5e1e51aee89fefe3eaa635aaeea72a8acd9e90cf4fe2d207ecdf2a7ffa396b9345b20c580a6804c
|
data/lib/vonage/json.rb
CHANGED
@@ -6,7 +6,7 @@ module Vonage
|
|
6
6
|
module JSON
|
7
7
|
extend T::Sig
|
8
8
|
|
9
|
-
sig { params(http_request: T.any(Net::HTTP::Put, Net::HTTP::Post, Net::HTTP::Get), params: T::Hash[Symbol, T.untyped]).void }
|
9
|
+
sig { params(http_request: T.any(Net::HTTP::Patch, Net::HTTP::Put, Net::HTTP::Post, Net::HTTP::Get), params: T::Hash[Symbol, T.untyped]).void }
|
10
10
|
def self.update(http_request, params)
|
11
11
|
http_request['Content-Type'] = 'application/json'
|
12
12
|
http_request.body = ::JSON.generate(params)
|
data/lib/vonage/logger.rb
CHANGED
@@ -18,7 +18,7 @@ module Vonage
|
|
18
18
|
def_delegator :@logger, name, name
|
19
19
|
end
|
20
20
|
|
21
|
-
sig { params(request: T.any(Net::HTTP::Post, Net::HTTP::Get, Net::HTTP::Delete, Net::HTTP::Put)).void }
|
21
|
+
sig { params(request: T.any(Net::HTTP::Post, Net::HTTP::Get, Net::HTTP::Delete, Net::HTTP::Put, Net::HTTP::Patch)).void }
|
22
22
|
def log_request_info(request)
|
23
23
|
@logger = T.let(@logger, T.nilable(T.any(::Logger, Vonage::Logger)))
|
24
24
|
|
data/lib/vonage/namespace.rb
CHANGED
@@ -109,7 +109,7 @@ module Vonage
|
|
109
109
|
response = make_request!(request, &block)
|
110
110
|
|
111
111
|
if auto_advance
|
112
|
-
iterable_request(path, response: response, response_class: response_class, &block)
|
112
|
+
iterable_request(path, response: response, response_class: response_class, params: params, &block)
|
113
113
|
else
|
114
114
|
return if block
|
115
115
|
|
@@ -117,7 +117,7 @@ module Vonage
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
def iterable_request(path, response: nil, response_class: nil, &block)
|
120
|
+
def iterable_request(path, response: nil, response_class: nil, params: {}, &block)
|
121
121
|
json_response = ::JSON.parse(response.body)
|
122
122
|
response = parse(response, response_class)
|
123
123
|
remainder = remaining_count(json_response)
|
data/lib/vonage/numbers.rb
CHANGED
@@ -40,11 +40,11 @@ module Vonage
|
|
40
40
|
#
|
41
41
|
# @option params [Integer] :index
|
42
42
|
# Page index.
|
43
|
-
#
|
43
|
+
#
|
44
44
|
# @option params [Boolean] :auto_advance
|
45
45
|
# Set this to `true` to auto-advance through all the pages in the record
|
46
46
|
# and collect all the data. The default is `false`.
|
47
|
-
#
|
47
|
+
#
|
48
48
|
# @param [Hash] params
|
49
49
|
#
|
50
50
|
# @return [ListResponse]
|
@@ -92,7 +92,7 @@ module Vonage
|
|
92
92
|
# @option params [Boolean] :auto_advance
|
93
93
|
# Set this to `true` to auto-advance through all the pages in the record
|
94
94
|
# and collect all the data. The default is `false`.
|
95
|
-
#
|
95
|
+
#
|
96
96
|
# @param [Hash] params
|
97
97
|
#
|
98
98
|
# @return [ListResponse]
|
@@ -200,5 +200,29 @@ module Vonage
|
|
200
200
|
def update(params)
|
201
201
|
request('/number/update', params: camelcase(params), type: Post, response_class: Response)
|
202
202
|
end
|
203
|
+
|
204
|
+
private
|
205
|
+
|
206
|
+
# A specific implementation of iterable_request for Numbers, because the Numbers API
|
207
|
+
# handles pagination differently to other Vonage APIs
|
208
|
+
def iterable_request(path, response: nil, response_class: nil, params: {}, &block)
|
209
|
+
response = parse(response, response_class)
|
210
|
+
params[:index] = 1 unless params.has_key?(:index)
|
211
|
+
size = params.fetch(:size, 10)
|
212
|
+
count_from_index = response[:count] - ((params[:index] - 1) * size)
|
213
|
+
|
214
|
+
while count_from_index > response.numbers.size
|
215
|
+
params[:index] += 1
|
216
|
+
request = build_request(path: path, type: Get, params: params)
|
217
|
+
|
218
|
+
# Make request...
|
219
|
+
paginated_response = make_request!(request)
|
220
|
+
next_response = parse(paginated_response, response_class)
|
221
|
+
|
222
|
+
response.numbers.push(*next_response.numbers)
|
223
|
+
end
|
224
|
+
|
225
|
+
response
|
226
|
+
end
|
203
227
|
end
|
204
228
|
end
|
data/lib/vonage/version.rb
CHANGED
data/lib/vonage/voice.rb
CHANGED
@@ -19,8 +19,14 @@ module Vonage
|
|
19
19
|
# @option params [required, Array<Hash>] :to
|
20
20
|
# Connect to a Phone (PSTN) number, SIP Endpoint, Websocket, or VBC extension.
|
21
21
|
#
|
22
|
-
# @option params [
|
23
|
-
# Connect to a Phone (PSTN) number.
|
22
|
+
# @option params [Hash] :from
|
23
|
+
# Connect to a Phone (PSTN) number. Should not be set if **:random_from_number** is **true**
|
24
|
+
# If not set, then **:random_from_number** will automatically be set to **true**
|
25
|
+
#
|
26
|
+
# @option params [Boolean] :random_from_number
|
27
|
+
# Set to **true** to use random phone number as **from**. The number will be selected from the list
|
28
|
+
# of the numbers assigned to the current application.
|
29
|
+
# **random_from_number: true** cannot be used together with **:from**.
|
24
30
|
#
|
25
31
|
# @option params [Array<String>] :ncco
|
26
32
|
# The Vonage Call Control Object to use for this call.
|
@@ -55,6 +61,14 @@ module Vonage
|
|
55
61
|
# @see https://developer.nexmo.com/api/voice#createCall
|
56
62
|
#
|
57
63
|
def create(params)
|
64
|
+
if params.key?(:from) && params[:random_from_number] == true
|
65
|
+
raise ClientError.new("`from` should not be set if `random_from_number` is `true`")
|
66
|
+
end
|
67
|
+
|
68
|
+
if params && !params.key?(:from)
|
69
|
+
params.merge!(random_from_number: true)
|
70
|
+
end
|
71
|
+
|
58
72
|
request('/v1/calls', params: params, type: Post)
|
59
73
|
end
|
60
74
|
|
@@ -101,7 +115,7 @@ module Vonage
|
|
101
115
|
if params && !params.key?(:auto_advance)
|
102
116
|
params.merge!(auto_advance: true)
|
103
117
|
end
|
104
|
-
|
118
|
+
|
105
119
|
request('/v1/calls', params: params, response_class: ListResponse)
|
106
120
|
end
|
107
121
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vonage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vonage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nexmo-jwt
|