opentok 2.3.4 → 2.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OpenTok Ruby SDK
2
2
 
3
- [![Build Status](https://travis-ci.org/opentok/Opentok-Ruby-SDK.png)](https://travis-ci.org/opentok/Opentok-Ruby-SDK)
3
+ [![Build Status](https://travis-ci.org/opentok/OpenTok-Ruby-SDK.png)](https://travis-ci.org/opentok/OpenTok-Ruby-SDK)
4
4
 
5
5
  The OpenTok Ruby SDK lets you generate
6
6
  [sessions](http://www.tokbox.com/opentok/tutorials/create-session/) and
@@ -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.3"
20
+ gem "opentok", "~> 2.4.0.beta.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 -v 2.3.4
32
+ $ gem install opentok -v 2.4.0.beta.1
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 an 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)
@@ -88,9 +89,10 @@ token = session.generate_token
88
89
 
89
90
  # Set some options in a token
90
91
  token = session.generate_token({
91
- :role => :moderator
92
- :expire_time => Time.now.to_i+(7 * 24 * 60 * 60) # in one week
93
- :data => 'name=Johnny'
92
+ :role => :moderator
93
+ :expire_time => Time.now.to_i+(7 * 24 * 60 * 60) # in one week
94
+ :data => 'name=Johnny',
95
+ :initial_layout_classes => ['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_classes]
86
+ if opts[:initial_layout_classes].is_a?(Array)
87
+ data_params[:initial_layout_class_list] = opts[:initial_layout_classes].join(' ')
88
+ else
89
+ data_params[:initial_layout_class_list] = opts[:initial_layout_classes].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({
@@ -1,4 +1,4 @@
1
1
  module OpenTok
2
2
  # @private
3
- VERSION = '2.3.4'
3
+ VERSION = '2.4.0.beta.1'
4
4
  end
@@ -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_classes => :initial_layout_class_list
11
12
  }
12
13
  match do |token|
13
14
  decoded_token = Base64.decode64(token[4..token.length])
@@ -68,6 +68,31 @@ shared_examples "opentok generates tokens" do
68
68
  expect(data_bearing_token).to carry_valid_token_signature api_secret
69
69
  end
70
70
 
71
+ it "generates tokens with initial layout classes" do
72
+ layout_classes = ["focus", "small"]
73
+ layout_class_bearing_token = opentok.generate_token session_id, :initial_layout_classes => layout_classes
74
+ expect(layout_class_bearing_token).to be_an_instance_of String
75
+ expect(layout_class_bearing_token).to carry_token_data :session_id => session_id
76
+ expect(layout_class_bearing_token).to carry_token_data :api_key => api_key
77
+ expect(layout_class_bearing_token).to carry_token_data :role => default_role
78
+ expect(layout_class_bearing_token).to carry_token_data :initial_layout_classes => layout_classes.join(' ')
79
+ expect(layout_class_bearing_token).to carry_token_data [:nonce, :create_time]
80
+ expect(layout_class_bearing_token).to carry_valid_token_signature api_secret
81
+ end
82
+
83
+ it "generates tokens with one initial layout class" do
84
+ layout_class = "focus"
85
+ layout_class_bearing_token = opentok.generate_token session_id, :initial_layout_classes => layout_class
86
+ expect(layout_class_bearing_token).to be_an_instance_of String
87
+ expect(layout_class_bearing_token).to carry_token_data :session_id => session_id
88
+ expect(layout_class_bearing_token).to carry_token_data :api_key => api_key
89
+ expect(layout_class_bearing_token).to carry_token_data :role => default_role
90
+ expect(layout_class_bearing_token).to carry_token_data :initial_layout_classes => layout_class
91
+ expect(layout_class_bearing_token).to carry_token_data [:nonce, :create_time]
92
+ expect(layout_class_bearing_token).to carry_valid_token_signature api_secret
93
+ end
94
+
95
+
71
96
  # TODO a context about using a bad session_id
72
97
  end
73
98
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentok
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
5
- prerelease:
4
+ version: 2.4.0.beta.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Stijn Mathysen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-03-24 00:00:00.000000000 Z
16
+ date: 2016-04-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -289,16 +289,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  segments:
291
291
  - 0
292
- hash: -1615848951695001648
292
+ hash: -2395561046031513785
293
293
  required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  none: false
295
295
  requirements:
296
- - - ! '>='
296
+ - - ! '>'
297
297
  - !ruby/object:Gem::Version
298
- version: '0'
299
- segments:
300
- - 0
301
- hash: -1615848951695001648
298
+ version: 1.3.1
302
299
  requirements: []
303
300
  rubyforge_project:
304
301
  rubygems_version: 1.8.23.2