vonage 7.17.0 → 7.19.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 +219 -89
- data/lib/vonage/applications.rb +12 -4
- data/lib/vonage/client.rb +14 -0
- data/lib/vonage/config.rb +4 -0
- data/lib/vonage/jwt.rb +17 -0
- data/lib/vonage/keys.rb +9 -1
- data/lib/vonage/meetings/rooms.rb +1 -1
- data/lib/vonage/meetings/sessions/list_response.rb +1 -1
- data/lib/vonage/messaging.rb +11 -0
- data/lib/vonage/namespace.rb +4 -3
- data/lib/vonage/number_insight_2.rb +36 -0
- data/lib/vonage/signature.rb +5 -5
- data/lib/vonage/sms.rb +20 -0
- data/lib/vonage/verify2/channels/email.rb +1 -3
- data/lib/vonage/verify2/channels/silent_auth.rb +15 -2
- data/lib/vonage/verify2/channels/sms.rb +1 -1
- data/lib/vonage/verify2/channels/whats_app.rb +1 -1
- data/lib/vonage/verify2.rb +3 -3
- data/lib/vonage/version.rb +1 -1
- data/lib/vonage/video/archives/list_response.rb +11 -0
- data/lib/vonage/video/archives.rb +152 -0
- data/lib/vonage/video/broadcasts/list_response.rb +11 -0
- data/lib/vonage/video/broadcasts.rb +75 -0
- data/lib/vonage/video/moderation.rb +58 -0
- data/lib/vonage/video/signals.rb +50 -0
- data/lib/vonage/video/sip.rb +48 -0
- data/lib/vonage/video/streams/list_response.rb +11 -0
- data/lib/vonage/video/streams.rb +70 -0
- data/lib/vonage/video.rb +109 -0
- data/lib/vonage/voice/actions/conversation.rb +2 -2
- data/lib/vonage/voice.rb +11 -0
- data/lib/vonage.rb +1 -0
- data/vonage.gemspec +1 -1
- metadata +15 -4
@@ -0,0 +1,70 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class Video::Streams < Namespace
|
6
|
+
|
7
|
+
self.authentication = BearerToken
|
8
|
+
|
9
|
+
self.request_body = JSON
|
10
|
+
|
11
|
+
self.host = :video_host
|
12
|
+
|
13
|
+
# Get a list of streams for a specified session.
|
14
|
+
#
|
15
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
16
|
+
#
|
17
|
+
# @param [required, String] :session_id
|
18
|
+
#
|
19
|
+
# TODO: add auto_advance option
|
20
|
+
#
|
21
|
+
# @return [ListResponse]
|
22
|
+
#
|
23
|
+
# @see TODO: add docs link
|
24
|
+
#
|
25
|
+
def list(session_id:)
|
26
|
+
request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream', response_class: ListResponse)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get information about a specified stream.
|
30
|
+
#
|
31
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
32
|
+
#
|
33
|
+
# @param [required, String] :session_id
|
34
|
+
#
|
35
|
+
# @param [required, String] :stream_id
|
36
|
+
#
|
37
|
+
# @return [Response]
|
38
|
+
#
|
39
|
+
# @see TODO: add docs link
|
40
|
+
#
|
41
|
+
def info(session_id:, stream_id:)
|
42
|
+
request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream/' + stream_id)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Change the layout for a list of specified streams.
|
46
|
+
#
|
47
|
+
# @param [optional, String] :application_id (Required unless already set at Client instantiation or set in ENV)
|
48
|
+
#
|
49
|
+
# @param [required, String] :session_id
|
50
|
+
#
|
51
|
+
# @param [optional, Array<Hash>] :items An array of hashes representing streams and the layout classes for those streams
|
52
|
+
#
|
53
|
+
# @option items [required, String] :id The stream ID
|
54
|
+
#
|
55
|
+
# @option items [required, Array<String>] :layoutClassList Array of CSS class names as strings
|
56
|
+
#
|
57
|
+
# @return [Response]
|
58
|
+
#
|
59
|
+
# @see TODO: add docs link
|
60
|
+
#
|
61
|
+
def change_layout(session_id:, **params)
|
62
|
+
# TODO camelcase layout_class_list
|
63
|
+
# if params[:items]
|
64
|
+
# params[:items] = params[:items].map {|item| camelcase(item)}
|
65
|
+
# end
|
66
|
+
|
67
|
+
request('/v2/project/' + @config.application_id + '/session/' + session_id + '/stream', params: params, type: Put)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/vonage/video.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Vonage
|
5
|
+
class Video < Namespace
|
6
|
+
include Keys
|
7
|
+
|
8
|
+
self.authentication = BearerToken
|
9
|
+
|
10
|
+
self.host = :video_host
|
11
|
+
|
12
|
+
# Generate a new session.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# session = client.video.create_session({
|
16
|
+
# archive_mode: 'always',
|
17
|
+
# location: '10.1.200.30',
|
18
|
+
# media_mode: 'routed'
|
19
|
+
# })
|
20
|
+
#
|
21
|
+
# @params [optional, String] :archive_mode (either 'always' or 'manual')
|
22
|
+
#
|
23
|
+
# @param [optional, String] :location
|
24
|
+
#
|
25
|
+
# @params [optional, String] :media_mode (either 'routed' or 'relayed')
|
26
|
+
#
|
27
|
+
# @return [Response]
|
28
|
+
#
|
29
|
+
# @see TODO: Add document link here
|
30
|
+
#
|
31
|
+
def create_session(**params)
|
32
|
+
request_params = params.clone
|
33
|
+
request_params[:archive_mode] ||= 'manual'
|
34
|
+
media_mode = request_params.delete(:media_mode) || 'routed'
|
35
|
+
|
36
|
+
if media_mode == 'relayed' && request_params[:archive_mode] == 'manual'
|
37
|
+
request_params['p2p.preference'] = 'enabled'
|
38
|
+
else
|
39
|
+
request_params['p2p.preference'] = 'disabled'
|
40
|
+
end
|
41
|
+
|
42
|
+
response = request('/session/create', params: camelcase(request_params), type: Post)
|
43
|
+
|
44
|
+
public_response_data = {
|
45
|
+
session_id: response.entity.first.session_id,
|
46
|
+
archive_mode: request_params[:archive_mode],
|
47
|
+
media_mode: media_mode,
|
48
|
+
location: request_params[:location]
|
49
|
+
}
|
50
|
+
|
51
|
+
entity = Entity.new(public_response_data)
|
52
|
+
|
53
|
+
response.class.new(entity, response.http_response)
|
54
|
+
end
|
55
|
+
|
56
|
+
def generate_client_token(session_id:, scope: 'session.connect', role: 'publisher', **params)
|
57
|
+
claims = {
|
58
|
+
application_id: @config.application_id,
|
59
|
+
scope: scope,
|
60
|
+
session_id: session_id,
|
61
|
+
role: role,
|
62
|
+
initial_layout_class_list: '',
|
63
|
+
sub: 'video',
|
64
|
+
acl: {
|
65
|
+
paths: {'/session/**' => {}}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
claims[:data] = params[:data] if params[:data]
|
71
|
+
claims[:initial_layout_class_list] = params[:initial_layout_class_list].join(' ') if params[:initial_layout_class_list]
|
72
|
+
claims[:exp] = params[:expire_time].to_i if params[:expire_time]
|
73
|
+
|
74
|
+
JWT.generate(claims, @config.private_key)
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [Archives]
|
78
|
+
#
|
79
|
+
def archives
|
80
|
+
@archives ||= Archives.new(@config)
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return [Broadcasts]
|
84
|
+
#
|
85
|
+
def broadcasts
|
86
|
+
@broadcasts ||= Broadcasts.new(@config)
|
87
|
+
end
|
88
|
+
|
89
|
+
# @return [Moderation]
|
90
|
+
#
|
91
|
+
def moderation
|
92
|
+
@moderation ||= Moderation.new(@config)
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [Signals]
|
96
|
+
#
|
97
|
+
def signals
|
98
|
+
@signals ||= Signals.new(@config)
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [Streams]
|
102
|
+
#
|
103
|
+
def streams
|
104
|
+
@streams ||= Streams.new(@config)
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
data/lib/vonage/voice.rb
CHANGED
@@ -279,5 +279,16 @@ module Vonage
|
|
279
279
|
def dtmf
|
280
280
|
@dtmf ||= DTMF.new(@config)
|
281
281
|
end
|
282
|
+
|
283
|
+
# Validate a JSON Web Token from a Voice API Webhook.
|
284
|
+
#
|
285
|
+
# @param [String, required] :token The JWT from the Webhook's Authorization header
|
286
|
+
# @param [String, optional] :signature_secret The account signature secret. Required, unless `signature_secret`
|
287
|
+
# is set in `Config`
|
288
|
+
#
|
289
|
+
# @return [Boolean] true, if the JWT is verified, false otherwise
|
290
|
+
def verify_webhook_token(token:, signature_secret: @config.signature_secret)
|
291
|
+
JWT.verify_hs256_signature(token: token, signature_secret: signature_secret)
|
292
|
+
end
|
282
293
|
end
|
283
294
|
end
|
data/lib/vonage.rb
CHANGED
data/vonage.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = 'This is the Ruby Server SDK for Vonage APIs. To use it you\'ll need a Vonage account. Sign up for free at https://www.vonage.com'
|
13
13
|
s.files = Dir.glob('lib/**/*.rb') + %w(LICENSE.txt README.md vonage.gemspec)
|
14
14
|
s.required_ruby_version = '>= 2.5.0'
|
15
|
-
s.add_dependency('vonage-jwt', '~> 0.
|
15
|
+
s.add_dependency('vonage-jwt', '~> 0.2.0')
|
16
16
|
s.add_dependency('zeitwerk', '~> 2', '>= 2.2')
|
17
17
|
s.add_dependency('sorbet-runtime', '~> 0.5')
|
18
18
|
s.add_dependency('multipart-post', '~> 2.0')
|
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.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vonage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vonage-jwt
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: zeitwerk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/vonage/messaging/message.rb
|
162
162
|
- lib/vonage/namespace.rb
|
163
163
|
- lib/vonage/number_insight.rb
|
164
|
+
- lib/vonage/number_insight_2.rb
|
164
165
|
- lib/vonage/numbers.rb
|
165
166
|
- lib/vonage/numbers/list_response.rb
|
166
167
|
- lib/vonage/numbers/response.rb
|
@@ -205,6 +206,16 @@ files:
|
|
205
206
|
- lib/vonage/verify2/workflow.rb
|
206
207
|
- lib/vonage/verify2/workflow_builder.rb
|
207
208
|
- lib/vonage/version.rb
|
209
|
+
- lib/vonage/video.rb
|
210
|
+
- lib/vonage/video/archives.rb
|
211
|
+
- lib/vonage/video/archives/list_response.rb
|
212
|
+
- lib/vonage/video/broadcasts.rb
|
213
|
+
- lib/vonage/video/broadcasts/list_response.rb
|
214
|
+
- lib/vonage/video/moderation.rb
|
215
|
+
- lib/vonage/video/signals.rb
|
216
|
+
- lib/vonage/video/sip.rb
|
217
|
+
- lib/vonage/video/streams.rb
|
218
|
+
- lib/vonage/video/streams/list_response.rb
|
208
219
|
- lib/vonage/voice.rb
|
209
220
|
- lib/vonage/voice/actions/connect.rb
|
210
221
|
- lib/vonage/voice/actions/conversation.rb
|