vonage 7.4.1 → 7.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vonage/number_insight.rb +4 -4
- data/lib/vonage/service_error.rb +16 -0
- data/lib/vonage/sms.rb +1 -1
- data/lib/vonage/verify.rb +6 -6
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/voice/ncco.rb +6 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62613660a4bd7e71b9a11ef299c20bd28296bc5f757ae82db513f667db0b687
|
4
|
+
data.tar.gz: 0db9c1d1b20dfff9936d7dd5ec495e7074242556f69461b57c5ef69bd244314b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d49ed457a469c6caf6599b2f712fd035f3cde34daf350ae1ae4c18d510c94a01cf2e23902686c2429cfad066215ea94ef02d846c8ac001fd29a6d52c994867
|
7
|
+
data.tar.gz: cb3acb8a05f3e3c4ef773a6fca17731ef58929bda0277bbd54e7bc34c8c0983fbcca73e3efd3ddf68a12d62f9c6743efc3474b40d15e13a83bbdd38025ad730b
|
@@ -25,7 +25,7 @@ module Vonage
|
|
25
25
|
def basic(params)
|
26
26
|
response = request('/ni/basic/json', params: params)
|
27
27
|
|
28
|
-
raise
|
28
|
+
raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?
|
29
29
|
|
30
30
|
response
|
31
31
|
end
|
@@ -57,7 +57,7 @@ module Vonage
|
|
57
57
|
def standard(params)
|
58
58
|
response = request('/ni/standard/json', params: params)
|
59
59
|
|
60
|
-
raise
|
60
|
+
raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?
|
61
61
|
|
62
62
|
response
|
63
63
|
end
|
@@ -93,7 +93,7 @@ module Vonage
|
|
93
93
|
def advanced(params)
|
94
94
|
response = request('/ni/advanced/json', params: params)
|
95
95
|
|
96
|
-
raise
|
96
|
+
raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?
|
97
97
|
|
98
98
|
response
|
99
99
|
end
|
@@ -132,7 +132,7 @@ module Vonage
|
|
132
132
|
def advanced_async(params)
|
133
133
|
response = request('/ni/advanced/async/json', params: params)
|
134
134
|
|
135
|
-
raise
|
135
|
+
raise ServiceError.new(response: response), response[:status_message] unless response.status.zero?
|
136
136
|
|
137
137
|
response
|
138
138
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Vonage
|
4
|
+
class ServiceError < Error
|
5
|
+
extend T::Sig
|
6
|
+
|
7
|
+
sig { returns(Vonage::Response) }
|
8
|
+
attr_reader :response
|
9
|
+
|
10
|
+
sig { params(message: T.nilable(String), response: Vonage::Response).void }
|
11
|
+
def initialize(message = nil, response:)
|
12
|
+
super(message)
|
13
|
+
@response = response
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/vonage/sms.rb
CHANGED
@@ -105,7 +105,7 @@ module Vonage
|
|
105
105
|
response = request('/sms/json', params: hyphenate(params), type: Post)
|
106
106
|
|
107
107
|
unless response.messages.first.status == '0'
|
108
|
-
raise
|
108
|
+
raise ServiceError.new(response: response), response.messages.first[:error_text]
|
109
109
|
end
|
110
110
|
|
111
111
|
response
|
data/lib/vonage/verify.rb
CHANGED
@@ -64,7 +64,7 @@ module Vonage
|
|
64
64
|
def request(params, uri = '/verify/json')
|
65
65
|
response = http_request(uri, params: params, type: Post)
|
66
66
|
|
67
|
-
raise
|
67
|
+
raise ServiceError.new(response: response), response[:error_text] if error?(response)
|
68
68
|
|
69
69
|
response
|
70
70
|
end
|
@@ -97,7 +97,7 @@ module Vonage
|
|
97
97
|
def check(params)
|
98
98
|
response = http_request('/verify/check/json', params: params, type: Post)
|
99
99
|
|
100
|
-
raise
|
100
|
+
raise ServiceError.new(response: response), response[:error_text] if error?(response)
|
101
101
|
|
102
102
|
response
|
103
103
|
end
|
@@ -124,7 +124,7 @@ module Vonage
|
|
124
124
|
def search(params)
|
125
125
|
response = http_request('/verify/search/json', params: params)
|
126
126
|
|
127
|
-
raise
|
127
|
+
raise ServiceError.new(response: response), response[:error_text] if error?(response)
|
128
128
|
|
129
129
|
response
|
130
130
|
end
|
@@ -151,7 +151,7 @@ module Vonage
|
|
151
151
|
def control(params)
|
152
152
|
response = http_request('/verify/control/json', params: params, type: Post)
|
153
153
|
|
154
|
-
raise
|
154
|
+
raise ServiceError.new(response: response), response[:error_text] if error?(response)
|
155
155
|
|
156
156
|
response
|
157
157
|
end
|
@@ -234,11 +234,11 @@ module Vonage
|
|
234
234
|
#
|
235
235
|
# @see https://developer.nexmo.com/api/verify#verifyRequestWithPSD2
|
236
236
|
#
|
237
|
-
sig { params(params: T.untyped, uri: T.untyped).returns(T.any(Vonage::
|
237
|
+
sig { params(params: T.untyped, uri: T.untyped).returns(T.any(Vonage::ServiceError, Vonage::Response)) }
|
238
238
|
def psd2(params, uri = '/verify/psd2/json')
|
239
239
|
response = http_request(uri, params: params, type: Post)
|
240
240
|
|
241
|
-
raise
|
241
|
+
raise ServiceError.new(response: response), response[:error_text] if error?(response)
|
242
242
|
|
243
243
|
response
|
244
244
|
end
|
data/lib/vonage/version.rb
CHANGED
data/lib/vonage/voice/ncco.rb
CHANGED
@@ -13,9 +13,11 @@ module Vonage
|
|
13
13
|
talk: Vonage::Voice::Actions::Talk
|
14
14
|
}
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
class << self
|
17
|
+
ACTIONS.keys.each do |method|
|
18
|
+
define_method method do |attributes|
|
19
|
+
ACTIONS[method].new(**attributes).action
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -39,4 +41,4 @@ module Vonage
|
|
39
41
|
actions.flatten!
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
44
|
+
end
|
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.5.0
|
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-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nexmo-jwt
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/vonage/secrets.rb
|
140
140
|
- lib/vonage/secrets/list_response.rb
|
141
141
|
- lib/vonage/server_error.rb
|
142
|
+
- lib/vonage/service_error.rb
|
142
143
|
- lib/vonage/signature.rb
|
143
144
|
- lib/vonage/sms.rb
|
144
145
|
- lib/vonage/tfa.rb
|