vonage 7.25.0 → 7.27.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 +12 -13
- data/lib/vonage/basic.rb +1 -1
- data/lib/vonage/bearer_token.rb +1 -1
- data/lib/vonage/client.rb +14 -0
- data/lib/vonage/key_secret_params.rb +3 -2
- data/lib/vonage/keys.rb +4 -1
- data/lib/vonage/meetings/applications.rb +3 -0
- data/lib/vonage/meetings/dial_in_numbers.rb +3 -0
- data/lib/vonage/meetings/recordings.rb +6 -0
- data/lib/vonage/meetings/rooms.rb +12 -0
- data/lib/vonage/meetings/sessions.rb +3 -0
- data/lib/vonage/meetings/themes.rb +21 -0
- data/lib/vonage/meetings.rb +12 -0
- data/lib/vonage/messaging/channels/rcs.rb +42 -0
- data/lib/vonage/messaging/message.rb +1 -0
- data/lib/vonage/messaging.rb +15 -1
- data/lib/vonage/namespace.rb +9 -12
- data/lib/vonage/network_authentication/client_authentication.rb +39 -0
- data/lib/vonage/network_authentication/server_authentication.rb +47 -0
- data/lib/vonage/network_authentication.rb +22 -0
- data/lib/vonage/network_number_verification.rb +92 -0
- data/lib/vonage/network_sim_swap.rb +84 -0
- data/lib/vonage/numbers.rb +11 -11
- data/lib/vonage/proactive_connect/events.rb +3 -0
- data/lib/vonage/proactive_connect/item.rb +12 -0
- data/lib/vonage/proactive_connect/items.rb +9 -0
- data/lib/vonage/proactive_connect/list.rb +18 -0
- data/lib/vonage/proactive_connect/lists.rb +3 -0
- data/lib/vonage/proactive_connect.rb +10 -0
- data/lib/vonage/verify2/start_verification_options.rb +2 -1
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/voice/actions/connect.rb +7 -2
- data/lib/vonage/voice/actions/conversation.rb +8 -2
- data/lib/vonage/voice/actions/input.rb +19 -3
- data/lib/vonage/voice/actions/notify.rb +8 -3
- data/lib/vonage/voice/actions/record.rb +52 -4
- data/lib/vonage/voice/actions/stream.rb +48 -4
- data/lib/vonage/voice/actions/talk.rb +45 -4
- data/lib/vonage/voice.rb +2 -0
- data/lib/vonage.rb +2 -0
- metadata +8 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class NetworkAuthentication::ServerAuthentication < Namespace
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
self.authentication = BearerToken
|
9
|
+
|
10
|
+
self.host = :vonage_host
|
11
|
+
|
12
|
+
self.request_headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
13
|
+
|
14
|
+
def token(purpose:, api_scope:, login_hint:, **params)
|
15
|
+
auth_req_id = bc_authorize(
|
16
|
+
purpose: purpose,
|
17
|
+
api_scope: api_scope,
|
18
|
+
login_hint: login_hint
|
19
|
+
).auth_req_id
|
20
|
+
|
21
|
+
request_access_token(auth_req_id: auth_req_id).access_token
|
22
|
+
end
|
23
|
+
|
24
|
+
def bc_authorize(purpose:, api_scope:, login_hint:)
|
25
|
+
scope = "openid dpv:#{purpose}##{api_scope}"
|
26
|
+
request(
|
27
|
+
"/oauth2/bc-authorize",
|
28
|
+
params: {
|
29
|
+
scope: scope,
|
30
|
+
login_hint: login_hint
|
31
|
+
},
|
32
|
+
type: Post
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def request_access_token(auth_req_id:)
|
37
|
+
request(
|
38
|
+
"/oauth2/token",
|
39
|
+
params: {
|
40
|
+
grant_type: 'urn:openid:params:grant-type:ciba',
|
41
|
+
auth_req_id: auth_req_id
|
42
|
+
},
|
43
|
+
type: Post
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class NetworkAuthentication < AbstractAuthentication
|
6
|
+
def update(object, data)
|
7
|
+
return unless object.is_a?(Net::HTTPRequest)
|
8
|
+
|
9
|
+
token = self.public_send(data[:auth_flow]).token(**data)
|
10
|
+
|
11
|
+
object['Authorization'] = 'Bearer ' + token
|
12
|
+
end
|
13
|
+
|
14
|
+
def client_authentication
|
15
|
+
@client_authentication ||= ClientAuthentication.new(@config)
|
16
|
+
end
|
17
|
+
|
18
|
+
def server_authentication
|
19
|
+
@server_authentication ||= ServerAuthentication.new(@config)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require 'phonelib'
|
4
|
+
|
5
|
+
module Vonage
|
6
|
+
class NetworkNumberVerification < Namespace
|
7
|
+
extend T::Sig
|
8
|
+
include Keys
|
9
|
+
|
10
|
+
self.authentication = NetworkAuthentication
|
11
|
+
|
12
|
+
self.host = :vonage_host
|
13
|
+
|
14
|
+
self.request_body = JSON
|
15
|
+
|
16
|
+
# Verifies if the specified phone number (plain text or hashed format) matches the one that the user is currently using.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# response = client.network_number_verification.verify(
|
20
|
+
# phone_number: '+447900000000',
|
21
|
+
# auth_data: {
|
22
|
+
# oidc_auth_code: '0dadaeb4-7c79-4d39-b4b0-5a6cc08bf537',
|
23
|
+
# redirect_uri: 'https://example.com/callback'
|
24
|
+
# }
|
25
|
+
# )
|
26
|
+
#
|
27
|
+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
|
28
|
+
#
|
29
|
+
# @param [required, Hash] :auth_data A hash of authentication data required for the client token request. Must contain the following keys:
|
30
|
+
# @option auth_data [required, String] :oidc_auth_code The OIDC auth code.
|
31
|
+
# @option auth_data [required, String] :redirect_uri The redirect URI.
|
32
|
+
# @see https://developer.vonage.com/en/getting-started-network/authentication#client-authentication-flow
|
33
|
+
#
|
34
|
+
# @return [Response]
|
35
|
+
#
|
36
|
+
# @see https://developer.vonage.com/en/api/camara/number-verification#verifyNumberVerification
|
37
|
+
#
|
38
|
+
sig { params(phone_number: String, auth_data: Hash).returns(Vonage::Response) }
|
39
|
+
def verify(phone_number:, auth_data:)
|
40
|
+
raise ArgumentError.new("`phone_number` must be in E.164 format") unless Phonelib.parse(phone_number).valid?
|
41
|
+
raise ArgumentError.new("`phone_number` must be prepended with a `+`") unless phone_number.start_with?('+')
|
42
|
+
raise ArgumentError.new("`auth_data` must contain key `:oidc_auth_code`") unless auth_data.has_key?(:oidc_auth_code)
|
43
|
+
raise ArgumentError.new("`auth_data[:oidc_auth_code]` must be a String") unless auth_data[:oidc_auth_code].is_a?(String)
|
44
|
+
raise ArgumentError.new("`auth_data` must contain key `:redirect_uri`") unless auth_data.has_key?(:redirect_uri)
|
45
|
+
raise ArgumentError.new("`auth_data[:redirect_uri]` must be a String") unless auth_data[:redirect_uri].is_a?(String)
|
46
|
+
|
47
|
+
params = {phone_number: phone_number}
|
48
|
+
|
49
|
+
request(
|
50
|
+
'/camara/number-verification/v031/verify',
|
51
|
+
params: camelcase(params),
|
52
|
+
type: Post,
|
53
|
+
auth_data: {
|
54
|
+
oidc_auth_code: auth_data[:oidc_auth_code],
|
55
|
+
redirect_uri: auth_data[:redirect_uri],
|
56
|
+
auth_flow: :client_authentication
|
57
|
+
}
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Creates a URL for a client-side OIDC request.
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# response = client.network_number_verification.generate_oidc_uri(
|
65
|
+
# phone_number: '+447900000000',
|
66
|
+
# redirect_uri: 'https://example.com/callback'
|
67
|
+
# )
|
68
|
+
#
|
69
|
+
# @param [required, String] :phone_number The phone number that will be checked during the verification request.
|
70
|
+
#
|
71
|
+
# @param [required, String] :redirect_uri The URI that will receive the callback containing the OIDC auth code.
|
72
|
+
#
|
73
|
+
# @param [required, String] :state A string that you can use for tracking.
|
74
|
+
# Used to set a unique identifier for each access token you generate.
|
75
|
+
#
|
76
|
+
# @return [String]
|
77
|
+
#
|
78
|
+
# @see https://developer.vonage.com/en/getting-started-network/authentication#1-make-an-oidc-request
|
79
|
+
sig { params(phone_number: String, redirect_uri: String, state: String).returns(String) }
|
80
|
+
def generate_oidc_uri(phone_number:, redirect_uri:, state:)
|
81
|
+
params = {
|
82
|
+
purpose: 'FraudPreventionAndDetection',
|
83
|
+
api_scope: 'number-verification-verify-read',
|
84
|
+
login_hint: phone_number,
|
85
|
+
redirect_uri: redirect_uri,
|
86
|
+
state: state
|
87
|
+
}
|
88
|
+
|
89
|
+
Vonage::NetworkAuthentication::ClientAuthentication.new(@config).generate_oidc_uri(**params)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
require 'phonelib'
|
4
|
+
|
5
|
+
module Vonage
|
6
|
+
class NetworkSIMSwap < Namespace
|
7
|
+
extend T::Sig
|
8
|
+
include Keys
|
9
|
+
|
10
|
+
self.authentication = NetworkAuthentication
|
11
|
+
|
12
|
+
self.host = :vonage_host
|
13
|
+
|
14
|
+
self.request_body = JSON
|
15
|
+
|
16
|
+
# Check if SIM swap has been performed during a past period.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# response = client.network_sim_swap.check(phone_number: '+447900000000')
|
20
|
+
#
|
21
|
+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
|
22
|
+
#
|
23
|
+
# @param [optional, Integer] :max_age Period in hours to be checked for SIM swap
|
24
|
+
#
|
25
|
+
# @return [Response]
|
26
|
+
#
|
27
|
+
# @see https://developer.vonage.com/en/api/camara/sim-swap#checkSimSwap
|
28
|
+
#
|
29
|
+
sig { params(phone_number: String, max_age: T.nilable(Integer)).returns(Vonage::Response) }
|
30
|
+
def check(phone_number:, max_age: nil)
|
31
|
+
raise ArgumentError.new("`phone_number` must be in E.164 format") unless Phonelib.parse(phone_number).valid?
|
32
|
+
raise ArgumentError.new("`phone_number` must be prepended with a `+`") unless phone_number.start_with?('+')
|
33
|
+
if max_age
|
34
|
+
raise ArgumentError.new("`max_age` must between 1 and 2400") unless max_age.between?(1, 2400)
|
35
|
+
end
|
36
|
+
|
37
|
+
params = {phone_number: phone_number}
|
38
|
+
params[:max_age] = max_age if max_age
|
39
|
+
|
40
|
+
request(
|
41
|
+
'/camara/sim-swap/v040/check',
|
42
|
+
params: camelcase(params),
|
43
|
+
type: Post,
|
44
|
+
auth_data: {
|
45
|
+
login_hint: phone_number,
|
46
|
+
purpose: 'FraudPreventionAndDetection',
|
47
|
+
api_scope: 'check-sim-swap',
|
48
|
+
auth_flow: :server_authentication
|
49
|
+
}
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get timestamp of last MSISDN <-> IMSI pairing change for a mobile user account provided with MSIDN.
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
# response = client.network_sim_swap.retrieve_date(phone_number: '+447900000000')
|
57
|
+
#
|
58
|
+
# @param [required, String] :phone_number The phone number to check, in the E.164 format, prepended with a `+`.
|
59
|
+
#
|
60
|
+
# @return [Response]
|
61
|
+
#
|
62
|
+
# @see https://developer.vonage.com/en/api/camara/sim-swap#retrieveSimSwapDate
|
63
|
+
#
|
64
|
+
sig { params(phone_number: String).returns(Vonage::Response) }
|
65
|
+
def retrieve_date(phone_number:)
|
66
|
+
raise ArgumentError.new("`phone_number` must be in E.164 format") unless Phonelib.parse(phone_number).valid?
|
67
|
+
raise ArgumentError.new("`phone_number` must be prepended with a `+`") unless phone_number.start_with?('+')
|
68
|
+
|
69
|
+
params = {phone_number: phone_number}
|
70
|
+
|
71
|
+
request(
|
72
|
+
'/camara/sim-swap/v040/retrieve-date',
|
73
|
+
params: camelcase(params),
|
74
|
+
type: Post,
|
75
|
+
auth_data: {
|
76
|
+
login_hint: phone_number,
|
77
|
+
purpose: 'FraudPreventionAndDetection',
|
78
|
+
api_scope: 'retrieve-sim-swap-date',
|
79
|
+
auth_flow: :server_authentication
|
80
|
+
}
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/vonage/numbers.rb
CHANGED
@@ -17,6 +17,8 @@ module Vonage
|
|
17
17
|
# puts "#{item.msisdn} #{item.country} #{item.type}"
|
18
18
|
# end
|
19
19
|
#
|
20
|
+
# @param [Hash] params
|
21
|
+
#
|
20
22
|
# @option params [String] :application_id
|
21
23
|
# The application that you want to return the numbers for.
|
22
24
|
#
|
@@ -47,8 +49,6 @@ module Vonage
|
|
47
49
|
# Set this to `true` to auto-advance through all the pages in the record
|
48
50
|
# and collect all the data. The default is `false`.
|
49
51
|
#
|
50
|
-
# @param [Hash] params
|
51
|
-
#
|
52
52
|
# @return [ListResponse]
|
53
53
|
#
|
54
54
|
# @see https://developer.nexmo.com/api/developer/numbers#getOwnedNumbers
|
@@ -65,6 +65,8 @@ module Vonage
|
|
65
65
|
# puts "#{item.msisdn} #{item.type} #{item.cost}"
|
66
66
|
# end
|
67
67
|
#
|
68
|
+
# @param [Hash] params
|
69
|
+
#
|
68
70
|
# @option params [required, String] :country
|
69
71
|
# The two character country code in ISO 3166-1 alpha-2 format.
|
70
72
|
#
|
@@ -82,7 +84,7 @@ module Vonage
|
|
82
84
|
# - `2` - Search for numbers that end with **:pattern**
|
83
85
|
#
|
84
86
|
# @option params [String] :features
|
85
|
-
# Available features are `SMS` and `VOICE`.
|
87
|
+
# Available features are `SMS`, `MMS`, and `VOICE`.
|
86
88
|
# To look for numbers that support both, use a comma-separated value: `SMS,VOICE`.
|
87
89
|
#
|
88
90
|
# @option params [Integer] :size
|
@@ -95,8 +97,6 @@ module Vonage
|
|
95
97
|
# Set this to `true` to auto-advance through all the pages in the record
|
96
98
|
# and collect all the data. The default is `false`.
|
97
99
|
#
|
98
|
-
# @param [Hash] params
|
99
|
-
#
|
100
100
|
# @return [ListResponse]
|
101
101
|
#
|
102
102
|
# @see https://developer.nexmo.com/api/developer/numbers#getAvailableNumbers
|
@@ -110,6 +110,8 @@ module Vonage
|
|
110
110
|
# @example
|
111
111
|
# response = client.numbers.buy(country: 'GB', msisdn: '447700900000')
|
112
112
|
#
|
113
|
+
# @param [Hash] params
|
114
|
+
#
|
113
115
|
# @option params [required, String] :country
|
114
116
|
# The two character country code in ISO 3166-1 alpha-2 format.
|
115
117
|
#
|
@@ -120,8 +122,6 @@ module Vonage
|
|
120
122
|
# If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
|
121
123
|
# If you'd like to perform an action on your own account, you do not need to provide this field.
|
122
124
|
#
|
123
|
-
# @param [Hash] params
|
124
|
-
#
|
125
125
|
# @return [Response]
|
126
126
|
#
|
127
127
|
# @see https://developer.nexmo.com/api/developer/numbers#buyANumber
|
@@ -140,6 +140,8 @@ module Vonage
|
|
140
140
|
# @example
|
141
141
|
# response = client.numbers.cancel(country: 'GB', msisdn: '447700900000')
|
142
142
|
#
|
143
|
+
# @param [Hash] params
|
144
|
+
#
|
143
145
|
# @option params [required, String] :country
|
144
146
|
# The two character country code in ISO 3166-1 alpha-2 format.
|
145
147
|
#
|
@@ -150,8 +152,6 @@ module Vonage
|
|
150
152
|
# If you'd like to perform an action on a subaccount, provide the `api_key` of that account here.
|
151
153
|
# If you'd like to perform an action on your own account, you do not need to provide this field.
|
152
154
|
#
|
153
|
-
# @param [Hash] params
|
154
|
-
#
|
155
155
|
# @return [Response]
|
156
156
|
#
|
157
157
|
# @see https://developer.nexmo.com/api/developer/numbers#cancelANumber
|
@@ -177,6 +177,8 @@ module Vonage
|
|
177
177
|
#
|
178
178
|
# response = client.numbers.update(params)
|
179
179
|
#
|
180
|
+
# @param [Hash] params
|
181
|
+
#
|
180
182
|
# @option params [required, String] :country
|
181
183
|
# The two character country code in ISO 3166-1 alpha-2 format.
|
182
184
|
#
|
@@ -203,8 +205,6 @@ module Vonage
|
|
203
205
|
# @option params [String] :voice_status_callback
|
204
206
|
# A webhook URI for Vonage to send a request to when a call ends.
|
205
207
|
#
|
206
|
-
# @param [Hash] params
|
207
|
-
#
|
208
208
|
# @return [Response]
|
209
209
|
#
|
210
210
|
# @see https://developer.nexmo.com/api/developer/numbers#updateANumber
|
@@ -11,6 +11,8 @@ module Vonage
|
|
11
11
|
|
12
12
|
# Find all events
|
13
13
|
#
|
14
|
+
# @deprecated
|
15
|
+
#
|
14
16
|
# @example
|
15
17
|
# response = proactive_connect.events.list
|
16
18
|
#
|
@@ -59,6 +61,7 @@ module Vonage
|
|
59
61
|
# @see https://developer.vonage.com/en/api/proactive-connect#eventsFindAll
|
60
62
|
#
|
61
63
|
def list(**params)
|
64
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
62
65
|
path = "/v0.1/bulk/events"
|
63
66
|
path += "?#{Params.encode(params)}" unless params.empty?
|
64
67
|
|
@@ -13,6 +13,8 @@ module Vonage
|
|
13
13
|
|
14
14
|
# Create a list item
|
15
15
|
#
|
16
|
+
# @deprecated
|
17
|
+
#
|
16
18
|
# @example
|
17
19
|
# response = proactive_connect.item.create(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', data: {name: 'Joe Bloggs', email: 'joe@email.com'})
|
18
20
|
#
|
@@ -25,6 +27,7 @@ module Vonage
|
|
25
27
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsCreate
|
26
28
|
#
|
27
29
|
def create(list_id:, data:)
|
30
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
28
31
|
raise ArgumentError.new(":data must be a Hash") unless data.is_a? Hash
|
29
32
|
request(
|
30
33
|
"/v0.1/bulk/lists/#{list_id}/items",
|
@@ -35,6 +38,8 @@ module Vonage
|
|
35
38
|
|
36
39
|
# Get list item by id
|
37
40
|
#
|
41
|
+
# @deprecated
|
42
|
+
#
|
38
43
|
# @example
|
39
44
|
# response = proactive_connect.item.find(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', item_id: 'd97ebf20-e4de-4e50-921a-7bb4dceb373a')
|
40
45
|
#
|
@@ -47,11 +52,14 @@ module Vonage
|
|
47
52
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsGet
|
48
53
|
#
|
49
54
|
def find(list_id:, item_id:)
|
55
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
50
56
|
request("/v0.1/bulk/lists/#{list_id}/items/#{item_id}")
|
51
57
|
end
|
52
58
|
|
53
59
|
# Update list item
|
54
60
|
#
|
61
|
+
# @deprecated
|
62
|
+
#
|
55
63
|
# @example
|
56
64
|
# response = proactive_connect.item.create(
|
57
65
|
# list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865',
|
@@ -73,6 +81,7 @@ module Vonage
|
|
73
81
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsUpdate
|
74
82
|
#
|
75
83
|
def update(list_id:, item_id:, data:)
|
84
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
76
85
|
raise ArgumentError.new(":data must be a Hash") unless data.is_a? Hash
|
77
86
|
request(
|
78
87
|
"/v0.1/bulk/lists/#{list_id}/items/#{item_id}",
|
@@ -83,6 +92,8 @@ module Vonage
|
|
83
92
|
|
84
93
|
# Delete list item
|
85
94
|
#
|
95
|
+
# @deprecated
|
96
|
+
#
|
86
97
|
# @example
|
87
98
|
# response = proactive_connect.item.delete(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', item_id: 'd97ebf20-e4de-4e50-921a-7bb4dceb373a')
|
88
99
|
#
|
@@ -95,6 +106,7 @@ module Vonage
|
|
95
106
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsDelete
|
96
107
|
#
|
97
108
|
def delete(list_id:, item_id:)
|
109
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
98
110
|
request(
|
99
111
|
"/v0.1/bulk/lists/#{list_id}/items/#{item_id}",
|
100
112
|
type: Delete
|
@@ -11,6 +11,8 @@ module Vonage
|
|
11
11
|
|
12
12
|
# Find all list items
|
13
13
|
#
|
14
|
+
# @deprecated
|
15
|
+
#
|
14
16
|
# @example
|
15
17
|
# response = proactive_connect.items.list(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
|
16
18
|
#
|
@@ -29,6 +31,7 @@ module Vonage
|
|
29
31
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsFindAll
|
30
32
|
#
|
31
33
|
def list(list_id:, **params)
|
34
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
32
35
|
path = "/v0.1/bulk/lists/#{list_id}/items"
|
33
36
|
path += "?#{Params.encode(params)}" unless params.empty?
|
34
37
|
|
@@ -37,6 +40,8 @@ module Vonage
|
|
37
40
|
|
38
41
|
# Download list items as a CSV file format
|
39
42
|
#
|
43
|
+
# @deprecated
|
44
|
+
#
|
40
45
|
# @example
|
41
46
|
# response = proactive_connect.items.download_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
|
42
47
|
#
|
@@ -64,6 +69,7 @@ module Vonage
|
|
64
69
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsDownload
|
65
70
|
#
|
66
71
|
def download_csv(list_id:, order: 'asc', **params)
|
72
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
67
73
|
response = request("/v0.1/bulk/lists/#{list_id}/items/download?order=#{order}", response_class: FileResponse)
|
68
74
|
|
69
75
|
response.filename = params[:filename] if params[:filename]
|
@@ -74,6 +80,8 @@ module Vonage
|
|
74
80
|
|
75
81
|
# Import list items from a CSV file
|
76
82
|
#
|
83
|
+
# @deprecated
|
84
|
+
#
|
77
85
|
# @example
|
78
86
|
# response = proactive_connect.items.upload_csv(list_id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865', filepath: '/files/import.csv')
|
79
87
|
#
|
@@ -96,6 +104,7 @@ module Vonage
|
|
96
104
|
# @see https://developer.vonage.com/en/api/proactive-connect#itemsImport
|
97
105
|
#
|
98
106
|
def upload_csv(list_id:, filepath:)
|
107
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
99
108
|
pn = Pathname.new(filepath)
|
100
109
|
raise ArgumentError, ':filepath not for a file' unless pn.file?
|
101
110
|
raise ArgumentError, 'file at :filepath not readable' unless pn.readable?
|
@@ -13,6 +13,8 @@ module Vonage
|
|
13
13
|
|
14
14
|
# Create list
|
15
15
|
#
|
16
|
+
# @deprecated
|
17
|
+
#
|
16
18
|
# @example
|
17
19
|
# response = proactive_connect.list.create(name: 'List Number 1')
|
18
20
|
#
|
@@ -47,6 +49,7 @@ module Vonage
|
|
47
49
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsCreate
|
48
50
|
#
|
49
51
|
def create(name:, **params)
|
52
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
50
53
|
request(
|
51
54
|
"/v0.1/bulk/lists",
|
52
55
|
params: params.merge({ name: name }),
|
@@ -56,6 +59,8 @@ module Vonage
|
|
56
59
|
|
57
60
|
# Get list by id
|
58
61
|
#
|
62
|
+
# @deprecated
|
63
|
+
#
|
59
64
|
# @example
|
60
65
|
# response = proactive_connect.list.find(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
|
61
66
|
#
|
@@ -65,11 +70,14 @@ module Vonage
|
|
65
70
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsGet
|
66
71
|
#
|
67
72
|
def find(id:)
|
73
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
68
74
|
request("/v0.1/bulk/lists/#{id}")
|
69
75
|
end
|
70
76
|
|
71
77
|
# Update list
|
72
78
|
#
|
79
|
+
# @deprecated
|
80
|
+
#
|
73
81
|
# @example
|
74
82
|
# response = proactive_connect.list.update(name: 'List Number 1')
|
75
83
|
#
|
@@ -107,6 +115,7 @@ module Vonage
|
|
107
115
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsUpdate
|
108
116
|
#
|
109
117
|
def update(id:, name:, **params)
|
118
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
110
119
|
request(
|
111
120
|
"/v0.1/bulk/lists/#{id}",
|
112
121
|
params: params.merge({ name: name }),
|
@@ -116,6 +125,8 @@ module Vonage
|
|
116
125
|
|
117
126
|
# Delete a list by id
|
118
127
|
#
|
128
|
+
# @deprecated
|
129
|
+
#
|
119
130
|
# @example
|
120
131
|
# response = proactive_connect.list.delete(id: '74ea1ecf-06c9-4072-a285-61677bd353e8')
|
121
132
|
#
|
@@ -125,6 +136,7 @@ module Vonage
|
|
125
136
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsDelete
|
126
137
|
#
|
127
138
|
def delete(id:)
|
139
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
128
140
|
request(
|
129
141
|
"/v0.1/bulk/lists/#{id}",
|
130
142
|
type: Delete
|
@@ -133,6 +145,8 @@ module Vonage
|
|
133
145
|
|
134
146
|
# Clear list by deleting all items
|
135
147
|
#
|
148
|
+
# @deprecated
|
149
|
+
#
|
136
150
|
# @example
|
137
151
|
# response = proactive_connect.list.clear_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
|
138
152
|
#
|
@@ -142,6 +156,7 @@ module Vonage
|
|
142
156
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsClear
|
143
157
|
#
|
144
158
|
def clear_items(id:)
|
159
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
145
160
|
request(
|
146
161
|
"/v0.1/bulk/lists/#{id}/clear",
|
147
162
|
type: Post
|
@@ -150,6 +165,8 @@ module Vonage
|
|
150
165
|
|
151
166
|
# Fetch and replace all items from datasource
|
152
167
|
#
|
168
|
+
# @deprecated
|
169
|
+
#
|
153
170
|
# @example
|
154
171
|
# response = proactive_connect.list.fetch_and_replace_items(id: 'e546eebe-8e23-4e4d-bb7c-29d4700c9865')
|
155
172
|
#
|
@@ -159,6 +176,7 @@ module Vonage
|
|
159
176
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsFetch
|
160
177
|
#
|
161
178
|
def fetch_and_replace_items(id:)
|
179
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
162
180
|
request(
|
163
181
|
"/v0.1/bulk/lists/#{id}/fetch",
|
164
182
|
type: Post
|
@@ -11,6 +11,8 @@ module Vonage
|
|
11
11
|
|
12
12
|
# Find all lists
|
13
13
|
#
|
14
|
+
# @deprecated
|
15
|
+
#
|
14
16
|
# @example
|
15
17
|
# response = proactive_connect.lists.list
|
16
18
|
#
|
@@ -26,6 +28,7 @@ module Vonage
|
|
26
28
|
# @see https://developer.vonage.com/en/api/proactive-connect#listsFindAll
|
27
29
|
#
|
28
30
|
def list(**params)
|
31
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
29
32
|
path = "/v0.1/bulk/lists"
|
30
33
|
path += "?#{Params.encode(params)}" unless params.empty?
|
31
34
|
|
@@ -5,28 +5,38 @@ module Vonage
|
|
5
5
|
class ProactiveConnect < Namespace
|
6
6
|
extend T::Sig
|
7
7
|
|
8
|
+
# @deprecated
|
8
9
|
sig { returns(T.nilable(Vonage::ProactiveConnect::Lists)) }
|
9
10
|
def lists
|
11
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
10
12
|
@lists ||= Lists.new(@config)
|
11
13
|
end
|
12
14
|
|
15
|
+
# @deprecated
|
13
16
|
sig { returns(T.nilable(Vonage::ProactiveConnect::List)) }
|
14
17
|
def list
|
18
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
15
19
|
@list ||= List.new(@config)
|
16
20
|
end
|
17
21
|
|
22
|
+
# @deprecated
|
18
23
|
sig { returns(T.nilable(Vonage::ProactiveConnect::Items)) }
|
19
24
|
def items
|
25
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
20
26
|
@items ||= Items.new(@config)
|
21
27
|
end
|
22
28
|
|
29
|
+
# @deprecated
|
23
30
|
sig { returns(T.nilable(Vonage::ProactiveConnect::Item)) }
|
24
31
|
def item
|
32
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
25
33
|
@item ||= Item.new(@config)
|
26
34
|
end
|
27
35
|
|
36
|
+
# @deprecated
|
28
37
|
sig { returns(T.nilable(Vonage::ProactiveConnect::Events)) }
|
29
38
|
def events
|
39
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
30
40
|
@events ||= Events.new(@config)
|
31
41
|
end
|
32
42
|
end
|
@@ -5,7 +5,7 @@ module Vonage
|
|
5
5
|
class Verify2::StartVerificationOptions
|
6
6
|
VALID_OPTS = [:locale, :channel_timeout, :client_ref, :code_length, :code, :fraud_check].freeze
|
7
7
|
|
8
|
-
MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT = [
|
8
|
+
MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT = [15, 900]
|
9
9
|
|
10
10
|
MIN_CODE_LENGTH, MAX_CODE_LENGTH = [4, 10]
|
11
11
|
|
@@ -22,6 +22,7 @@ module Vonage
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def channel_timeout=(channel_timeout)
|
25
|
+
raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be an integer" unless channel_timeout.is_a?(Integer)
|
25
26
|
unless channel_timeout.between?(MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT)
|
26
27
|
raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be between #{MIN_CHANNEL_TIMEOUT} and #{MAX_CHANNEL_TIMEOUT} (inclusive)"
|
27
28
|
end
|
data/lib/vonage/version.rb
CHANGED
@@ -107,9 +107,13 @@ module Vonage
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def verify_event_url
|
110
|
-
|
110
|
+
unless self.eventUrl.is_a?(Array) && self.eventUrl.length == 1 && self.eventUrl[0].is_a?(String)
|
111
|
+
raise ClientError.new("Expected 'eventUrl' parameter to be an Array containing a single string item")
|
112
|
+
end
|
113
|
+
|
114
|
+
uri = URI.parse(self.eventUrl[0])
|
111
115
|
|
112
|
-
raise ClientError.new("Invalid 'eventUrl' value, must
|
116
|
+
raise ClientError.new("Invalid 'eventUrl' value, array must contain a valid URL") unless uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
|
113
117
|
|
114
118
|
self.eventUrl
|
115
119
|
end
|
@@ -209,6 +213,7 @@ module Vonage
|
|
209
213
|
}
|
210
214
|
|
211
215
|
hash.merge!(headers: endpoint_attrs[:headers]) if endpoint_attrs[:headers]
|
216
|
+
hash.merge!(standardHeaders: endpoint_attrs[:standardHeaders]) if endpoint_attrs[:standardHeaders]
|
212
217
|
|
213
218
|
hash
|
214
219
|
end
|