opentok 4.8.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/README.md +10 -0
- data/lib/opentok/archive.rb +2 -1
- data/lib/opentok/archives.rb +13 -4
- data/lib/opentok/constants.rb +1 -1
- data/lib/opentok/version.rb +1 -1
- data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_matching_multi_archive_tag_when_multiArchiveTag_is_specified.yml +1 -1
- data/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml +52 -0
- data/spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml +1 -1
- data/spec/opentok/archives_spec.rb +9 -2
- data/spec/shared/opentok_generates_tokens.rb +39 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1e7d0f61794792bf98909f86601643c30df2cb2343297dcca0e8df7397d93a
|
4
|
+
data.tar.gz: 2c336b28cd586be0f082770b8854fd7f222d4c7047ba060a2fe300c31bf2417f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2730c26df934c6fb413f177db04bdc048ea58285bf2dbd640d90873a9f2670f31264141f08280cf393860eb8b11f7b525f2ef61e5d450d5c15d0fe0437addc5d
|
7
|
+
data.tar.gz: 3c6570e28e20be4c471ca6313fe1f6da293927637d78594288da2043fcde7b4a810113df5038c2aa8f836c30e8045c47fe6dd48ee3123dfad1df4db67058839e
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 4.9.0
|
2
|
+
|
3
|
+
* Adds the `publisheronly` role for client token creation. See [#272](https://github.com/opentok/OpenTok-Ruby-SDK/pull/272)
|
4
|
+
|
5
|
+
# 4.8.1
|
6
|
+
|
7
|
+
* Fixes a bug with the `Archives#create` method. See [#269](https://github.com/opentok/OpenTok-Ruby-SDK/pull/269) and [#270](https://github.com/opentok/OpenTok-Ruby-SDK/pull/270)
|
8
|
+
|
1
9
|
# 4.8.0
|
2
10
|
|
3
11
|
* Add support for Captions API [#267](https://github.com/opentok/OpenTok-Ruby-SDK/pull/267)
|
data/README.md
CHANGED
@@ -20,6 +20,16 @@ The OpenTok Ruby SDK provides methods for:
|
|
20
20
|
* Working with OpenTok [Experience Composers](https://tokbox.com/developer/guides/experience-composer)
|
21
21
|
* Working with OpenTok [Audio Connector](https://tokbox.com/developer/guides/audio-connector)
|
22
22
|
|
23
|
+
## Note!
|
24
|
+
|
25
|
+
This library is designed to work with the Tokbox/OpenTok platform, part of the Vonage Video API. If you are looking to use the Vonage Video API and using the Vonage Customer Dashboard, you will want to install the [Vonage Server SDK for Ruby](https://github.com/Vonage/vonage-ruby-sdk), which includes support for the Vonage Video API.
|
26
|
+
|
27
|
+
Not sure which exact platform you are using? Take a look at [this guide](https://api.support.vonage.com/hc/en-us/articles/10817774782492).
|
28
|
+
|
29
|
+
If you are using the Tokbox platform, do not worry! The Tokbox platform is not going away, and this library will continue to be updated. While we encourage customers to check out the new Unified platform, there is no rush to switch. Both platforms run the exact same infrastructure and capabilities, with the main difference is a unified billing interface and easier access to [Vonage’s other CPaaS APIs](https://www.vonage.com/communications-apis/).
|
30
|
+
|
31
|
+
If you are new to the Vonage Video API, head on over to the [Vonage Customer Dashboard](https://dashboard.vonage.com) to sign up for a developer account and check out the [Vonage Server SDK for Ruby](https://github.com/Vonage/vonage-ruby-sdk).
|
32
|
+
|
23
33
|
## Installation
|
24
34
|
|
25
35
|
### Bundler (recommended):
|
data/lib/opentok/archive.rb
CHANGED
@@ -72,13 +72,14 @@ module OpenTok
|
|
72
72
|
# set to null. The download URL is obfuscated, and the file is only available from the URL for
|
73
73
|
# 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.
|
74
74
|
class Archive
|
75
|
-
attr_reader :multi_archive_tag
|
75
|
+
attr_reader :multi_archive_tag, :stream_mode
|
76
76
|
# @private
|
77
77
|
def initialize(interface, json)
|
78
78
|
@interface = interface
|
79
79
|
# TODO: validate json fits schema
|
80
80
|
@json = json
|
81
81
|
@multi_archive_tag = @json['multiArchiveTag']
|
82
|
+
@stream_mode = @json['streamMode']
|
82
83
|
end
|
83
84
|
|
84
85
|
# A JSON-encoded string representation of the archive.
|
data/lib/opentok/archives.rb
CHANGED
@@ -39,11 +39,11 @@ module OpenTok
|
|
39
39
|
# (a video track is included). If you set both <code>has_audio</code> and
|
40
40
|
# <code>has_video</code> to <code>false</code>, the call to the <code>create()</code>
|
41
41
|
# method results in an error.
|
42
|
-
# @option options [String] :
|
42
|
+
# @option options [String] :multi_archive_tag (Optional) Set this to support recording multiple archives for the same session simultaneously.
|
43
43
|
# Set this to a unique string for each simultaneous archive of an ongoing session. You must also set this option when manually starting an archive
|
44
44
|
# that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}. Note that the `multiArchiveTag` value is not included
|
45
45
|
# in the response for the methods to {https://tokbox.com/developer/rest/#listing_archives list archives} and
|
46
|
-
# {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `
|
46
|
+
# {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multi_archive_tag`,
|
47
47
|
# you can only record one archive at a time for a given session.
|
48
48
|
# {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}.
|
49
49
|
# @option options [String] :output_mode Whether all streams in the archive are recorded
|
@@ -56,7 +56,7 @@ module OpenTok
|
|
56
56
|
# (HD portrait), or "1080x1920" (FHD portrait). This property only applies to composed archives. If you set
|
57
57
|
# this property and set the outputMode property to "individual", a call to the method
|
58
58
|
# results in an error.
|
59
|
-
# @option options [String] :
|
59
|
+
# @option options [String] :stream_mode (Optional) Whether streams included in the archive are selected
|
60
60
|
# automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"),
|
61
61
|
# all streams in the session can be included in the archive. When streams are selected manually ("manual"),
|
62
62
|
# you specify streams to be included based on calls to the {Archives#add_stream} method. You can specify whether a
|
@@ -97,7 +97,16 @@ module OpenTok
|
|
97
97
|
"Resolution cannot be supplied for individual output mode" if options.key?(:resolution) and options[:output_mode] == :individual
|
98
98
|
|
99
99
|
# normalize opts so all keys are symbols and only include valid_opts
|
100
|
-
valid_opts = [
|
100
|
+
valid_opts = [
|
101
|
+
:name,
|
102
|
+
:has_audio,
|
103
|
+
:has_video,
|
104
|
+
:output_mode,
|
105
|
+
:resolution,
|
106
|
+
:layout,
|
107
|
+
:multi_archive_tag,
|
108
|
+
:stream_mode
|
109
|
+
]
|
101
110
|
opts = options.inject({}) do |m,(k,v)|
|
102
111
|
if valid_opts.include? k.to_sym
|
103
112
|
m[k.to_sym] = v
|
data/lib/opentok/constants.rb
CHANGED
@@ -2,7 +2,7 @@ module OpenTok
|
|
2
2
|
require "set"
|
3
3
|
API_URL = "https://api.opentok.com"
|
4
4
|
TOKEN_SENTINEL = "T1=="
|
5
|
-
ROLES = { subscriber: "subscriber", publisher: "publisher", moderator: "moderator" }
|
5
|
+
ROLES = { subscriber: "subscriber", publisher: "publisher", moderator: "moderator", publisheronly: "publisheronly" }
|
6
6
|
ARCHIVE_MODES = ::Set.new([:manual, :always])
|
7
7
|
AUTH_EXPIRE = 300
|
8
8
|
end
|
data/lib/opentok/version.rb
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.opentok.com/v2/project/123456/archive
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"sessionId":"SESSIONID"}'
|
8
|
+
string: '{"sessionId":"SESSIONID","multiArchiveTag":"archive-1"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- OpenTok-Ruby-SDK/<%= version %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.opentok.com/v2/project/123456/archive
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"sessionId":"SESSIONID","streamMode":"manual"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- OpenTok-Ruby-SDK/<%= version %>
|
12
|
+
X-Opentok-Auth:
|
13
|
+
- eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Wed, 03 Jan 2024 14:32:20 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
{
|
39
|
+
"createdAt" : 1395183243556,
|
40
|
+
"duration" : 0,
|
41
|
+
"id" : "30b3ebf1-ba36-4f5b-8def-6f70d9986fe9",
|
42
|
+
"name" : "",
|
43
|
+
"partnerId" : 123456,
|
44
|
+
"reason" : "",
|
45
|
+
"sessionId" : "SESSIONID",
|
46
|
+
"size" : 0,
|
47
|
+
"status" : "started",
|
48
|
+
"url" : null,
|
49
|
+
"streamMode":"manual"
|
50
|
+
}
|
51
|
+
recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
|
52
|
+
recorded_with: VCR 6.0.0
|
data/spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.opentok.com/v2/project/123456/archive
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"sessionId":"SESSIONID"}'
|
8
|
+
string: '{"sessionId":"SESSIONID","multiArchiveTag":"archive-1"}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- OpenTok-Ruby-SDK/<%= version %>
|
@@ -44,7 +44,7 @@ describe OpenTok::Archives do
|
|
44
44
|
|
45
45
|
it "should create an archives with a specified multiArchiveTag", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
|
46
46
|
archive_tag = 'archive-1'
|
47
|
-
archive = archives.create session_id, :
|
47
|
+
archive = archives.create session_id, :multi_archive_tag => archive_tag
|
48
48
|
expect(archive).to be_an_instance_of OpenTok::Archive
|
49
49
|
expect(archive.session_id).to eq session_id
|
50
50
|
expect(archive.multiArchiveTag).to eq archive_tag
|
@@ -52,7 +52,7 @@ describe OpenTok::Archives do
|
|
52
52
|
|
53
53
|
it "should create an archive with matching multi_archive_tag when multiArchiveTag is specified", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
|
54
54
|
archive_tag = 'archive-1'
|
55
|
-
archive = archives.create session_id, :
|
55
|
+
archive = archives.create session_id, :multi_archive_tag => archive_tag
|
56
56
|
expect(archive).to be_an_instance_of OpenTok::Archive
|
57
57
|
expect(archive.multi_archive_tag).to eq archive_tag
|
58
58
|
end
|
@@ -63,6 +63,13 @@ describe OpenTok::Archives do
|
|
63
63
|
expect(archive.multi_archive_tag).to be_nil
|
64
64
|
end
|
65
65
|
|
66
|
+
it "should create an archive with streamMode set to specified stream_mode value", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
|
67
|
+
stream_mode = 'manual'
|
68
|
+
archive = archives.create session_id, :stream_mode => stream_mode
|
69
|
+
expect(archive).to be_an_instance_of OpenTok::Archive
|
70
|
+
expect(archive.stream_mode).to eq stream_mode
|
71
|
+
end
|
72
|
+
|
66
73
|
it "should create audio only archives", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
|
67
74
|
archive = archives.create session_id, :has_video => false
|
68
75
|
expect(archive).to be_an_instance_of OpenTok::Archive
|
@@ -50,7 +50,29 @@ shared_examples "opentok generates tokens" do
|
|
50
50
|
expect(expiring_token).to carry_valid_token_signature api_secret
|
51
51
|
end
|
52
52
|
|
53
|
-
it "generates tokens with a role" do
|
53
|
+
it "generates tokens with a publisher role" do
|
54
|
+
role = :publisher
|
55
|
+
role_token = opentok.generate_token session_id, :role => role
|
56
|
+
expect(role_token).to be_an_instance_of String
|
57
|
+
expect(role_token).to carry_token_data :session_id => session_id
|
58
|
+
expect(role_token).to carry_token_data :api_key => api_key
|
59
|
+
expect(role_token).to carry_token_data :role => role
|
60
|
+
expect(role_token).to carry_token_data [:nonce, :create_time]
|
61
|
+
expect(role_token).to carry_valid_token_signature api_secret
|
62
|
+
end
|
63
|
+
|
64
|
+
it "generates tokens with a subscriber role" do
|
65
|
+
role = :subscriber
|
66
|
+
role_token = opentok.generate_token session_id, :role => role
|
67
|
+
expect(role_token).to be_an_instance_of String
|
68
|
+
expect(role_token).to carry_token_data :session_id => session_id
|
69
|
+
expect(role_token).to carry_token_data :api_key => api_key
|
70
|
+
expect(role_token).to carry_token_data :role => role
|
71
|
+
expect(role_token).to carry_token_data [:nonce, :create_time]
|
72
|
+
expect(role_token).to carry_valid_token_signature api_secret
|
73
|
+
end
|
74
|
+
|
75
|
+
it "generates tokens with a moderator role" do
|
54
76
|
role = :moderator
|
55
77
|
role_token = opentok.generate_token session_id, :role => role
|
56
78
|
expect(role_token).to be_an_instance_of String
|
@@ -61,6 +83,17 @@ shared_examples "opentok generates tokens" do
|
|
61
83
|
expect(role_token).to carry_valid_token_signature api_secret
|
62
84
|
end
|
63
85
|
|
86
|
+
it "generates tokens with a publisheronly role" do
|
87
|
+
role = :publisheronly
|
88
|
+
role_token = opentok.generate_token session_id, :role => role
|
89
|
+
expect(role_token).to be_an_instance_of String
|
90
|
+
expect(role_token).to carry_token_data :session_id => session_id
|
91
|
+
expect(role_token).to carry_token_data :api_key => api_key
|
92
|
+
expect(role_token).to carry_token_data :role => role
|
93
|
+
expect(role_token).to carry_token_data [:nonce, :create_time]
|
94
|
+
expect(role_token).to carry_valid_token_signature api_secret
|
95
|
+
end
|
96
|
+
|
64
97
|
it "generates tokens with data" do
|
65
98
|
data = "name=Johnny"
|
66
99
|
data_bearing_token = opentok.generate_token session_id, :data => data
|
@@ -97,6 +130,11 @@ shared_examples "opentok generates tokens" do
|
|
97
130
|
expect(layout_class_bearing_token).to carry_valid_token_signature api_secret
|
98
131
|
end
|
99
132
|
|
133
|
+
context "when the role is invalid" do
|
134
|
+
it "raises an error" do
|
135
|
+
expect { opentok.generate_token session_id, :role => :invalid_role }.to raise_error
|
136
|
+
end
|
137
|
+
end
|
100
138
|
|
101
139
|
# TODO a context about using a bad session_id
|
102
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stijn Mathysen
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- spec/cassettes/OpenTok_Archives/removes_a_stream_from_an_archive.yml
|
247
247
|
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_matching_multi_archive_tag_when_multiArchiveTag_is_specified.yml
|
248
248
|
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_multi_archive_tag_value_of_nil_when_multiArchiveTag_not_specified.yml
|
249
|
+
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml
|
249
250
|
- spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml
|
250
251
|
- spec/cassettes/OpenTok_Archives/should_create_archives.yml
|
251
252
|
- spec/cassettes/OpenTok_Archives/should_create_audio_only_archives.yml
|
@@ -354,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
355
|
- !ruby/object:Gem::Version
|
355
356
|
version: '0'
|
356
357
|
requirements: []
|
357
|
-
rubygems_version: 3.
|
358
|
+
rubygems_version: 3.5.4
|
358
359
|
signing_key:
|
359
360
|
specification_version: 4
|
360
361
|
summary: Ruby gem for the OpenTok API
|
@@ -366,6 +367,7 @@ test_files:
|
|
366
367
|
- spec/cassettes/OpenTok_Archives/removes_a_stream_from_an_archive.yml
|
367
368
|
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_matching_multi_archive_tag_when_multiArchiveTag_is_specified.yml
|
368
369
|
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_multi_archive_tag_value_of_nil_when_multiArchiveTag_not_specified.yml
|
370
|
+
- spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml
|
369
371
|
- spec/cassettes/OpenTok_Archives/should_create_an_archives_with_a_specified_multiArchiveTag.yml
|
370
372
|
- spec/cassettes/OpenTok_Archives/should_create_archives.yml
|
371
373
|
- spec/cassettes/OpenTok_Archives/should_create_audio_only_archives.yml
|