vonage 7.23.0 → 7.25.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/keys.rb +6 -1
- data/lib/vonage/messaging.rb +8 -3
- data/lib/vonage/verify2/channels/sms.rb +10 -0
- data/lib/vonage/verify2/channels/whats_app.rb +1 -0
- data/lib/vonage/verify2.rb +3 -0
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/video/captions.rb +67 -0
- data/lib/vonage/video/renders/list_response.rb +11 -0
- data/lib/vonage/video/renders.rb +107 -0
- data/lib/vonage/video/web_socket.rb +61 -0
- data/lib/vonage/video.rb +19 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508c457f8278aae1d8cc3951a8b4c38423ab63307917c4bbc09960f45cbafa9f
|
4
|
+
data.tar.gz: '00329df94f3ab44d6ab8d2552931438358f92ad59c121db87e1668bd1c336814'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80d9743779edc4dca5c4c9babb6a8591d616e4ac2f393ca4932a5a8640574561b28c61c803dc7c397c99221f0a086bd4604f62e8b36b97c7fd2b7da85ddc88d0
|
7
|
+
data.tar.gz: 40756daa0add532dead58f6d7d057e5bfc8f5d39a9bd84515bcdc08f9a6686eb983b6859f45b71fde9e11b8f474dbecb8a2973ff7270fe8256d813e281783341
|
data/lib/vonage/keys.rb
CHANGED
@@ -29,7 +29,12 @@ module Vonage
|
|
29
29
|
'screenshare_type',
|
30
30
|
'session_id',
|
31
31
|
'stream_mode',
|
32
|
-
'archive_mode'
|
32
|
+
'archive_mode',
|
33
|
+
'language_code',
|
34
|
+
'max_duration',
|
35
|
+
'partial_captions',
|
36
|
+
'status_callback_url',
|
37
|
+
'audio_rate'
|
33
38
|
]
|
34
39
|
hash.transform_keys do |k|
|
35
40
|
if exceptions.include?(k.to_s)
|
data/lib/vonage/messaging.rb
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
# typed: true
|
2
2
|
# frozen_string_literal: true
|
3
|
+
require 'forwardable'
|
3
4
|
|
4
5
|
module Vonage
|
5
6
|
class Messaging < Namespace
|
7
|
+
extend Forwardable
|
8
|
+
|
6
9
|
self.authentication = BearerToken
|
7
10
|
|
8
11
|
self.request_body = JSON
|
9
12
|
|
13
|
+
def_delegators Message, *Message::CHANNELS.keys
|
14
|
+
|
10
15
|
# Send a Message.
|
11
16
|
#
|
12
17
|
# @example
|
13
|
-
# message =
|
18
|
+
# message = client.messaging.sms(message: "Hello world!")
|
14
19
|
# response = client.messaging.send(to: "447700900000", from: "447700900001", **message)
|
15
20
|
#
|
16
21
|
# @option params [required, String] :to
|
@@ -22,8 +27,8 @@ module Vonage
|
|
22
27
|
#
|
23
28
|
# @see https://developer.vonage.com/api/messages-olympus#SendMessage
|
24
29
|
#
|
25
|
-
def send(
|
26
|
-
request('/v1/messages', params:
|
30
|
+
def send(to:, from:, **message)
|
31
|
+
request('/v1/messages', params: {to: to, from: from, **message}, type: Post)
|
27
32
|
end
|
28
33
|
|
29
34
|
# Validate a JSON Web Token from a Messages API Webhook.
|
@@ -20,6 +20,7 @@ module Vonage
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def from=(from)
|
23
|
+
validate_from(from)
|
23
24
|
@from = from
|
24
25
|
end
|
25
26
|
|
@@ -49,5 +50,14 @@ module Vonage
|
|
49
50
|
private
|
50
51
|
|
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
|
52
62
|
end
|
53
63
|
end
|
@@ -19,6 +19,7 @@ module Vonage
|
|
19
19
|
end
|
20
20
|
|
21
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)
|
22
23
|
raise ArgumentError, "Invalid 'from' value #{from}. Expected to be in E.164 format" unless Phonelib.parse(from.to_i).valid?
|
23
24
|
@from = from
|
24
25
|
end
|
data/lib/vonage/verify2.rb
CHANGED
@@ -17,6 +17,7 @@ module Vonage
|
|
17
17
|
# )
|
18
18
|
#
|
19
19
|
# @param [required, String] :brand The brand that is sending the verification request
|
20
|
+
# - Must be between 1 and 16 characters in length
|
20
21
|
#
|
21
22
|
# @param [required, Array<Hash>] :workflow An array of hashes for channels in the workflow
|
22
23
|
#
|
@@ -32,6 +33,8 @@ module Vonage
|
|
32
33
|
# @see https://developer.vonage.com/en/api/verify.v2#newRequest
|
33
34
|
#
|
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)
|
35
38
|
raise ArgumentError, ':workflow must be an Array' unless workflow.is_a?(Array)
|
36
39
|
raise ArgumentError, ':workflow must not be empty' if workflow.empty?
|
37
40
|
|
data/lib/vonage/version.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
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
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class Video::Renders < Namespace
|
6
|
+
include Keys
|
7
|
+
|
8
|
+
self.authentication = BearerToken
|
9
|
+
|
10
|
+
self.request_body = JSON
|
11
|
+
|
12
|
+
self.host = :video_host
|
13
|
+
|
14
|
+
# Start an Experience Composer Render
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# response = client.video.renders.start(
|
18
|
+
# session_id: "12312312-3811-4726-b508-e41a0f96c68f",
|
19
|
+
# token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
|
20
|
+
# url: 'https://example.com/',
|
21
|
+
# max_duration: 1800,
|
22
|
+
# resolution: '1280x720',
|
23
|
+
# properties: {
|
24
|
+
# name: 'foo'
|
25
|
+
# }
|
26
|
+
# )
|
27
|
+
#
|
28
|
+
# @params [required, String] :session_id The session ID of the Vonage Video session you are working with.
|
29
|
+
#
|
30
|
+
# @param [required, String] :token A valid OpenTok JWT token with a Publisher role and (optionally) connection data to be associated with the output stream.
|
31
|
+
#
|
32
|
+
# @params [required, String] :url A publicly reachable URL controlled by the customer and capable of generating the content to be rendered without user intervention.
|
33
|
+
#
|
34
|
+
# @params [optional, Integer] :max_duration The maximum duration of the rendered video in seconds.
|
35
|
+
# - After this time, it is stopped automatically, if it is still running.
|
36
|
+
# - Min: 60
|
37
|
+
# - Max: 3600
|
38
|
+
# - Default: 3600
|
39
|
+
#
|
40
|
+
# @params [optional, String] :resolution The resolution of the Experience Composer render.
|
41
|
+
# - Must be one of: '640x480', '480x640', '1280x720', '720x1280', '1080x1920', '1920x1080'
|
42
|
+
#
|
43
|
+
# @params [optional, Hash] :properties The initial configuration of Publisher properties for the composed output stream.
|
44
|
+
# @option properties [required, String] :name The name of the composed output stream which is published to the session.
|
45
|
+
#
|
46
|
+
# @return [Response]
|
47
|
+
#
|
48
|
+
# @see TODO: Add document link here
|
49
|
+
#
|
50
|
+
def start(session_id:, token:, url:, **params)
|
51
|
+
request(
|
52
|
+
'/v2/project/' + @config.application_id + '/render',
|
53
|
+
params: camelcase(params.merge({sessionId: session_id, token: token, url: url})),
|
54
|
+
type: Post)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Stop an Experience Composer render
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# response = client.video.renders.stop(experience_composer_id: "1248e7070b81464c9789f46ad10e7764")
|
61
|
+
#
|
62
|
+
# @params [required, String] :experience_composer_id ID of the Experience Composer instance that you want to stop.
|
63
|
+
#
|
64
|
+
# @return [Response]
|
65
|
+
#
|
66
|
+
# @see TODO: Add document link here
|
67
|
+
#
|
68
|
+
def stop(experience_composer_id:)
|
69
|
+
request('/v2/project/' + @config.application_id + '/render/' + experience_composer_id, type: Delete)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get information about an Experience Composer session
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# response = client.video.renders.info(experience_composer_id: "1248e7070b81464c9789f46ad10e7764")
|
76
|
+
#
|
77
|
+
# @params [required, String] :experience_composer_id ID of the Experience Composer instance for which you are requesitng information.
|
78
|
+
#
|
79
|
+
# @return [Response]
|
80
|
+
#
|
81
|
+
# @see TODO: Add document link here
|
82
|
+
#
|
83
|
+
def info(experience_composer_id:)
|
84
|
+
request('/v2/project/' + @config.application_id + '/render/' + experience_composer_id)
|
85
|
+
end
|
86
|
+
|
87
|
+
# List all Experience Composer renders in an application
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# response = client.video.renders.list
|
91
|
+
#
|
92
|
+
# @params [optional, Integer] :offset Specify the index offset of the first experience composer. 0 is offset of the most recently started render.
|
93
|
+
#
|
94
|
+
# @params [optional, Integer] :count Limit the number of experience composers to be returned.
|
95
|
+
#
|
96
|
+
# @return [Video::Renders::ListResponse]
|
97
|
+
#
|
98
|
+
# @see TODO: Add document link here
|
99
|
+
#
|
100
|
+
def list(**params)
|
101
|
+
path = '/v2/project/' + @config.application_id + '/render'
|
102
|
+
path += "?#{Params.encode(camelcase(params))}" unless params.empty?
|
103
|
+
|
104
|
+
request(path, response_class: ListResponse)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class Video::WebSocket < Namespace
|
6
|
+
include Keys
|
7
|
+
|
8
|
+
self.authentication = BearerToken
|
9
|
+
|
10
|
+
self.request_body = JSON
|
11
|
+
|
12
|
+
self.host = :video_host
|
13
|
+
|
14
|
+
# Start an audio connector websocket connection
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# response = client.video.web_socket.connect(
|
18
|
+
# session_id: "12312312-3811-4726-b508-e41a0f96c68f",
|
19
|
+
# token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
|
20
|
+
# websocket: {
|
21
|
+
# uri: 'wss://example.com/ws-endpoint',
|
22
|
+
# streams: ["8b732909-0a06-46a2-8ea8-074e64d43422"],
|
23
|
+
# headers: { property1: 'foo', property2: 'bar' },
|
24
|
+
# audio_rate: 16000
|
25
|
+
# }
|
26
|
+
# )
|
27
|
+
#
|
28
|
+
# @params [required, String] :session_id The Vonage Video session ID that includes the Vonage Video streams you want to include in the WebSocket stream.
|
29
|
+
# - The Audio Connector feature is only supported in routed sessions
|
30
|
+
#
|
31
|
+
# @param [required, String] :token A valid Vonage Video token for the Audio Connector connection to the Vonage Video Session.
|
32
|
+
# - You can add additional data to the JWT to identify that the connection is the Audio Connector endpoint or for any other identifying data.
|
33
|
+
#
|
34
|
+
# @params [required, Hash] :websocket The WebSocket configuration for the Audio Connector connection.
|
35
|
+
# @option websocket [required, String] :uri A publicly reachable WebSocket URI to be used for the destination of the audio stream
|
36
|
+
# @option websocket [optional, String] :streams An array of stream IDs for the Vonage Video streams you want to include in the WebSocket audio.
|
37
|
+
# - If you omit this property, all streams in the session will be included.
|
38
|
+
# @option websocket [optional, Hash] :headers An object of key-value pairs of headers to be sent to your WebSocket server with each message, with a maximum length of 512 bytes.
|
39
|
+
# @option websocket [optional, Integer] :audio_rate A number representing the audio sampling rate in Hz
|
40
|
+
# - Must be one of: 8000, 16000
|
41
|
+
#
|
42
|
+
# @return [Response]
|
43
|
+
#
|
44
|
+
# @see TODO: Add document link here
|
45
|
+
#
|
46
|
+
def connect(session_id:, token:, websocket:)
|
47
|
+
raise ArgumentError, 'websocket must be a Hash' unless websocket.is_a?(Hash)
|
48
|
+
raise ArgumentError, 'websocket must contain a uri' unless websocket.key?(:uri)
|
49
|
+
|
50
|
+
request(
|
51
|
+
'/v2/project/' + @config.application_id + '/connect',
|
52
|
+
params: {
|
53
|
+
sessionId: session_id,
|
54
|
+
token: token,
|
55
|
+
websocket: camelcase(websocket)
|
56
|
+
},
|
57
|
+
type: Post
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/vonage/video.rb
CHANGED
@@ -54,6 +54,9 @@ module Vonage
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def generate_client_token(session_id:, scope: 'session.connect', role: 'publisher', **params)
|
57
|
+
valid_roles = %w[publisher subscriber moderator publisheronly]
|
58
|
+
raise ArgumentError, "Invalid role: #{role}" unless valid_roles.include?(role)
|
59
|
+
|
57
60
|
claims = {
|
58
61
|
application_id: @config.application_id,
|
59
62
|
scope: scope,
|
@@ -104,6 +107,22 @@ module Vonage
|
|
104
107
|
@streams ||= Streams.new(@config)
|
105
108
|
end
|
106
109
|
|
110
|
+
# @return [Captions]
|
111
|
+
#
|
112
|
+
def captions
|
113
|
+
@captions ||= Captions.new(@config)
|
114
|
+
end
|
115
|
+
|
116
|
+
# @return [Renders]
|
117
|
+
#
|
118
|
+
def renders
|
119
|
+
@renders ||= Renders.new(@config)
|
120
|
+
end
|
107
121
|
|
122
|
+
# @return [WebSocket]
|
123
|
+
#
|
124
|
+
def web_socket
|
125
|
+
@web_socket ||= WebSocket.new(@config)
|
126
|
+
end
|
108
127
|
end
|
109
128
|
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.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vonage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vonage-jwt
|
@@ -240,11 +240,15 @@ files:
|
|
240
240
|
- lib/vonage/video/archives/list_response.rb
|
241
241
|
- lib/vonage/video/broadcasts.rb
|
242
242
|
- lib/vonage/video/broadcasts/list_response.rb
|
243
|
+
- lib/vonage/video/captions.rb
|
243
244
|
- lib/vonage/video/moderation.rb
|
245
|
+
- lib/vonage/video/renders.rb
|
246
|
+
- lib/vonage/video/renders/list_response.rb
|
244
247
|
- lib/vonage/video/signals.rb
|
245
248
|
- lib/vonage/video/sip.rb
|
246
249
|
- lib/vonage/video/streams.rb
|
247
250
|
- lib/vonage/video/streams/list_response.rb
|
251
|
+
- lib/vonage/video/web_socket.rb
|
248
252
|
- lib/vonage/voice.rb
|
249
253
|
- lib/vonage/voice/actions/connect.rb
|
250
254
|
- lib/vonage/voice/actions/conversation.rb
|
@@ -283,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
287
|
- !ruby/object:Gem::Version
|
284
288
|
version: '0'
|
285
289
|
requirements: []
|
286
|
-
rubygems_version: 3.5.
|
290
|
+
rubygems_version: 3.5.11
|
287
291
|
signing_key:
|
288
292
|
specification_version: 4
|
289
293
|
summary: This is the Ruby Server SDK for Vonage APIs. To use it you'll need a Vonage
|