vonage 7.7.1 → 7.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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
- 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/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
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.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-07-
|
11
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nexmo-jwt
|