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,63 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2::StartVerificationOptions
|
6
|
-
VALID_OPTS = [:locale, :channel_timeout, :client_ref, :code_length, :code, :fraud_check].freeze
|
7
|
-
|
8
|
-
MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT = [15, 900]
|
9
|
-
|
10
|
-
MIN_CODE_LENGTH, MAX_CODE_LENGTH = [4, 10]
|
11
|
-
|
12
|
-
attr_reader(*VALID_OPTS)
|
13
|
-
|
14
|
-
def initialize(**opts)
|
15
|
-
VALID_OPTS.each do |opt|
|
16
|
-
send("#{opt}=", opts[opt]) unless opts[opt].nil?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def locale=(locale)
|
21
|
-
@locale = locale
|
22
|
-
end
|
23
|
-
|
24
|
-
def channel_timeout=(channel_timeout)
|
25
|
-
raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be an integer" unless channel_timeout.is_a?(Integer)
|
26
|
-
unless channel_timeout.between?(MIN_CHANNEL_TIMEOUT, MAX_CHANNEL_TIMEOUT)
|
27
|
-
raise ArgumentError, "Invalid 'channel_timeout' #{channel_timeout}. Must be between #{MIN_CHANNEL_TIMEOUT} and #{MAX_CHANNEL_TIMEOUT} (inclusive)"
|
28
|
-
end
|
29
|
-
|
30
|
-
@channel_timeout = channel_timeout
|
31
|
-
end
|
32
|
-
|
33
|
-
def client_ref=(client_ref)
|
34
|
-
@client_ref = client_ref
|
35
|
-
end
|
36
|
-
|
37
|
-
def code_length=(code_length)
|
38
|
-
unless code_length.between?(MIN_CODE_LENGTH, MAX_CODE_LENGTH)
|
39
|
-
raise ArgumentError, "Invalid 'code_length' #{code_length}. Must be between #{MIN_CODE_LENGTH} and #{MAX_CODE_LENGTH} (inclusive)"
|
40
|
-
end
|
41
|
-
|
42
|
-
@code_length = code_length
|
43
|
-
end
|
44
|
-
|
45
|
-
def code=(code)
|
46
|
-
@code = code
|
47
|
-
end
|
48
|
-
|
49
|
-
def fraud_check=(fraud_check)
|
50
|
-
raise ArgumentError, "Invalid 'fraud_check' #{fraud_check}. Must be `false`" unless fraud_check == false
|
51
|
-
|
52
|
-
@fraud_check = fraud_check
|
53
|
-
end
|
54
|
-
|
55
|
-
def to_h
|
56
|
-
hash = Hash.new
|
57
|
-
self.instance_variables.each do |ivar|
|
58
|
-
hash[ivar.to_s.delete("@").to_sym] = self.instance_variable_get(ivar)
|
59
|
-
end
|
60
|
-
hash
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2::TemplateFragments < Namespace
|
6
|
-
CHANNELS = ['sms', 'voice'].freeze
|
7
|
-
|
8
|
-
self.authentication = BearerToken
|
9
|
-
|
10
|
-
self.request_body = JSON
|
11
|
-
|
12
|
-
# Get a list of of template fragments for a specific template.
|
13
|
-
#
|
14
|
-
# @example
|
15
|
-
# template_fragment_list = client.verify2.template_fragments.list(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
|
16
|
-
#
|
17
|
-
# @param [required, String] :template_id. The ID of the template for which to retreive the fragments
|
18
|
-
#
|
19
|
-
# @param [optional, Integer] :page_size. The amount of template fragments to list per page
|
20
|
-
#
|
21
|
-
# @param [optional, Integer] :page. The page number to retrieve
|
22
|
-
#
|
23
|
-
# @return [ListResponse]
|
24
|
-
#
|
25
|
-
# @see https://developer.vonage.com/en/api/verify.v2#listTemplateFragments
|
26
|
-
def list(template_id:, **params)
|
27
|
-
request("/v2/verify/templates/#{template_id}/template_fragments", params: params, response_class: ListResponse)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Get details of a specific template fragment.
|
31
|
-
#
|
32
|
-
# @example
|
33
|
-
# template_fragment = client.verify2.template_fragments.info(
|
34
|
-
# template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
|
35
|
-
# template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
|
36
|
-
# )
|
37
|
-
#
|
38
|
-
# @param [required, String] :template_id. The ID of the template for which to retreive the fragment
|
39
|
-
#
|
40
|
-
# @param [required, String] :template_fragment_id. The ID of the fragment to be retreived
|
41
|
-
#
|
42
|
-
# @return [Response]
|
43
|
-
#
|
44
|
-
# @see https://developer.vonage.com/en/api/verify.v2#getTemplateFragment
|
45
|
-
def info(template_id:, template_fragment_id:)
|
46
|
-
request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}")
|
47
|
-
end
|
48
|
-
|
49
|
-
# Create a new template fragment.
|
50
|
-
#
|
51
|
-
# @example
|
52
|
-
# client.verify2.template_fragments.create(
|
53
|
-
# template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
|
54
|
-
# channel: 'sms',
|
55
|
-
# locale: 'en-gb',
|
56
|
-
# text: 'Your code is: ${code}'
|
57
|
-
# )
|
58
|
-
#
|
59
|
-
# @param [required, String] :template_id. The ID of the template for which to create the fragment
|
60
|
-
#
|
61
|
-
# @param [required, String] :channel. The verification channel for which to create the fragment. Must be one of 'sms' or 'voice'
|
62
|
-
#
|
63
|
-
# @param [required, String] :locale. The locale for which to create the fragment.
|
64
|
-
#
|
65
|
-
# @param [required, String] :text. The text to be used in the template fragment.
|
66
|
-
# There are 4 reserved variables available to use as part of the text: ${code}, ${brand}, ${time-limit} and ${time-limit-unit}
|
67
|
-
#
|
68
|
-
# @return [Response]
|
69
|
-
#
|
70
|
-
# @see https://developer.vonage.com/en/api/verify.v2#addTemplateFragmentToTemplate
|
71
|
-
def create(template_id:, channel:, locale:, text:)
|
72
|
-
raise ArgumentError, "Invalid 'channel' #{channel}. Must be one of #{CHANNELS.join(', ')}" unless CHANNELS.include?(channel)
|
73
|
-
request(
|
74
|
-
"/v2/verify/templates/#{template_id}/template_fragments",
|
75
|
-
params: {
|
76
|
-
channel: channel,
|
77
|
-
locale: locale,
|
78
|
-
text: text
|
79
|
-
},
|
80
|
-
type: Post)
|
81
|
-
end
|
82
|
-
|
83
|
-
# Update an existing template fragment.
|
84
|
-
#
|
85
|
-
# @example
|
86
|
-
# client.verify2.template_fragments.update(
|
87
|
-
# template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
|
88
|
-
# template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19',
|
89
|
-
# text: 'Your one-time code is: ${code}'
|
90
|
-
# )
|
91
|
-
#
|
92
|
-
# @param [required, String] :template_id. The ID of the template with which the fragment to be updated is associated
|
93
|
-
#
|
94
|
-
# @param [required, String] :template_fragment_id. The ID of the fragment to be updated
|
95
|
-
#
|
96
|
-
# @param [required, String] :text. The text to be used in the template fragment.
|
97
|
-
# There are 4 reserved variables available to use as part of the text: ${code}, ${brand}, ${time-limit} and ${time-limit-unit}
|
98
|
-
#
|
99
|
-
# @return [Response]
|
100
|
-
#
|
101
|
-
# @see https://developer.vonage.com/en/api/verify.v2#updateTemplateFragment
|
102
|
-
def update(template_id:, template_fragment_id:, text:)
|
103
|
-
request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}", params: {text: text}, type: Patch)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Delete a template fragment.
|
107
|
-
#
|
108
|
-
# @example
|
109
|
-
# client.verify2.template_fragments.delete(
|
110
|
-
# template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
|
111
|
-
# template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
|
112
|
-
# )
|
113
|
-
#
|
114
|
-
# @param [required, String] :template_id. The ID of the template with which the fragment to be deleted is associated
|
115
|
-
#
|
116
|
-
# @param [required, String] :template_fragment_id. The ID of the fragment to be deleted
|
117
|
-
#
|
118
|
-
# @return [Response]
|
119
|
-
#
|
120
|
-
# @see https://developer.vonage.com/en/api/verify.v2#deleteTemplateFragment
|
121
|
-
def delete(template_id:, template_fragment_id:)
|
122
|
-
request("/v2/verify/templates/#{template_id}/template_fragments/#{template_fragment_id}", type: Delete)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2::Templates < Namespace
|
6
|
-
self.authentication = BearerToken
|
7
|
-
|
8
|
-
self.request_body = JSON
|
9
|
-
|
10
|
-
# Get a list of all templates.
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# template_list = client.verify2.templates.list
|
14
|
-
#
|
15
|
-
# @param [optional, Integer] :page_size. The amount of templates to list per page
|
16
|
-
#
|
17
|
-
# @param [optional, Integer] :page. The page number to retrieve
|
18
|
-
#
|
19
|
-
# @return [ListResponse]
|
20
|
-
#
|
21
|
-
# @see https://developer.vonage.com/en/api/verify.v2#listTemplates
|
22
|
-
def list(**params)
|
23
|
-
request('/v2/verify/templates', params: params, response_class: ListResponse)
|
24
|
-
end
|
25
|
-
|
26
|
-
# Get details of a specific template.
|
27
|
-
#
|
28
|
-
# @example
|
29
|
-
# template = client.verify2.templates.info(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
|
30
|
-
#
|
31
|
-
# @param [required, String] :template_id. The ID of the template to be retreived
|
32
|
-
#
|
33
|
-
# @return [Response]
|
34
|
-
#
|
35
|
-
# @see https://developer.vonage.com/en/api/verify.v2#getTemplate
|
36
|
-
def info(template_id:)
|
37
|
-
request('/v2/verify/templates/' + template_id)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Create a new template.
|
41
|
-
#
|
42
|
-
# @example
|
43
|
-
# client.verify2.templates.create(name: 'my-template')
|
44
|
-
#
|
45
|
-
# @param [required, String] :name. The name of the template. The following characters are permitted: [A-Z a-z 0-9 _ -]
|
46
|
-
#
|
47
|
-
# @return [Response]
|
48
|
-
#
|
49
|
-
# @see https://developer.vonage.com/en/api/verify.v2#createTemplate
|
50
|
-
def create(name:)
|
51
|
-
request('/v2/verify/templates', params: { name: name }, type: Post)
|
52
|
-
end
|
53
|
-
|
54
|
-
# Update an existing template.
|
55
|
-
#
|
56
|
-
# @example
|
57
|
-
# client.verify2.templates.update(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9', name: 'my-updated-template')
|
58
|
-
#
|
59
|
-
# @param [required, String] :template_id. The ID of the template to be updated
|
60
|
-
#
|
61
|
-
# @param [optional, String] :name. The name of the template. The following characters are permitted: [A-Z a-z 0-9 _ -]
|
62
|
-
#
|
63
|
-
# @param [optional, Boolean] :is_default. Whether the template is the default template for a specific locale/channel combination
|
64
|
-
#
|
65
|
-
# @return [Response]
|
66
|
-
#
|
67
|
-
# @see https://developer.vonage.com/en/api/verify.v2#updateTemplate
|
68
|
-
def update(template_id:, **params)
|
69
|
-
request('/v2/verify/templates/' + template_id, params: params, type: Patch)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Delete a template.
|
73
|
-
#
|
74
|
-
# @example
|
75
|
-
# client.verify2.templates.delete(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
|
76
|
-
#
|
77
|
-
# @param [required, String] :template_id. The ID of the template to be deleted
|
78
|
-
#
|
79
|
-
# @return [Response]
|
80
|
-
#
|
81
|
-
# @see https://developer.vonage.com/en/api/verify.v2#deleteTemplate
|
82
|
-
def delete(template_id:)
|
83
|
-
request('/v2/verify/templates/' + template_id, type: Delete)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2::Workflow
|
6
|
-
CHANNELS = {
|
7
|
-
sms: Verify2::Channels::SMS,
|
8
|
-
whatsapp: Verify2::Channels::WhatsApp,
|
9
|
-
whatsapp_interactive: Verify2::Channels::WhatsAppInteractive,
|
10
|
-
voice: Verify2::Channels::Voice,
|
11
|
-
email: Verify2::Channels::Email,
|
12
|
-
silent_auth: Verify2::Channels::SilentAuth
|
13
|
-
}
|
14
|
-
|
15
|
-
CHANNELS.keys.each do |method|
|
16
|
-
define_method method do |attributes|
|
17
|
-
CHANNELS[method].new(**attributes)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.method_missing(method)
|
22
|
-
raise ClientError.new("Workflow channel must be one of the valid options. Please refer to https://developer.vonage.com/en/api/verify.v2#newRequest for a complete list.")
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_reader :list
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@list = []
|
29
|
-
end
|
30
|
-
|
31
|
-
def <<(workflow)
|
32
|
-
list << workflow
|
33
|
-
end
|
34
|
-
|
35
|
-
def hashified_list
|
36
|
-
list.map(&:to_h)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2::WorkflowBuilder
|
6
|
-
|
7
|
-
def self.build
|
8
|
-
builder = self.new
|
9
|
-
yield builder if block_given?
|
10
|
-
builder.workflow
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_reader :workflow
|
14
|
-
|
15
|
-
def initialize
|
16
|
-
@workflow = Vonage::Verify2::Workflow.new
|
17
|
-
end
|
18
|
-
|
19
|
-
Vonage::Verify2::Workflow::CHANNELS.keys.each do |channel|
|
20
|
-
define_method "add_#{channel.to_s}" do |args|
|
21
|
-
workflow << workflow.send(channel, **args)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/vonage/verify2.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Verify2 < Namespace
|
6
|
-
self.authentication = BearerToken
|
7
|
-
|
8
|
-
self.request_body = JSON
|
9
|
-
|
10
|
-
# Request a verification be sent to a user.
|
11
|
-
#
|
12
|
-
# @example
|
13
|
-
# verification_request = client.verify2.start_verification(
|
14
|
-
# brand: 'Acme',
|
15
|
-
# workflow: [{channel: 'sms', to: '447000000000'}],
|
16
|
-
# code_length: 6
|
17
|
-
# )
|
18
|
-
#
|
19
|
-
# @param [required, String] :brand The brand that is sending the verification request
|
20
|
-
# - Must be between 1 and 16 characters in length
|
21
|
-
#
|
22
|
-
# @param [required, Array<Hash>] :workflow An array of hashes for channels in the workflow
|
23
|
-
#
|
24
|
-
# @param [optional, Hash] opts the options for the verification request.
|
25
|
-
# @option opts [Integer] :code_length The length of the one-time code provided to the end-user
|
26
|
-
# @option opts [String] :code An optional alphanumeric custom code to use instead of an auto-generated code
|
27
|
-
# @option opts [String] :locale The language to use for the verification message (where applicable)
|
28
|
-
# @option opts [Integer] :channel_timeout Wait time in seconds before trying the next channel in the workflow
|
29
|
-
# @option opts [String] :client_ref Reference to be included in callbacks
|
30
|
-
# @option opts [Boolean] If used, must be set to `false`. Will bypass a network block for a single Verify V2 request
|
31
|
-
#
|
32
|
-
# @return Vonage::Response
|
33
|
-
# @see https://developer.vonage.com/en/api/verify.v2#newRequest
|
34
|
-
#
|
35
|
-
def start_verification(brand:, workflow:, **opts)
|
36
|
-
raise ArgumentError, ':brand must be a String' unless brand.is_a?(String)
|
37
|
-
raise ArgumentError, "Invalid 'brand' value #{brand}. Length must be between 1 and 16 characters." unless brand.length.between?(1, 16)
|
38
|
-
raise ArgumentError, ':workflow must be an Array' unless workflow.is_a?(Array)
|
39
|
-
raise ArgumentError, ':workflow must not be empty' if workflow.empty?
|
40
|
-
|
41
|
-
request('/v2/verify/', params: opts.merge(brand: brand, workflow: workflow), type: Post)
|
42
|
-
end
|
43
|
-
|
44
|
-
# Check a supplied code against a request to see if it is valid.
|
45
|
-
#
|
46
|
-
# @example
|
47
|
-
# code_check = client.verify2.check_code(request_id: '7e8c5965-0a3f-44df-8a14-f1486209d8a2', code: '1234')
|
48
|
-
#
|
49
|
-
# @param [required, String] :request_id The request_id of the verification request being checked
|
50
|
-
#
|
51
|
-
# @param [required, String] :code The code supplied to the end-user by the verification request
|
52
|
-
#
|
53
|
-
# @see https://developer.vonage.com/en/api/verify.v2#checkCode
|
54
|
-
#
|
55
|
-
def check_code(request_id:, code:)
|
56
|
-
request('/v2/verify/' + request_id, params: {code: code}, type: Post)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Cancel a verifiction. If a verification request is still active, calling this method aborts the workflow.
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# client.verify2.cancel_verification_request(request_id: '7e8c5965-0a3f-44df-8a14-f1486209d8a2')
|
63
|
-
#
|
64
|
-
# @param [required, String] :request_id The request_id of the verification request to be cancelled
|
65
|
-
#
|
66
|
-
# @see https://developer.vonage.com/en/api/verify.v2#cancelRequest
|
67
|
-
#
|
68
|
-
def cancel_verification_request(request_id:)
|
69
|
-
request('/v2/verify/' + request_id, type: Delete)
|
70
|
-
end
|
71
|
-
|
72
|
-
def next_workflow(request_id:)
|
73
|
-
request('/v2/verify/' + request_id + '/next-workflow', type: Post)
|
74
|
-
end
|
75
|
-
|
76
|
-
# Instantiate a new Vonage::Verify2::StartVerificationOptions object
|
77
|
-
#
|
78
|
-
# @param [optional, Hash] opts the options for the verification request.
|
79
|
-
# @option opts [Integer] :code_length The length of the one-time code provided to the end-user
|
80
|
-
# @option opts [String] :code An optional alphanumeric custom code to use instead of an auto-generated code
|
81
|
-
# @option opts [String] :locale The language to use for the verification message (where applicable)
|
82
|
-
# @option opts [Integer] :channel_timeout Wait time in seconds before trying the next channel in the workflow
|
83
|
-
# @option opts [String] :client_ref Reference to be included in callbacks
|
84
|
-
# @option opts [Boolean] If used, must be set to `false`. Will bypass a network block for a single Verify V2 request
|
85
|
-
#
|
86
|
-
def start_verification_options(**opts)
|
87
|
-
StartVerificationOptions.new(**opts)
|
88
|
-
end
|
89
|
-
|
90
|
-
# Instantiate a new Vonage::Verify2::Workflow object
|
91
|
-
def workflow
|
92
|
-
Workflow.new
|
93
|
-
end
|
94
|
-
|
95
|
-
# Return the Vonage::Verify2::WorkflowBuilder class
|
96
|
-
def workflow_builder
|
97
|
-
WorkflowBuilder.itself
|
98
|
-
end
|
99
|
-
|
100
|
-
# @return [Templates]
|
101
|
-
# Returns existing or instantiates a new Vonage::Verify2::Templates object
|
102
|
-
def templates
|
103
|
-
@templates ||= Templates.new(@config)
|
104
|
-
end
|
105
|
-
|
106
|
-
# @return [TemplateFragments]
|
107
|
-
# Returns existing or instantiates a new Vonage::Verify2::Templates object
|
108
|
-
def template_fragments
|
109
|
-
@template_fragments ||= TemplateFragments.new(@config)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Video::Broadcasts < Namespace
|
6
|
-
include Keys
|
7
|
-
|
8
|
-
self.authentication = BearerToken
|
9
|
-
|
10
|
-
self.request_body = JSON
|
11
|
-
|
12
|
-
self.host = :video_host
|
13
|
-
|
14
|
-
# Get a list of live streaming broadcasts for a specified Vonage application.
|
15
|
-
#
|
16
|
-
def list(**params)
|
17
|
-
path = '/v2/project/' + @config.application_id + '/broadcast'
|
18
|
-
path += "?#{Params.encode(camelcase(params))}" unless params.empty?
|
19
|
-
|
20
|
-
request(path, response_class: ListResponse)
|
21
|
-
end
|
22
|
-
|
23
|
-
# Return information for specified broadcast.
|
24
|
-
#
|
25
|
-
def info(broadcast_id:)
|
26
|
-
request('/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Start a new live streaming broadcast.
|
30
|
-
#
|
31
|
-
def start(session_id:, **params)
|
32
|
-
request(
|
33
|
-
'/v2/project/' + @config.application_id + '/broadcast',
|
34
|
-
params: camelcase(params.merge(session_id: session_id)),
|
35
|
-
type: Post
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Stop a specified broadcast.
|
40
|
-
#
|
41
|
-
def stop(broadcast_id:)
|
42
|
-
request('/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/stop', type: Post)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Add a stream to a live streaming broadcast.
|
46
|
-
#
|
47
|
-
|
48
|
-
def add_stream(broadcast_id:, stream_id:, **params)
|
49
|
-
request(
|
50
|
-
'/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/streams',
|
51
|
-
params: camelcase(params.merge(addStream: stream_id)),
|
52
|
-
type: Patch
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
# Remove a stream from a live streaming broadcast.
|
57
|
-
#
|
58
|
-
def remove_stream(broadcast_id:, stream_id:)
|
59
|
-
request(
|
60
|
-
'/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/streams',
|
61
|
-
params: {removeStream: stream_id},
|
62
|
-
type: Patch
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
# Dynamically change layout of a broadcast.
|
67
|
-
#
|
68
|
-
def change_layout(broadcast_id:, **params)
|
69
|
-
request(
|
70
|
-
'/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/layout',
|
71
|
-
params: camelcase(params),
|
72
|
-
type: Put)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
module Vonage
|
5
|
-
class Video::Captions < Namespace
|
6
|
-
include Keys
|
7
|
-
|
8
|
-
self.authentication = BearerToken
|
9
|
-
|
10
|
-
self.request_body = JSON
|
11
|
-
|
12
|
-
self.host = :video_host
|
13
|
-
|
14
|
-
# Start Live Captions for a Vonage Video stream
|
15
|
-
#
|
16
|
-
# @example
|
17
|
-
# response = client.video.captions.start(
|
18
|
-
# session_id: "12312312-3811-4726-b508-e41a0f96c68f",
|
19
|
-
# token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
|
20
|
-
# language_code: 'en-US',
|
21
|
-
# max_duration: 300,
|
22
|
-
# partial_captions: false,
|
23
|
-
# status_callback_url: 'https://example.com/captions/status'
|
24
|
-
# )
|
25
|
-
#
|
26
|
-
# @params [required, String] :session_id The id of the session to start captions for
|
27
|
-
#
|
28
|
-
# @param [required, String] :token A valid Vonage Video token with role set to 'moderator'
|
29
|
-
#
|
30
|
-
# @params [optional, String] :language_code The BCP-47 code for a spoken language used on this call. The default value is "en-US"
|
31
|
-
# - Must be one of: 'en-US', 'en-AU', 'en-GB', 'zh-CN', 'fr-FR', 'fr-CA', 'de-DE', 'hi-IN', 'it-IT', 'ja-JP', 'ko-KR', 'pt-BR', 'th-TH'
|
32
|
-
#
|
33
|
-
# @param [optional, Integer] :max_duration The maximum duration for the audio captioning, in seconds.
|
34
|
-
# - The default value is 14,400 seconds (4 hours), the maximum duration allowed.
|
35
|
-
# - The minimum value for maxDuration is 300 (300 seconds, or 5 minutes).
|
36
|
-
#
|
37
|
-
# @param [optional, Boolean] :partial_captions Whether to enable this to faster captioning (true, the default) at the cost of some degree of inaccuracies.
|
38
|
-
#
|
39
|
-
# @param [optional, String] :status_callback_url The URL to send the status of the captions to.
|
40
|
-
#
|
41
|
-
# @return [Response]
|
42
|
-
#
|
43
|
-
# @see TODO: Add document link here
|
44
|
-
#
|
45
|
-
def start(session_id:, token:, **params)
|
46
|
-
request(
|
47
|
-
'/v2/project/' + @config.application_id + '/captions',
|
48
|
-
params: camelcase(params.merge({sessionId: session_id, token: token})),
|
49
|
-
type: Post)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Stop live captions for a session
|
53
|
-
#
|
54
|
-
# @example
|
55
|
-
# response = client.video.captions.stop(captions_id: "7c0580fc-6274-4de5-a66f-d0648e8d3ac3")
|
56
|
-
#
|
57
|
-
# @params [required, String] :captions_id ID of the connection used for captions
|
58
|
-
#
|
59
|
-
# @return [Response]
|
60
|
-
#
|
61
|
-
# @see TODO: Add document link here
|
62
|
-
#
|
63
|
-
def stop(captions_id:)
|
64
|
-
request('/v2/project/' + @config.application_id + '/captions/' + captions_id + '/stop', type: Post)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|