opentok 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/DEVELOPING.md +7 -6
- data/README.md +6 -4
- data/lib/opentok/token_generator.rb +9 -0
- data/lib/opentok/version.rb +1 -1
- data/sample/Archiving/public/js/host.js +1 -1
- data/sample/Archiving/public/js/participant.js +1 -1
- data/spec/matchers/token.rb +2 -1
- data/spec/shared/opentok_generates_tokens.rb +25 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c2985a61c6db455329b4cb491d573660acb9d0
|
4
|
+
data.tar.gz: e123cf51b9921306d2abec19a15a4dc6d1ce802c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3e879ddd1f69bb0e03806fe0e2e594daadb8b11a964b3cd46ed26d7be161ab21df7d43af8d63803b8d0fe4aed9344f0eae2ae32245e144c99e0df00dddab51e
|
7
|
+
data.tar.gz: 7703872a8a0c651cab4cb92a15c0d5ba83b0b26a0ddac8843e6cd6ae0fe164446752361fb868c6cbd7a3cbd5475502af11c8124b9224c691d5d6ddecee200e43
|
data/DEVELOPING.md
CHANGED
@@ -41,7 +41,7 @@ Common tasks:
|
|
41
41
|
In order to create a release, the following should be completed in order.
|
42
42
|
|
43
43
|
1. Ensure all tests are passing (`rake spec`) and that there is enough test coverage.
|
44
|
-
1. Make sure you are on the `
|
44
|
+
1. Make sure you are on the `dev` branch of the repository, with all changes merged/committed already.
|
45
45
|
1. Update the version number in the source code (`lib/opentok/version.rb`) and the README. See [Versioning](#versioning) for
|
46
46
|
information about selecting an appropriate version number.
|
47
47
|
1. Commit the version number change with the message ("Update to version v.x.x.x"), substituting the new version number.
|
@@ -49,7 +49,7 @@ In order to create a release, the following should be completed in order.
|
|
49
49
|
1. Run `rake release`, which will create a git tag for the version number, build, and push the gem to Rubygems.
|
50
50
|
1. Change the version number for future development by adding ".alpha.1", then make another commit with the message
|
51
51
|
"Beginning development on next version".
|
52
|
-
1. Push the changes to the main repository (`git push origin
|
52
|
+
1. Push the changes to the main repository (`git push origin dev`).
|
53
53
|
1. Add a description to the [GitHub Releases](https://github.com/opentok/opentok-ruby-sdk/releases) page
|
54
54
|
with any notable changes. Upload the built gem as an attachment.
|
55
55
|
|
@@ -66,11 +66,12 @@ from 1.
|
|
66
66
|
|
67
67
|
### Branches
|
68
68
|
|
69
|
-
* `
|
69
|
+
* `dev` - the main development branch.
|
70
|
+
* `master` - reflects the latest stable release.
|
70
71
|
* `feat.foo` - feature branches. these are used for longer running tasks that cannot be accomplished in one commit.
|
71
|
-
once merged into
|
72
|
-
* `vx.x.x` - if development for a future version/milestone has begun while
|
73
|
-
release, this is the naming scheme for that branch. once merged into
|
72
|
+
once merged into dev, these branches should be deleted.
|
73
|
+
* `vx.x.x` - if development for a future version/milestone has begun while dev is working towards a sooner
|
74
|
+
release, this is the naming scheme for that branch. once merged into dev, these branches should be deleted.
|
74
75
|
|
75
76
|
### Tags
|
76
77
|
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Bundler helps manage dependencies for Ruby projects. Find more info here: <http:
|
|
17
17
|
Add this gem to your `Gemfile`:
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
gem "opentok", "~> 2.4"
|
20
|
+
gem "opentok", "~> 2.4.1"
|
21
21
|
```
|
22
22
|
|
23
23
|
Allow bundler to install the change.
|
@@ -29,7 +29,7 @@ $ bundle install
|
|
29
29
|
## RubyGems:
|
30
30
|
|
31
31
|
```
|
32
|
-
$ gem install opentok
|
32
|
+
$ gem install opentok
|
33
33
|
```
|
34
34
|
|
35
35
|
# Usage
|
@@ -77,7 +77,8 @@ Once a Session is created, you can start generating Tokens for clients to use wh
|
|
77
77
|
You can generate a token either by calling the `opentok.generate_token(session_id, options)` method,
|
78
78
|
or by calling the `Session#generate_token(options)` method on the instance after creating it. The
|
79
79
|
`options` parameter is an optional Hash used to set the role, expire time, and connection data of
|
80
|
-
the Token.
|
80
|
+
the Token. For layout control in archives and broadcasts, the initial layout class list of streams
|
81
|
+
published from connections using this token can be set as well.
|
81
82
|
|
82
83
|
```ruby
|
83
84
|
# Generate a Token from just a session_id (fetched from a database)
|
@@ -90,7 +91,8 @@ token = session.generate_token
|
|
90
91
|
token = session.generate_token({
|
91
92
|
:role => :moderator,
|
92
93
|
:expire_time => Time.now.to_i+(7 * 24 * 60 * 60), # in one week
|
93
|
-
:data => 'name=Johnny'
|
94
|
+
:data => 'name=Johnny',
|
95
|
+
:initial_layout_class_list => ['focus', 'inactive']
|
94
96
|
});
|
95
97
|
```
|
96
98
|
|
@@ -81,6 +81,15 @@ module OpenTok
|
|
81
81
|
end
|
82
82
|
data_params[:connection_data] = data
|
83
83
|
end
|
84
|
+
|
85
|
+
if opts[:initial_layout_class_list]
|
86
|
+
if opts[:initial_layout_class_list].is_a?(Array)
|
87
|
+
data_params[:initial_layout_class_list] = opts[:initial_layout_class_list].join(' ')
|
88
|
+
else
|
89
|
+
data_params[:initial_layout_class_list] = opts[:initial_layout_class_list].to_s
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
84
93
|
digest = OpenSSL::Digest.new('sha1')
|
85
94
|
data_string = Addressable::URI.form_encode data_params
|
86
95
|
meta_string = Addressable::URI.form_encode({
|
data/lib/opentok/version.rb
CHANGED
@@ -2,7 +2,7 @@ var session = OT.initSession(apiKey, sessionId),
|
|
2
2
|
publisher = OT.initPublisher('publisher'),
|
3
3
|
archiveID = null;
|
4
4
|
|
5
|
-
session.connect(token, function(error
|
5
|
+
session.connect(token, function(error) {
|
6
6
|
if (error) {
|
7
7
|
console.error('Failed to connect', error);
|
8
8
|
} else {
|
data/spec/matchers/token.rb
CHANGED
@@ -7,7 +7,8 @@ require "addressable/uri"
|
|
7
7
|
RSpec::Matchers.define :carry_token_data do |input_data|
|
8
8
|
option_to_token_key = {
|
9
9
|
:api_key => :partner_id,
|
10
|
-
:data => :connection_data
|
10
|
+
:data => :connection_data,
|
11
|
+
:initial_layout_class_list => :initial_layout_class_list
|
11
12
|
}
|
12
13
|
match do |token|
|
13
14
|
decoded_token = Base64.decode64(token[4..token.length])
|
@@ -73,6 +73,31 @@ shared_examples "opentok generates tokens" do
|
|
73
73
|
expect(data_bearing_token).to carry_valid_token_signature api_secret
|
74
74
|
end
|
75
75
|
|
76
|
+
it "generates tokens with initial layout classes" do
|
77
|
+
layout_classes = ["focus", "small"]
|
78
|
+
layout_class_bearing_token = opentok.generate_token session_id, :initial_layout_class_list => layout_classes
|
79
|
+
expect(layout_class_bearing_token).to be_an_instance_of String
|
80
|
+
expect(layout_class_bearing_token).to carry_token_data :session_id => session_id
|
81
|
+
expect(layout_class_bearing_token).to carry_token_data :api_key => api_key
|
82
|
+
expect(layout_class_bearing_token).to carry_token_data :role => default_role
|
83
|
+
expect(layout_class_bearing_token).to carry_token_data :initial_layout_class_list => layout_classes.join(' ')
|
84
|
+
expect(layout_class_bearing_token).to carry_token_data [:nonce, :create_time]
|
85
|
+
expect(layout_class_bearing_token).to carry_valid_token_signature api_secret
|
86
|
+
end
|
87
|
+
|
88
|
+
it "generates tokens with one initial layout class" do
|
89
|
+
layout_class = "focus"
|
90
|
+
layout_class_bearing_token = opentok.generate_token session_id, :initial_layout_class_list => layout_class
|
91
|
+
expect(layout_class_bearing_token).to be_an_instance_of String
|
92
|
+
expect(layout_class_bearing_token).to carry_token_data :session_id => session_id
|
93
|
+
expect(layout_class_bearing_token).to carry_token_data :api_key => api_key
|
94
|
+
expect(layout_class_bearing_token).to carry_token_data :role => default_role
|
95
|
+
expect(layout_class_bearing_token).to carry_token_data :initial_layout_class_list => layout_class
|
96
|
+
expect(layout_class_bearing_token).to carry_token_data [:nonce, :create_time]
|
97
|
+
expect(layout_class_bearing_token).to carry_valid_token_signature api_secret
|
98
|
+
end
|
99
|
+
|
100
|
+
|
76
101
|
# TODO a context about using a bad session_id
|
77
102
|
end
|
78
103
|
|
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: 2.4.
|
4
|
+
version: 2.4.1
|
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: 2017-
|
15
|
+
date: 2017-07-04 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.6.
|
265
|
+
rubygems_version: 2.6.11
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Ruby gem for the OpenTok API
|