vonage 7.29.1 → 8.0.0.beta
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/README.md +89 -476
- data/lib/vonage/applications.rb +4 -12
- data/lib/vonage/basic.rb +1 -1
- data/lib/vonage/bearer_token.rb +1 -1
- data/lib/vonage/client.rb +0 -65
- data/lib/vonage/client_error.rb +1 -1
- data/lib/vonage/config.rb +1 -9
- data/lib/vonage/conversations/events.rb +0 -12
- data/lib/vonage/conversations/legs.rb +0 -6
- data/lib/vonage/conversations/members.rb +0 -15
- data/lib/vonage/conversations/users.rb +0 -15
- data/lib/vonage/conversations.rb +0 -30
- data/lib/vonage/errors.rb +20 -37
- data/lib/vonage/gsm7.rb +1 -1
- data/lib/vonage/http.rb +3 -3
- data/lib/vonage/jwt.rb +0 -17
- data/lib/vonage/key_secret_params.rb +2 -3
- data/lib/vonage/keys.rb +1 -14
- data/lib/vonage/logger.rb +3 -5
- data/lib/vonage/messaging/channels/viber.rb +2 -9
- data/lib/vonage/messaging/channels/whats_app.rb +1 -3
- data/lib/vonage/messaging/message.rb +0 -1
- data/lib/vonage/messaging.rb +4 -34
- data/lib/vonage/namespace.rb +68 -137
- data/lib/vonage/numbers.rb +17 -40
- data/lib/vonage/server_error.rb +1 -1
- data/lib/vonage/signature.rb +5 -5
- data/lib/vonage/sms.rb +20 -20
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/video/archives.rb +58 -25
- data/lib/vonage/video/list_response.rb +11 -0
- data/lib/vonage/video/moderation.rb +22 -7
- data/lib/vonage/video/signals.rb +9 -4
- data/lib/vonage/video/streams.rb +12 -6
- data/lib/vonage/video.rb +13 -50
- data/lib/vonage/voice/actions/connect.rb +5 -34
- data/lib/vonage/voice/actions/conversation.rb +4 -10
- data/lib/vonage/voice/actions/input.rb +3 -19
- data/lib/vonage/voice/actions/notify.rb +3 -8
- data/lib/vonage/voice/actions/pay.rb +107 -0
- data/lib/vonage/voice/actions/record.rb +4 -52
- data/lib/vonage/voice/actions/stream.rb +4 -48
- data/lib/vonage/voice/actions/talk.rb +4 -54
- data/lib/vonage/voice/talk.rb +1 -11
- data/lib/vonage/voice.rb +0 -24
- data/lib/vonage.rb +0 -4
- data/vonage.gemspec +1 -3
- metadata +12 -108
- data/lib/vonage/api_error.rb +0 -33
- data/lib/vonage/conversation/event/list_response.rb +0 -11
- data/lib/vonage/conversation/event.rb +0 -108
- data/lib/vonage/conversation/list_response.rb +0 -11
- data/lib/vonage/conversation/member/list_response.rb +0 -11
- data/lib/vonage/conversation/member.rb +0 -134
- data/lib/vonage/conversation/user/conversations_list_response.rb +0 -11
- data/lib/vonage/conversation/user/sessions_list_response.rb +0 -11
- data/lib/vonage/conversation/user.rb +0 -67
- data/lib/vonage/conversation.rb +0 -164
- data/lib/vonage/meetings/applications.rb +0 -28
- data/lib/vonage/meetings/dial_in_numbers/list_response.rb +0 -11
- data/lib/vonage/meetings/dial_in_numbers.rb +0 -26
- data/lib/vonage/meetings/recordings.rb +0 -42
- data/lib/vonage/meetings/rooms/list_response.rb +0 -11
- data/lib/vonage/meetings/rooms.rb +0 -167
- data/lib/vonage/meetings/sessions/list_response.rb +0 -11
- data/lib/vonage/meetings/sessions.rb +0 -31
- data/lib/vonage/meetings/themes/list_response.rb +0 -11
- data/lib/vonage/meetings/themes.rb +0 -239
- data/lib/vonage/meetings.rb +0 -50
- data/lib/vonage/messaging/channels/rcs.rb +0 -42
- data/lib/vonage/network_authentication/client_authentication.rb +0 -39
- data/lib/vonage/network_authentication/server_authentication.rb +0 -47
- data/lib/vonage/network_authentication.rb +0 -22
- data/lib/vonage/network_number_verification.rb +0 -92
- data/lib/vonage/network_sim_swap.rb +0 -84
- data/lib/vonage/number_insight_2.rb +0 -36
- data/lib/vonage/proactive_connect/events/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/events.rb +0 -71
- data/lib/vonage/proactive_connect/item.rb +0 -116
- data/lib/vonage/proactive_connect/items/file_response.rb +0 -32
- data/lib/vonage/proactive_connect/items/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/items.rb +0 -116
- data/lib/vonage/proactive_connect/list.rb +0 -186
- data/lib/vonage/proactive_connect/lists/list_response.rb +0 -11
- data/lib/vonage/proactive_connect/lists.rb +0 -38
- data/lib/vonage/proactive_connect.rb +0 -43
- data/lib/vonage/subaccounts/balance_transfers/list_response.rb +0 -11
- data/lib/vonage/subaccounts/credit_transfers/list_response.rb +0 -11
- data/lib/vonage/subaccounts/list_response.rb +0 -15
- data/lib/vonage/subaccounts.rb +0 -203
- data/lib/vonage/users/list_response.rb +0 -11
- data/lib/vonage/users.rb +0 -156
- data/lib/vonage/verify2/channels/email.rb +0 -36
- data/lib/vonage/verify2/channels/silent_auth.rb +0 -45
- data/lib/vonage/verify2/channels/sms.rb +0 -63
- data/lib/vonage/verify2/channels/voice.rb +0 -32
- data/lib/vonage/verify2/channels/whats_app.rb +0 -39
- data/lib/vonage/verify2/channels/whats_app_interactive.rb +0 -32
- data/lib/vonage/verify2/start_verification_options.rb +0 -63
- data/lib/vonage/verify2/template_fragments/list_response.rb +0 -11
- data/lib/vonage/verify2/template_fragments.rb +0 -125
- data/lib/vonage/verify2/templates/list_response.rb +0 -11
- data/lib/vonage/verify2/templates.rb +0 -86
- data/lib/vonage/verify2/workflow.rb +0 -39
- data/lib/vonage/verify2/workflow_builder.rb +0 -25
- data/lib/vonage/verify2.rb +0 -112
- data/lib/vonage/video/archives/list_response.rb +0 -11
- data/lib/vonage/video/broadcasts/list_response.rb +0 -11
- data/lib/vonage/video/broadcasts.rb +0 -75
- data/lib/vonage/video/captions.rb +0 -67
- data/lib/vonage/video/renders/list_response.rb +0 -11
- data/lib/vonage/video/renders.rb +0 -107
- data/lib/vonage/video/sip.rb +0 -48
- data/lib/vonage/video/streams/list_response.rb +0 -11
- data/lib/vonage/video/web_socket.rb +0 -61
@@ -1,15 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
|
3
|
-
class Vonage::Subaccounts::ListResponse < Vonage::Response
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def primary_account
|
7
|
-
@entity._embedded.primary_account
|
8
|
-
end
|
9
|
-
|
10
|
-
def each
|
11
|
-
return enum_for(:each) unless block_given?
|
12
|
-
|
13
|
-
@entity._embedded.subaccounts.each { |item| yield item }
|
14
|
-
end
|
15
|
-
end
|
data/lib/vonage/subaccounts.rb
DELETED
@@ -1,203 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Subaccounts < Namespace
|
6
|
-
self.authentication = Basic
|
7
|
-
|
8
|
-
self.request_body = JSON
|
9
|
-
|
10
|
-
# Retrieve list of subaccounts.
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# response = client.subaccounts.list
|
14
|
-
#
|
15
|
-
# @see https://developer.vonage.com/en/api/subaccounts#retrieveSubaccountsList
|
16
|
-
#
|
17
|
-
def list
|
18
|
-
request("/accounts/#{@config.api_key}/subaccounts", response_class: ListResponse)
|
19
|
-
end
|
20
|
-
|
21
|
-
# Retrieve a subaccount.
|
22
|
-
#
|
23
|
-
# @example
|
24
|
-
# response = client.subaccounts.find(subaccount_key: 'abc123')
|
25
|
-
#
|
26
|
-
# @option params [required, String] :subaccount_key
|
27
|
-
# The API key for the subaccount you want to retrieve
|
28
|
-
#
|
29
|
-
# @see https://developer.vonage.com/en/api/subaccounts#retrieveSubaccount
|
30
|
-
#
|
31
|
-
def find(subaccount_key:)
|
32
|
-
request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}")
|
33
|
-
end
|
34
|
-
|
35
|
-
# Create a subaccount.
|
36
|
-
#
|
37
|
-
# @example
|
38
|
-
# response = client.subaccounts.create(name: 'Foo')
|
39
|
-
#
|
40
|
-
# @option params [required, String] :name
|
41
|
-
# The name of the subaccount
|
42
|
-
#
|
43
|
-
# @option params [optional, String] :secret
|
44
|
-
# An account secret for use by the subaccount. Can be used in combination with your API key to authenticate your API requests.
|
45
|
-
# Requirements:
|
46
|
-
# - 8 characters and no more than 25
|
47
|
-
# - 1 lower-case letter
|
48
|
-
# - 1 capital letter
|
49
|
-
# - 1 digit
|
50
|
-
# - must be unique
|
51
|
-
#
|
52
|
-
# @option params [optional, Boolean] :use_primary_account_balance
|
53
|
-
# Whether the subaccount uses the primary account balance (true, the default) or has its own balance (false).
|
54
|
-
# Once set to `false` cannot be changed back to `true`
|
55
|
-
#
|
56
|
-
# @see https://developer.vonage.com/en/api/subaccounts#createSubAccount
|
57
|
-
#
|
58
|
-
def create(name:, **params)
|
59
|
-
request("/accounts/#{@config.api_key}/subaccounts", params: params.merge(name: name), type: Post)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Modify a subaccount.
|
63
|
-
#
|
64
|
-
# @example
|
65
|
-
# response = client.subaccounts.update(name: 'Bar')
|
66
|
-
#
|
67
|
-
# @option params [required, String] :subaccount_key
|
68
|
-
# The API key for the subaccount you want to modify
|
69
|
-
#
|
70
|
-
# @option params [optional, String] :name
|
71
|
-
# The name of the subaccount
|
72
|
-
#
|
73
|
-
# @option params [optional, Boolean] :use_primary_account_balance
|
74
|
-
# Whether the subaccount uses the primary account balance (true, the default) or has its own balance (false).
|
75
|
-
# Once set to `false` cannot be changed back to `true`
|
76
|
-
#
|
77
|
-
# @option params [optional, String] :suspended
|
78
|
-
# Whether the subaccount is suspended (true) or not (false, the default)
|
79
|
-
#
|
80
|
-
# @see https://developer.vonage.com/en/api/subaccounts#modifySubaccount
|
81
|
-
#
|
82
|
-
def update(subaccount_key:, **params)
|
83
|
-
request("/accounts/#{@config.api_key}/subaccounts/#{subaccount_key}", params: params, type: Patch)
|
84
|
-
end
|
85
|
-
|
86
|
-
# Retrieve list of credit transfers.
|
87
|
-
#
|
88
|
-
# @example
|
89
|
-
# response = client.subaccounts.list_credit_transfers(start_date: "2023-06-15T15:53:50Z")
|
90
|
-
#
|
91
|
-
# @option params [optional, String] :start_date
|
92
|
-
# The ISO format datetime from which to list transfers. Example: 2019-03-02T16:34:49Z.
|
93
|
-
# Defaults to "1970-01-01T00:00:00Z" if omitted
|
94
|
-
#
|
95
|
-
# @option params [optional, String] :end_date
|
96
|
-
# The ISO format datetime to which to list transfers. Example: 2019-03-02T16:34:49Z.
|
97
|
-
# If absent then all transfers until now is returned.
|
98
|
-
#
|
99
|
-
# @option params [optional, String] :subaccount
|
100
|
-
# Subaccount to filter by.
|
101
|
-
#
|
102
|
-
# @see https://developer.vonage.com/en/api/subaccounts#retrieveCreditTransfers
|
103
|
-
#
|
104
|
-
def list_credit_transfers(start_date: "1970-01-01T00:00:00Z", **params)
|
105
|
-
path = "/accounts/#{@config.api_key}/credit-transfers?#{Params.encode(params.merge(start_date: start_date))}"
|
106
|
-
|
107
|
-
request(path, response_class: CreditTransfers::ListResponse)
|
108
|
-
end
|
109
|
-
|
110
|
-
# Transfer credit.
|
111
|
-
#
|
112
|
-
# @example
|
113
|
-
# response = client.subaccounts.transfer_credit(from: 'abc123', to: 'def456', amount: 10.00)
|
114
|
-
#
|
115
|
-
# @option params [required, String] :from
|
116
|
-
# The API key of the account or subaccount to transfer credit from.
|
117
|
-
#
|
118
|
-
# @option params [required, String] :to
|
119
|
-
# The API key of the account or subaccount to transfer credit to.
|
120
|
-
#
|
121
|
-
# @option params [required, Number] :amount
|
122
|
-
# The amount to transfer
|
123
|
-
#
|
124
|
-
# @option params [optional, String] :reference
|
125
|
-
# A reference for the transfer.
|
126
|
-
#
|
127
|
-
# @see https://developer.vonage.com/en/api/subaccounts#transferCredit
|
128
|
-
#
|
129
|
-
def transfer_credit(from:, to:, amount:, **params)
|
130
|
-
request("/accounts/#{@config.api_key}/credit-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post)
|
131
|
-
end
|
132
|
-
|
133
|
-
# Retrieve list of balance transfers.
|
134
|
-
#
|
135
|
-
# @example
|
136
|
-
# response = client.subaccounts.list_balance_transfers(start_date: "2023-06-15T15:53:50Z")
|
137
|
-
#
|
138
|
-
# @option params [optional, String] :start_date
|
139
|
-
# The ISO format datetime from which to list transfers. Example: 2019-03-02T16:34:49Z.
|
140
|
-
# Defaults to "1970-01-01T00:00:00Z" if omitted
|
141
|
-
#
|
142
|
-
# @option params [optional, String] :end_date
|
143
|
-
# The ISO format datetime to which to list transfers. Example: 2019-03-02T16:34:49Z.
|
144
|
-
# If absent then all transfers until now is returned.
|
145
|
-
#
|
146
|
-
# @option params [optional, String] :subaccount
|
147
|
-
# Subaccount to filter by.
|
148
|
-
#
|
149
|
-
# @see https://developer.vonage.com/en/api/subaccounts#retrieveBalanceTransfers
|
150
|
-
#
|
151
|
-
def list_balance_transfers(start_date: "1970-01-01T00:00:00Z", **params)
|
152
|
-
path = "/accounts/#{@config.api_key}/balance-transfers?#{Params.encode(params.merge(start_date: start_date))}"
|
153
|
-
|
154
|
-
request(path, response_class: BalanceTransfers::ListResponse)
|
155
|
-
end
|
156
|
-
|
157
|
-
# Transfer balance.
|
158
|
-
#
|
159
|
-
# @example
|
160
|
-
# response = client.subaccounts.transfer_balance(from: 'abc123', to: 'def456', amount: 10.00)
|
161
|
-
#
|
162
|
-
# @option params [required, String] :from
|
163
|
-
# The API key of the account or subaccount to transfer balance from.
|
164
|
-
#
|
165
|
-
# @option params [required, String] :to
|
166
|
-
# The API key of the account or subaccount to transfer balance to.
|
167
|
-
#
|
168
|
-
# @option params [required, Number] :amount
|
169
|
-
# The amount to transfer
|
170
|
-
#
|
171
|
-
# @option params [optional, String] :reference
|
172
|
-
# A reference for the transfer.
|
173
|
-
#
|
174
|
-
# @see https://developer.vonage.com/en/api/subaccounts#transferBalance
|
175
|
-
#
|
176
|
-
def transfer_balance(from:, to:, amount:, **params)
|
177
|
-
request("/accounts/#{@config.api_key}/balance-transfers", params: params.merge(from: from, to: to, amount: amount), type: Post)
|
178
|
-
end
|
179
|
-
|
180
|
-
# Transfer number.
|
181
|
-
#
|
182
|
-
# @example
|
183
|
-
# response = client.subaccounts.transfer_number(from: 'abc123', to: 'def456', number: 447900000000, country: 'GB')
|
184
|
-
#
|
185
|
-
# @option params [required, String] :from
|
186
|
-
# The API key of the account or subaccount to transfer the number from.
|
187
|
-
#
|
188
|
-
# @option params [required, String] :to
|
189
|
-
# The API key of the account or subaccount to transfer the number to.
|
190
|
-
#
|
191
|
-
# @option params [required, Number] :number
|
192
|
-
# The number to transfer
|
193
|
-
#
|
194
|
-
# @option params [required, String] :country
|
195
|
-
# An ISO-3166-1 alpha 2 code representing the country for the number, e.g. GB.
|
196
|
-
#
|
197
|
-
# @see https://developer.vonage.com/en/api/subaccounts#transferNumber
|
198
|
-
#
|
199
|
-
def transfer_number(from:, to:, number:, country:)
|
200
|
-
request("/accounts/#{@config.api_key}/transfer-number", params: {from: from, to: to, number: number, country: country}, type: Post)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
data/lib/vonage/users.rb
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Users < Namespace
|
6
|
-
extend T::Sig
|
7
|
-
self.authentication = BearerToken
|
8
|
-
|
9
|
-
self.request_body = JSON
|
10
|
-
|
11
|
-
# Get a list of Users associated with the Vonage Application.
|
12
|
-
#
|
13
|
-
# @param [optional, Integer] :page_size
|
14
|
-
# Specifies the number of records to be returned in the response.
|
15
|
-
#
|
16
|
-
# @param [optional, String] :order
|
17
|
-
# Specifies the order in which the records should be returned.
|
18
|
-
# Must be one of `asc`, `ASC`, `desc`, or `DESC`
|
19
|
-
#
|
20
|
-
# @param [optional, String] :cursor
|
21
|
-
# Specficy a cursor point from which to start returning results, for example the values of the `next` or `prev`
|
22
|
-
# `_links` contained in a response.
|
23
|
-
#
|
24
|
-
# @param [optional, String] :name
|
25
|
-
# Specify a user name with which to filter results
|
26
|
-
#
|
27
|
-
# @return [ListResponse]
|
28
|
-
#
|
29
|
-
# @see https://developer.vonage.com/en/api/application.v2#getUsers
|
30
|
-
#
|
31
|
-
def list(**params)
|
32
|
-
request('/v1/users', params: params, response_class: ListResponse)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Get a specified User associated with the Vonage Application.
|
36
|
-
#
|
37
|
-
# @param [required, String] :id
|
38
|
-
# The unique ID or name for the user.
|
39
|
-
#
|
40
|
-
# @return [Vonage::Response]
|
41
|
-
#
|
42
|
-
# @see https://developer.vonage.com/en/api/application.v2#getUser
|
43
|
-
#
|
44
|
-
def find(id:)
|
45
|
-
request("/v1/users/#{id}")
|
46
|
-
end
|
47
|
-
|
48
|
-
# Create a new User associated with the Vonage Application.
|
49
|
-
#
|
50
|
-
# @param [optional, String] :name
|
51
|
-
# A unique name for the user. If not provided, a name will be auto-generated.
|
52
|
-
#
|
53
|
-
# @param [optional, String] :display_name
|
54
|
-
# A string to be displayed as user name. It does not need to be unique.
|
55
|
-
#
|
56
|
-
# @param [optional, String] :image_url
|
57
|
-
# A publicly accessible URL to an image file for an image to be associated with the user.
|
58
|
-
#
|
59
|
-
# @param [optional, Hash] :properties A hash defining properties for the User.
|
60
|
-
# @option properties [Hash] :custom_data A hash of custom data as key/value pairs.
|
61
|
-
#
|
62
|
-
# @param [optional, Hash] :channels A hash defining details of various channels.
|
63
|
-
# @option channels [Array] :pstn An array containing a Hash which defines data for the pstn channel.
|
64
|
-
# @option pstn [Integer] :number The pstn number.
|
65
|
-
# @option channels [Array] :sip An array containing a Hash which defines data for the sip channel.
|
66
|
-
# @option sip [String] :uri The sip uri.
|
67
|
-
# @option sip [String] :username The sip username.
|
68
|
-
# @option sip [String] :password The sip password.
|
69
|
-
# @option channels [Array] :vbc An array containing a Hash which defines data for the vbc channel.
|
70
|
-
# @option vbc [String] :extension The vbc extension.
|
71
|
-
# @option channels [Array] :websocket An array containing a Hash which defines data for the websocket channel.
|
72
|
-
# @option websocket [String] :uri The websocket uri.
|
73
|
-
# @option websocket [String] :content-type The websocket audio type. Must be one of: `audio/l16;rate=8000`, `audio/l16;rate=16000`.
|
74
|
-
# @option websocket [Hash] :headers A hash of custom websocket headers provided as key/value pairs.
|
75
|
-
# @option channels [Array] :sms An array containing a Hash which defines data for the sms channel.
|
76
|
-
# @option sms [Integer] :number The sms number.
|
77
|
-
# @option channels [Array] :mms An array containing a Hash which defines data for the mms channel.
|
78
|
-
# @option mms [Integer] :number The mms number.
|
79
|
-
# @option channels [Array] :whatsapp An array containing a Hash which defines data for the whatsapp channel.
|
80
|
-
# @option whatsapp [Integer] :number The whatsapp number.
|
81
|
-
# @option channels [Array] :viber An array containing a Hash which defines data for the sms channel.
|
82
|
-
# @option viber [Integer] :number The viber number.
|
83
|
-
# @option channels [Array] :messenger An array containing a Hash which defines data for the messenger channel.
|
84
|
-
# @option messenger [Integer] :id The messenger id.
|
85
|
-
#
|
86
|
-
# @return [Vonage::Response]
|
87
|
-
#
|
88
|
-
# @see https://developer.vonage.com/en/api/application.v2#createUser
|
89
|
-
#
|
90
|
-
def create(**params)
|
91
|
-
request('/v1/users', params: params, type: Post)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Update an existing User associated with the Vonage Application.
|
95
|
-
#
|
96
|
-
# @param [required, String] :id
|
97
|
-
# The unique ID or name for the user to be updated.
|
98
|
-
#
|
99
|
-
# @param [optional, String] :name
|
100
|
-
# A unique name for the user.
|
101
|
-
#
|
102
|
-
# @param [optional, String] :display_name
|
103
|
-
# A string to be displayed as user name. It does not need to be unique.
|
104
|
-
#
|
105
|
-
# @param [optional, String] :image_url
|
106
|
-
# A publicly accessible URL to an image file for an image to be associated with the user.
|
107
|
-
#
|
108
|
-
# @param [optional, Hash] :properties A hash defining properties for the User.
|
109
|
-
# @option properties [Hash] :custom_data A hash of custom data as key/value pairs.
|
110
|
-
#
|
111
|
-
# @param [optional, Hash] :channels A hash defining details of various channels.
|
112
|
-
# @option channels [Array] :pstn An array containing a Hash which defines data for the pstn channel.
|
113
|
-
# @option pstn [Integer] :number The pstn number.
|
114
|
-
# @option channels [Array] :sip An array containing a Hash which defines data for the sip channel.
|
115
|
-
# @option sip [String] :uri The sip uri.
|
116
|
-
# @option sip [String] :username The sip username.
|
117
|
-
# @option sip [String] :password The sip password.
|
118
|
-
# @option channels [Array] :vbc An array containing a Hash which defines data for the vbc channel.
|
119
|
-
# @option vbc [String] :extension The vbc extension.
|
120
|
-
# @option channels [Array] :websocket An array containing a Hash which defines data for the websocket channel.
|
121
|
-
# @option websocket [String] :uri The websocket uri.
|
122
|
-
# @option websocket [String] :content-type The websocket audio type. Must be one of: `audio/l16;rate=8000`, `audio/l16;rate=16000`.
|
123
|
-
# @option websocket [Hash] :headers A hash of custom websocket headers provided as key/value pairs.
|
124
|
-
# @option channels [Array] :sms An array containing a Hash which defines data for the sms channel.
|
125
|
-
# @option sms [Integer] :number The sms number.
|
126
|
-
# @option channels [Array] :mms An array containing a Hash which defines data for the mms channel.
|
127
|
-
# @option mms [Integer] :number The mms number.
|
128
|
-
# @option channels [Array] :whatsapp An array containing a Hash which defines data for the whatsapp channel.
|
129
|
-
# @option whatsapp [Integer] :number The whatsapp number.
|
130
|
-
# @option channels [Array] :viber An array containing a Hash which defines data for the sms channel.
|
131
|
-
# @option viber [Integer] :number The viber number.
|
132
|
-
# @option channels [Array] :messenger An array containing a Hash which defines data for the messenger channel.
|
133
|
-
# @option messenger [Integer] :id The messenger id.
|
134
|
-
#
|
135
|
-
# @return [Vonage::Response]
|
136
|
-
#
|
137
|
-
# @see https://developer.vonage.com/en/api/application.v2#createUser
|
138
|
-
#
|
139
|
-
def update(id:, **params)
|
140
|
-
request("/v1/users/#{id}", params: params, type: Patch)
|
141
|
-
end
|
142
|
-
|
143
|
-
# Delete a specified User associated with the Vonage Application.
|
144
|
-
#
|
145
|
-
# @param [required, String] :id
|
146
|
-
# The unique ID or name for the user.
|
147
|
-
#
|
148
|
-
# @return [Vonage::Response]
|
149
|
-
#
|
150
|
-
# @see https://developer.vonage.com/en/api/application.v2#deleteUser
|
151
|
-
#
|
152
|
-
def delete(id:)
|
153
|
-
request("/v1/users/#{id}", type: Delete)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
|
5
|
-
module Vonage
|
6
|
-
class Verify2::Channels::Email
|
7
|
-
|
8
|
-
attr_reader :channel, :to, :from
|
9
|
-
|
10
|
-
def initialize(to:, from: nil)
|
11
|
-
self.channel = 'email'
|
12
|
-
self.to = to
|
13
|
-
self.from = from unless from.nil?
|
14
|
-
end
|
15
|
-
|
16
|
-
def to=(to)
|
17
|
-
@to = to
|
18
|
-
end
|
19
|
-
|
20
|
-
def from=(from)
|
21
|
-
@from = from
|
22
|
-
end
|
23
|
-
|
24
|
-
def to_h
|
25
|
-
hash = Hash.new
|
26
|
-
self.instance_variables.each do |ivar|
|
27
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
28
|
-
end
|
29
|
-
hash
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
attr_writer :channel
|
35
|
-
end
|
36
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
require 'uri'
|
5
|
-
|
6
|
-
module Vonage
|
7
|
-
class Verify2::Channels::SilentAuth
|
8
|
-
|
9
|
-
attr_reader :channel, :to, :sandbox, :redirect_url
|
10
|
-
|
11
|
-
def initialize(to:, redirect_url: nil, sandbox: nil)
|
12
|
-
self.channel = 'silent_auth'
|
13
|
-
self.to = to
|
14
|
-
self.redirect_url = redirect_url unless redirect_url.nil?
|
15
|
-
self.sandbox = sandbox unless sandbox.nil?
|
16
|
-
end
|
17
|
-
|
18
|
-
def to=(to)
|
19
|
-
raise ArgumentError, "Invalid 'to' value #{to}. Expected to be in E.164 format" unless Phonelib.parse(to.to_i).valid?
|
20
|
-
@to = to
|
21
|
-
end
|
22
|
-
|
23
|
-
def redirect_url=(redirect_url)
|
24
|
-
raise ArgumentError, "Invalid 'to' value #{redirect_url}. Expected to be a valid URL" unless URI.parse(redirect_url).is_a?(URI::HTTP)
|
25
|
-
@redirect_url = redirect_url
|
26
|
-
end
|
27
|
-
|
28
|
-
def sandbox=(sandbox)
|
29
|
-
raise ArgumentError, "Invalid 'sandbox' value #{sandbox}. Expected to be boolean value" unless [true, false].include? sandbox
|
30
|
-
@sandbox = sandbox
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_h
|
34
|
-
hash = Hash.new
|
35
|
-
self.instance_variables.each do |ivar|
|
36
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
37
|
-
end
|
38
|
-
hash
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
attr_writer :channel
|
44
|
-
end
|
45
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
|
5
|
-
module Vonage
|
6
|
-
class Verify2::Channels::SMS
|
7
|
-
APP_HASH_LENGTH = 11
|
8
|
-
|
9
|
-
attr_reader :channel, :to, :from, :entity_id, :content_id, :app_hash
|
10
|
-
|
11
|
-
def initialize(to:, app_hash: nil)
|
12
|
-
self.channel = 'sms'
|
13
|
-
self.to = to
|
14
|
-
self.app_hash = app_hash unless app_hash.nil?
|
15
|
-
end
|
16
|
-
|
17
|
-
def to=(to)
|
18
|
-
raise ArgumentError, "Invalid 'to' value #{to}. Expected to be in E.164 format" unless Phonelib.parse(to).valid?
|
19
|
-
@to = to
|
20
|
-
end
|
21
|
-
|
22
|
-
def from=(from)
|
23
|
-
validate_from(from)
|
24
|
-
@from = from
|
25
|
-
end
|
26
|
-
|
27
|
-
def entity_id=(entity_id)
|
28
|
-
raise ArgumentError, "Invalid 'entity_id' value #{entity_id}. Length must be between 1 and 20 characters." unless entity_id.length.between?(1, 20)
|
29
|
-
@entity_id = entity_id
|
30
|
-
end
|
31
|
-
|
32
|
-
def content_id=(content_id)
|
33
|
-
raise ArgumentError, "Invalid 'content_id' value #{content_id}. Length must be between 1 and 20 characters ." unless content_id.length.between?(1, 20)
|
34
|
-
@content_id = content_id
|
35
|
-
end
|
36
|
-
|
37
|
-
def app_hash=(app_hash)
|
38
|
-
raise ArgumentError, "Invalid 'app_hash' value #{app_hash}. Length must be #{APP_HASH_LENGTH}" unless app_hash.length == APP_HASH_LENGTH
|
39
|
-
@app_hash = app_hash
|
40
|
-
end
|
41
|
-
|
42
|
-
def to_h
|
43
|
-
hash = Hash.new
|
44
|
-
self.instance_variables.each do |ivar|
|
45
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
46
|
-
end
|
47
|
-
hash
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
attr_writer :channel
|
53
|
-
|
54
|
-
def validate_from(from)
|
55
|
-
if from.match?(/\D/)
|
56
|
-
raise ArgumentError, "Invalid alpha-numeric 'from' value #{from}. Length must be between 3 and 11 characters." unless from.length.between?(3, 11)
|
57
|
-
else
|
58
|
-
raise ArgumentError, "Invalid numeric 'from' value #{from}. Length must be between 11 and 15 characters." unless from.length.between?(11, 15)
|
59
|
-
raise ArgumentError, "Invalid 'from' value #{from}. Expected to be in E.164 format" unless Phonelib.parse(from).valid?
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
|
5
|
-
module Vonage
|
6
|
-
class Verify2::Channels::Voice
|
7
|
-
|
8
|
-
attr_reader :channel, :to
|
9
|
-
|
10
|
-
def initialize(to:)
|
11
|
-
self.channel = 'voice'
|
12
|
-
self.to = to
|
13
|
-
end
|
14
|
-
|
15
|
-
def to=(to)
|
16
|
-
raise ArgumentError, "Invalid 'to' value #{to}. Expected to be in E.164 format" unless Phonelib.parse(to.to_i).valid?
|
17
|
-
@to = to
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_h
|
21
|
-
hash = Hash.new
|
22
|
-
self.instance_variables.each do |ivar|
|
23
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
24
|
-
end
|
25
|
-
hash
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_writer :channel
|
31
|
-
end
|
32
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
|
5
|
-
module Vonage
|
6
|
-
class Verify2::Channels::WhatsApp
|
7
|
-
|
8
|
-
attr_reader :channel, :to, :from
|
9
|
-
|
10
|
-
def initialize(to:, from:)
|
11
|
-
self.channel = 'whatsapp'
|
12
|
-
self.to = to
|
13
|
-
self.from = from
|
14
|
-
end
|
15
|
-
|
16
|
-
def to=(to)
|
17
|
-
raise ArgumentError, "Invalid 'to' value #{to}. Expected to be in E.164 format" unless Phonelib.parse(to.to_i).valid?
|
18
|
-
@to = to
|
19
|
-
end
|
20
|
-
|
21
|
-
def from=(from)
|
22
|
-
raise ArgumentError, "Invalid 'from' value #{from}. Length must be between 11 and 15 characters." unless from.length.between?(11, 15)
|
23
|
-
raise ArgumentError, "Invalid 'from' value #{from}. Expected to be in E.164 format" unless Phonelib.parse(from.to_i).valid?
|
24
|
-
@from = from
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_h
|
28
|
-
hash = Hash.new
|
29
|
-
self.instance_variables.each do |ivar|
|
30
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
31
|
-
end
|
32
|
-
hash
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
attr_writer :channel
|
38
|
-
end
|
39
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'phonelib'
|
4
|
-
|
5
|
-
module Vonage
|
6
|
-
class Verify2::Channels::WhatsAppInteractive
|
7
|
-
|
8
|
-
attr_reader :channel, :to
|
9
|
-
|
10
|
-
def initialize(to:)
|
11
|
-
self.channel = 'whatsapp_interactive'
|
12
|
-
self.to = to
|
13
|
-
end
|
14
|
-
|
15
|
-
def to=(to)
|
16
|
-
raise ArgumentError, "Invalid 'to' value #{to}. Expected to be in E.164 format" unless Phonelib.parse(to.to_i).valid?
|
17
|
-
@to = to
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_h
|
21
|
-
hash = Hash.new
|
22
|
-
self.instance_variables.each do |ivar|
|
23
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
24
|
-
end
|
25
|
-
hash
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
attr_writer :channel
|
31
|
-
end
|
32
|
-
end
|