vonage 7.21.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/README.md +1 -0
- data/lib/vonage/client.rb +9 -0
- data/lib/vonage/conversation/event/list_response.rb +11 -0
- data/lib/vonage/conversation/event.rb +108 -0
- data/lib/vonage/conversation/list_response.rb +11 -0
- data/lib/vonage/conversation/member/list_response.rb +11 -0
- data/lib/vonage/conversation/member.rb +134 -0
- data/lib/vonage/conversation/user/conversations_list_response.rb +11 -0
- data/lib/vonage/conversation/user/sessions_list_response.rb +11 -0
- data/lib/vonage/conversation/user.rb +67 -0
- data/lib/vonage/conversation.rb +164 -0
- data/lib/vonage/conversations/events.rb +12 -0
- data/lib/vonage/conversations/legs.rb +6 -0
- data/lib/vonage/conversations/members.rb +15 -0
- data/lib/vonage/conversations/users.rb +15 -0
- data/lib/vonage/conversations.rb +30 -0
- 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 +3 -2
- data/lib/vonage/verify2.rb +7 -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 +16 -3
@@ -9,6 +9,8 @@ module Vonage
|
|
9
9
|
|
10
10
|
# Create a member.
|
11
11
|
#
|
12
|
+
# @deprecated Please use {Vonage::Conversation::Member#create} instead
|
13
|
+
#
|
12
14
|
# @option params [String] :action
|
13
15
|
# Invite or join a member to a conversation.
|
14
16
|
# Must be one of: `invite` or `join`.
|
@@ -40,11 +42,14 @@ module Vonage
|
|
40
42
|
# @see https://developer.nexmo.com/api/conversation#createMember
|
41
43
|
#
|
42
44
|
def create(conversation_id, params)
|
45
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#create` instead.')
|
43
46
|
request('/beta/conversations/' + conversation_id + '/members', params: params, type: Post)
|
44
47
|
end
|
45
48
|
|
46
49
|
# List members.
|
47
50
|
#
|
51
|
+
# @deprecated Please use {Vonage::Conversation::Member#list} instead
|
52
|
+
#
|
48
53
|
# @param [String] conversation_id
|
49
54
|
#
|
50
55
|
# @option params [Boolean] :auto_advance
|
@@ -56,11 +61,14 @@ module Vonage
|
|
56
61
|
# @see https://developer.nexmo.com/api/conversation#getMembers
|
57
62
|
#
|
58
63
|
def list(conversation_id, params = nil, auto_advance = true)
|
64
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#list` instead.')
|
59
65
|
request('/beta/conversations/' + conversation_id + '/members', params: params)
|
60
66
|
end
|
61
67
|
|
62
68
|
# Retrieve a member.
|
63
69
|
#
|
70
|
+
# @deprecated Please use {Vonage::Conversation::Member#find} instead
|
71
|
+
#
|
64
72
|
# @param [String] conversation_id
|
65
73
|
# @param [String] member_id
|
66
74
|
#
|
@@ -69,11 +77,14 @@ module Vonage
|
|
69
77
|
# @see https://developer.nexmo.com/api/conversation#getMember
|
70
78
|
#
|
71
79
|
def get(conversation_id, member_id)
|
80
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#find` instead.')
|
72
81
|
request('/beta/conversations/' + conversation_id + '/members/' + member_id)
|
73
82
|
end
|
74
83
|
|
75
84
|
# Update a member.
|
76
85
|
#
|
86
|
+
# @deprecated Please use {Vonage::Conversation::Member#update} instead
|
87
|
+
#
|
77
88
|
# @option params [String] :action
|
78
89
|
# Invite or join a member to a conversation.
|
79
90
|
#
|
@@ -89,11 +100,14 @@ module Vonage
|
|
89
100
|
# @see https://developer.nexmo.com/api/conversation#updateMember
|
90
101
|
#
|
91
102
|
def update(conversation_id, member_id, params)
|
103
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation::Member#update` instead.')
|
92
104
|
request('/beta/conversations/' + conversation_id + '/members/' + member_id, params: params, type: Put)
|
93
105
|
end
|
94
106
|
|
95
107
|
# Delete a member.
|
96
108
|
#
|
109
|
+
# @deprecated
|
110
|
+
#
|
97
111
|
# @param [String] conversation_id
|
98
112
|
# @param [String] member_id
|
99
113
|
#
|
@@ -102,6 +116,7 @@ module Vonage
|
|
102
116
|
# @see https://developer.nexmo.com/api/conversation#deleteMember
|
103
117
|
#
|
104
118
|
def delete(conversation_id, member_id)
|
119
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
105
120
|
request('/beta/conversations/' + conversation_id + '/members/' + member_id, type: Delete)
|
106
121
|
end
|
107
122
|
end
|
@@ -9,6 +9,8 @@ module Vonage
|
|
9
9
|
|
10
10
|
# Create a user.
|
11
11
|
#
|
12
|
+
# @deprecated Please use {Vonage::Users#create} instead
|
13
|
+
#
|
12
14
|
# @option params [String] :name
|
13
15
|
# Unique name for a user.
|
14
16
|
#
|
@@ -26,11 +28,14 @@ module Vonage
|
|
26
28
|
# @see https://developer.nexmo.com/api/conversation#createUser
|
27
29
|
#
|
28
30
|
def create(params)
|
31
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#create` instead.')
|
29
32
|
request('/beta/users', params: params, type: Post)
|
30
33
|
end
|
31
34
|
|
32
35
|
# List users.
|
33
36
|
#
|
37
|
+
# @deprecated Please use {Vonage::Users#list} instead
|
38
|
+
#
|
34
39
|
# @option params [Boolean] :auto_advance
|
35
40
|
# Set this to `false` to not auto-advance through all the pages in the record
|
36
41
|
# and collect all the data. The default is `true`.
|
@@ -40,11 +45,14 @@ module Vonage
|
|
40
45
|
# @see https://developer.nexmo.com/api/conversation#getUsers
|
41
46
|
#
|
42
47
|
def list(params = nil, auto_advance = true)
|
48
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#list` instead.')
|
43
49
|
request('/beta/users', params: params)
|
44
50
|
end
|
45
51
|
|
46
52
|
# Retrieve a user.
|
47
53
|
#
|
54
|
+
# @deprecated Please use {Vonage::Users#find} instead
|
55
|
+
#
|
48
56
|
# @param [String] id
|
49
57
|
#
|
50
58
|
# @return [Response]
|
@@ -52,11 +60,14 @@ module Vonage
|
|
52
60
|
# @see https://developer.nexmo.com/api/conversation#getUser
|
53
61
|
#
|
54
62
|
def get(id)
|
63
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#find` instead.')
|
55
64
|
request('/beta/users/' + id)
|
56
65
|
end
|
57
66
|
|
58
67
|
# Update a user.
|
59
68
|
#
|
69
|
+
# @deprecated Please use {Vonage::Users#update} instead
|
70
|
+
#
|
60
71
|
# @option params [String] :name
|
61
72
|
# Unique name for a user.
|
62
73
|
#
|
@@ -79,11 +90,14 @@ module Vonage
|
|
79
90
|
# @see https://developer.nexmo.com/api/conversation#updateUser
|
80
91
|
#
|
81
92
|
def update(id, params)
|
93
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#update` instead.')
|
82
94
|
request('/beta/users/' + id, params: params, type: Put)
|
83
95
|
end
|
84
96
|
|
85
97
|
# Delete a user.
|
86
98
|
#
|
99
|
+
# @deprecated Please use {Vonage::Users#delete} instead
|
100
|
+
#
|
87
101
|
# @param [String] id
|
88
102
|
#
|
89
103
|
# @return [Response]
|
@@ -91,6 +105,7 @@ module Vonage
|
|
91
105
|
# @see https://developer.nexmo.com/api/conversation#deleteUser
|
92
106
|
#
|
93
107
|
def delete(id)
|
108
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Users#delete` instead.')
|
94
109
|
request('/beta/users/' + id, type: Delete)
|
95
110
|
end
|
96
111
|
end
|
data/lib/vonage/conversations.rb
CHANGED
@@ -11,6 +11,8 @@ module Vonage
|
|
11
11
|
|
12
12
|
# Create a conversation.
|
13
13
|
#
|
14
|
+
# @deprecated Please use {Vonage::Conversation#create} instead
|
15
|
+
#
|
14
16
|
# @example
|
15
17
|
# response = client.conversations.create(name: 'Example Conversation', display_name: 'Example Display Name')
|
16
18
|
#
|
@@ -37,11 +39,14 @@ module Vonage
|
|
37
39
|
#
|
38
40
|
sig { params(params: T::Hash[Symbol, T.untyped]).returns(Vonage::Response) }
|
39
41
|
def create(params)
|
42
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#create` instead.')
|
40
43
|
request('/beta/conversations', params: params, type: Post)
|
41
44
|
end
|
42
45
|
|
43
46
|
# List all conversations associated with your application.
|
44
47
|
#
|
48
|
+
# @deprecated Please use {Vonage::Conversation#list} instead
|
49
|
+
#
|
45
50
|
# @example
|
46
51
|
# response = client.conversations.list
|
47
52
|
#
|
@@ -71,6 +76,7 @@ module Vonage
|
|
71
76
|
#
|
72
77
|
sig { params(params: T.nilable(T::Hash[Symbol, T.untyped]), auto_advance: T::Boolean).returns(Vonage::Response) }
|
73
78
|
def list(params = nil, auto_advance = true)
|
79
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#list` instead.')
|
74
80
|
if params && !params.key?(:auto_advance)
|
75
81
|
params.merge!(auto_advance: true)
|
76
82
|
end
|
@@ -80,6 +86,8 @@ module Vonage
|
|
80
86
|
|
81
87
|
# Retrieve a conversation.
|
82
88
|
#
|
89
|
+
# @deprecated Please use {Vonage::Conversation#find} instead
|
90
|
+
#
|
83
91
|
# @example
|
84
92
|
# response = client.conversations.get(id)
|
85
93
|
#
|
@@ -91,11 +99,14 @@ module Vonage
|
|
91
99
|
#
|
92
100
|
sig { params(id: String).returns(Vonage::Response) }
|
93
101
|
def get(id)
|
102
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#find` instead.')
|
94
103
|
request('/beta/conversations/' + id)
|
95
104
|
end
|
96
105
|
|
97
106
|
# Update a conversation.
|
98
107
|
#
|
108
|
+
# @deprecated Please use {Vonage::Conversation#update} instead
|
109
|
+
#
|
99
110
|
# @example
|
100
111
|
# response = client.conversations.update(id, display_name: 'Updated conversation')
|
101
112
|
#
|
@@ -127,11 +138,14 @@ module Vonage
|
|
127
138
|
params: T::Hash[Symbol, T.untyped]
|
128
139
|
).returns(Vonage::Response) }
|
129
140
|
def update(id, params)
|
141
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#update` instead.')
|
130
142
|
request('/beta/conversations/' + id, params: params, type: Put)
|
131
143
|
end
|
132
144
|
|
133
145
|
# Delete a conversation.
|
134
146
|
#
|
147
|
+
# @deprecated Please use {Vonage::Conversation#delete} instead
|
148
|
+
#
|
135
149
|
# @example
|
136
150
|
# response = client.conversations.delete(id)
|
137
151
|
#
|
@@ -143,11 +157,14 @@ module Vonage
|
|
143
157
|
#
|
144
158
|
sig { params(id: String).returns(Vonage::Response) }
|
145
159
|
def delete(id)
|
160
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#delete` instead.')
|
146
161
|
request('/beta/conversations/' + id, type: Delete)
|
147
162
|
end
|
148
163
|
|
149
164
|
# Record a conversation.
|
150
165
|
#
|
166
|
+
# @deprecated
|
167
|
+
#
|
151
168
|
# @example
|
152
169
|
# response = client.conversations.record(id, action: 'start')
|
153
170
|
#
|
@@ -178,13 +195,17 @@ module Vonage
|
|
178
195
|
params: T::Hash[Symbol, T.untyped]
|
179
196
|
).returns(Vonage::Response) }
|
180
197
|
def record(id, params)
|
198
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
181
199
|
request('/v1/conversations/' + id + '/record', params: params, type: Put)
|
182
200
|
end
|
183
201
|
|
184
202
|
# @return [Events]
|
185
203
|
#
|
204
|
+
# @deprecated Please use {Vonage::Conversation#event} instead
|
205
|
+
#
|
186
206
|
sig { returns(T.nilable(Vonage::Conversations::Events)) }
|
187
207
|
def events
|
208
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#event` instead.')
|
188
209
|
@events = T.let(@events, T.nilable(Vonage::Conversations::Events))
|
189
210
|
@config = T.let(@config, T.nilable(Vonage::Config))
|
190
211
|
@events ||= Events.new(@config)
|
@@ -192,24 +213,33 @@ module Vonage
|
|
192
213
|
|
193
214
|
# @return [Legs]
|
194
215
|
#
|
216
|
+
# @deprecated
|
217
|
+
#
|
195
218
|
sig { returns(T.nilable(Vonage::Conversations::Legs)) }
|
196
219
|
def legs
|
220
|
+
logger.info('This method is deprecated and will be removed in a future release.')
|
197
221
|
@legs = T.let(@legs, T.nilable(Vonage::Conversations::Legs))
|
198
222
|
@legs ||= Legs.new(@config)
|
199
223
|
end
|
200
224
|
|
201
225
|
# @return [Members]
|
202
226
|
#
|
227
|
+
# @deprecated Please use {Vonage::Conversation#member} instead
|
228
|
+
#
|
203
229
|
sig { returns(T.nilable(Vonage::Conversations::Members)) }
|
204
230
|
def members
|
231
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#member` instead.')
|
205
232
|
@members = T.let(@members, T.nilable(Vonage::Conversations::Members))
|
206
233
|
@members ||= Members.new(@config)
|
207
234
|
end
|
208
235
|
|
209
236
|
# @return [Users]
|
210
237
|
#
|
238
|
+
# @deprecated Please use {Vonage::Conversation#user} instead
|
239
|
+
#
|
211
240
|
sig { returns(T.nilable(Vonage::Conversations::Users)) }
|
212
241
|
def users
|
242
|
+
logger.info('This method is deprecated and will be removed in a future release. Please use `Vonage::Conversation#user` instead.')
|
213
243
|
@users = T.let(@users, T.nilable(Vonage::Conversations::Users))
|
214
244
|
@users ||= Users.new(@config)
|
215
245
|
end
|
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
|
@@ -7,10 +7,10 @@ module Vonage
|
|
7
7
|
|
8
8
|
attr_reader :channel, :to, :from
|
9
9
|
|
10
|
-
def initialize(to:, from:
|
10
|
+
def initialize(to:, from:)
|
11
11
|
self.channel = 'whatsapp'
|
12
12
|
self.to = to
|
13
|
-
self.from = from
|
13
|
+
self.from = from
|
14
14
|
end
|
15
15
|
|
16
16
|
def to=(to)
|
@@ -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
|
|
@@ -66,6 +69,10 @@ module Vonage
|
|
66
69
|
request('/v2/verify/' + request_id, type: Delete)
|
67
70
|
end
|
68
71
|
|
72
|
+
def next_workflow(request_id:)
|
73
|
+
request('/v2/verify/' + request_id + '/next-workflow', type: Post)
|
74
|
+
end
|
75
|
+
|
69
76
|
# Instantiate a new Vonage::Verify2::StartVerificationOptions object
|
70
77
|
#
|
71
78
|
# @param [optional, Hash] opts the options for the verification request.
|
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
|