opentok 4.1.2 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74581fd2fb2645cd163ed9a979fcfbb8cfd13da7cf0530bd49364a8a63ce0164
4
- data.tar.gz: 8a21fb081a3be5c24a3a321442af11a56ef960ea489b1482abd876adc4d09e44
3
+ metadata.gz: 9e2192eea0d5c896fc1251eb57055f59c1e057d62827177d6a60a7498ff30d68
4
+ data.tar.gz: d6d321140b14b5386da8431ddb4894a63b1c3a420d015d55adfbdc67e9fe67fb
5
5
  SHA512:
6
- metadata.gz: dfbddec4e8e490a017817e05a1ec9c14b51b655a15f263ab15b2d461118330b34fb1296f8e614d76bbf480893856ad2b0d6202175de786499bbce001d5ce5943
7
- data.tar.gz: 3cc40c6ba443524d7470ee2d331fe20cfb7f86b69067b56d22f957d2d01715334faa668d2e5121062cb5f393503924ce8cb73c5fe8be523cb1b1968d17ebaa2e
6
+ metadata.gz: 83dffe63858be64be98373afa2b8d3b68b8eb4dd659a65e96283dda20518bd7359bddc1e84ed9c3a892db6aacfe33600b6f8e892085597a09ddb1fccb45090e2
7
+ data.tar.gz: ba71675fd11e9bf767e06af79018774b74da072e701d806664bcb8dfffba59fcfa79fe9e5ef80fe0e45734601247fa0376f890ceca85cc543dfd097722b84bf1
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest, windows-latest, macos-latest]
14
+ ruby: [2.5, 2.6, 2.7, 3.0]
15
+ exclude:
16
+ - os: windows-latest
17
+ ruby: 3.0
18
+ runs-on: ${{ matrix.os }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: bundle install
27
+ - name: Run tests
28
+ run: bundle exec rake spec
29
+ env:
30
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
data/README.md CHANGED
@@ -1,6 +1,8 @@
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) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
3
+ ![Coverage Status](https://github.com/opentok/OpenTok-Ruby-SDK/workflows/CI/badge.svg)
4
+ [![codecov](https://codecov.io/gh/opentok/OpenTok-Ruby-SDK/branch/master/graph/badge.svg)](https://codecov.io/gh/opentok/opentok-ruby-sdk)
5
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
4
6
 
5
7
  <img src="https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg" height="48px" alt="Tokbox is now known as Vonage" />
6
8
 
@@ -7,7 +7,7 @@ module OpenTok
7
7
  # The time at which the archive was created, in milliseconds since the UNIX epoch.
8
8
  #
9
9
  # @attr [string] duration
10
- # The duration of the archive, in milliseconds.
10
+ # The duration of the archive, in seconds.
11
11
  #
12
12
  # @attr [string] id
13
13
  # The archive ID.
@@ -49,12 +49,16 @@ module OpenTok
49
49
  # this property and set the outputMode property to "individual", the call the method
50
50
  # results in an error.
51
51
  # @option options [Hash] :layout Specify this to assign the initial layout type for
52
- # the archive. This applies only to composed archives. This is a hash containing two keys:
53
- # <code>:type</code> and <code>:stylesheet<code>. Valid values for <code>:type</code> are
54
- # "bestFit" (best fit), "custom" (custom), "horizontalPresentation" (horizontal presentation),
52
+ # the archive. This applies only to composed archives. This is a hash containing three keys:
53
+ # <code>:type</code>, <code>:stylesheet<code> and <code>:screenshare_type</code>.
54
+ # Valid values for <code>:type</code> are "bestFit" (best fit), "custom" (custom),
55
+ # "horizontalPresentation" (horizontal presentation),
55
56
  # "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
56
57
  # If you specify a "custom" layout type, set the <code>:stylesheet</code> key to the
57
58
  # stylesheet (CSS). (For other layout types, do not set the <code>:stylesheet</code> key.)
59
+ # Valid values for <code>:screenshare_type</code> are "bestFit", "pip",
60
+ # "verticalPresentation", "horizontalPresentation". This property is optional.
61
+ # If it is specified, then the <code>:type</code> property **must** be set to "bestFit".
58
62
  # If you do not specify an initial layout type, the archive uses the best fit
59
63
  # layout type. For more information, see
60
64
  # {https://tokbox.com/developer/guides/archiving/layout-control.html Customizing
@@ -178,6 +182,11 @@ module OpenTok
178
182
  # The stylesheet for a custom layout. Set this parameter
179
183
  # if you set <code>type</code> to <code>"custom"</code>. Otherwise, leave it undefined.
180
184
  #
185
+ # @option options [String] :screenshare_type
186
+ # The screenshare layout type. Set this to "bestFit", "pip", "verticalPresentation" or
187
+ # "horizonalPresentation". If this is defined, then the <code>type</code> parameter
188
+ # must be set to <code>"bestFit"</code>.
189
+ #
181
190
  # @raise [ArgumentError]
182
191
  # The archive_id or options parameter is empty. Or the "custom"
183
192
  # type was specified without a stylesheet option. Or a stylesheet was passed in for a
@@ -208,9 +217,12 @@ module OpenTok
208
217
  raise ArgumentError, "archive_id not provided" if archive_id.to_s.empty?
209
218
  type = options[:type]
210
219
  raise ArgumentError, "custom type must have a stylesheet" if (type.eql? "custom") && (!options.key? :stylesheet)
211
- valid_non_custom_type = ["bestFit","horizontalPresentation","pip", "verticalPresentation", ""].include? type
220
+ valid_non_custom_layouts = ["bestFit","horizontalPresentation","pip", "verticalPresentation", ""]
221
+ valid_non_custom_type = valid_non_custom_layouts.include? type
212
222
  raise ArgumentError, "type is not valid" if !valid_non_custom_type && !(type.eql? "custom")
213
223
  raise ArgumentError, "type is not valid or stylesheet not needed" if valid_non_custom_type and options.key? :stylesheet
224
+ raise ArgumentError, "screenshare_type is not valid" if options[:screenshare_type] && !valid_non_custom_layouts.include?(options[:screenshare_type])
225
+ raise ArgumentError, "type must be set to 'bestFit' if screenshare_type is defined" if options[:screenshare_type] && type != 'bestFit'
214
226
  response = @client.layout_archive(archive_id, options)
215
227
  (200..300).include? response.code
216
228
  end
@@ -22,13 +22,20 @@ module OpenTok
22
22
  # @param [String] session_id The session ID of the OpenTok session to broadcast.
23
23
  #
24
24
  # @param [Hash] options A hash defining options for the broadcast.
25
- # @option options [Hash] :layout Specify this to assign the initial layout for the broadcast.
26
- # Valid values for the layout (<code>:type</code>) property are "bestFit" (best fit), "custom" (custom),
27
- # "horizontalPresentation" (horizontal presentation), "pip" (picture-in-picture), and
28
- # "verticalPresentation" (vertical presentation)).
29
- # If you specify a (<code>:custom</code>) layout type, set the (<code>:stylesheet</code>) property of the layout object
30
- # to the stylesheet. (For other layout types, do not set a stylesheet property.)
31
- # If you do not specify an initial layout type, the broadcast stream uses the Best Fit layout type.
25
+ #
26
+ # @option options [Hash] :layout Specify this to assign the initial layout type for
27
+ # the broadcast. This is a hash containing three keys:
28
+ # <code>:type</code>, <code>:stylesheet<code> and <code>:screenshare_type</code>.
29
+ # Valid values for <code>:type</code> are "bestFit" (best fit), "custom" (custom),
30
+ # "horizontalPresentation" (horizontal presentation),
31
+ # "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).
32
+ # If you specify a "custom" layout type, set the <code>:stylesheet</code> key to the
33
+ # stylesheet (CSS). (For other layout types, do not set the <code>:stylesheet</code> key.)
34
+ # Valid values for <code>:screenshare_type</code> are "bestFit", "pip",
35
+ # "verticalPresentation", "horizontalPresentation". This property is optional.
36
+ # If it is specified, then the <code>:type</code> property **must** be set to "bestFit".
37
+ # If you do not specify an initial layout type, the broadcast uses the best fit
38
+ # layout type.
32
39
  #
33
40
  # @option options [int] maxDuration
34
41
  # The maximum duration for the broadcast, in seconds. The broadcast will automatically stop when
@@ -112,6 +119,11 @@ module OpenTok
112
119
  # The stylesheet for a custom layout. Set this parameter
113
120
  # if you set <code>type</code> to <code>"custom"</code>. Otherwise, leave it undefined.
114
121
  #
122
+ # @option options [String] :screenshare_type
123
+ # The screenshare layout type. Set this to "bestFit", "pip", "verticalPresentation" or
124
+ # "horizonalPresentation". If this is defined, then the <code>type</code> parameter
125
+ # must be set to <code>"bestFit"</code>.
126
+ #
115
127
  # @raise [OpenTokBroadcastError]
116
128
  # The broadcast layout could not be updated.
117
129
  #
@@ -137,9 +149,12 @@ module OpenTok
137
149
  raise ArgumentError, "broadcast_id not provided" if broadcast_id.to_s.empty?
138
150
  type = options[:type]
139
151
  raise ArgumentError, "custom type must have a stylesheet" if (type.eql? "custom") && (!options.key? :stylesheet)
140
- valid_non_custom_type = ["bestFit","horizontalPresentation","pip", "verticalPresentation", ""].include? type
152
+ valid_non_custom_layouts = ["bestFit","horizontalPresentation","pip", "verticalPresentation", ""]
153
+ valid_non_custom_type = valid_non_custom_layouts.include? type
141
154
  raise ArgumentError, "type is not valid" if !valid_non_custom_type && !(type.eql? "custom")
142
155
  raise ArgumentError, "stylesheet not needed" if valid_non_custom_type and options.key? :stylesheet
156
+ raise ArgumentError, "screenshare_type is not valid" if options[:screenshare_type] && !valid_non_custom_layouts.include?(options[:screenshare_type])
157
+ raise ArgumentError, "type must be set to 'bestFit' if screenshare_type is defined" if options[:screenshare_type] && type != 'bestFit'
143
158
  response = @client.layout_broadcast(broadcast_id, options)
144
159
  (200..300).include? response.code
145
160
  end
@@ -1,4 +1,4 @@
1
1
  module OpenTok
2
2
  # @private
3
- VERSION = '4.1.2'
3
+ VERSION = '4.2.0'
4
4
  end
@@ -0,0 +1,50 @@
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","layout":{"type":"bestFit","screenshare_type":"verticalPresentation"}}'
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: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
17
+ Accept: "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 17 Jan 2020 21:15:36 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ {
37
+ "createdAt" : 1395183243556,
38
+ "duration" : 0,
39
+ "id" : "30b3ebf1-ba36-4f5b-8def-6f70d9986fe9",
40
+ "name" : "",
41
+ "partnerId" : 123456,
42
+ "reason" : "",
43
+ "sessionId" : "SESSIONID",
44
+ "size" : 0,
45
+ "status" : "started",
46
+ "url" : null
47
+ }
48
+ http_version:
49
+ recorded_at: Tue, 26 Jan 2021 09:01:36 GMT
50
+ recorded_with: VCR 5.0.0
@@ -67,6 +67,16 @@ describe OpenTok::Archives do
67
67
  expect(archive.session_id).to eq session_id
68
68
  end
69
69
 
70
+ it "should create layout archives with screenshare layout types", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
71
+ screenshare_layout = {
72
+ :type => "bestFit",
73
+ :screenshare_type => "verticalPresentation"
74
+ }
75
+ archive = archives.create session_id, :layout => screenshare_layout
76
+ expect(archive).to be_an_instance_of OpenTok::Archive
77
+ expect(archive.session_id).to eq session_id
78
+ end
79
+
70
80
  it "should stop archives", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
71
81
  archive = archives.stop_by_id started_archive_id
72
82
  expect(archive).to be_an_instance_of OpenTok::Archive
@@ -159,6 +169,25 @@ describe OpenTok::Archives do
159
169
  })
160
170
  }.to raise_error(ArgumentError)
161
171
  end
172
+
173
+ it "raise an error if invalid layout type with screenshare_type" do
174
+ expect {
175
+ archives.layout(started_archive_id, {
176
+ type: "pip",
177
+ screenshare_type: "bestFit"
178
+ })
179
+ }.to raise_error(ArgumentError)
180
+ end
181
+
182
+ it "raise an error if invalid layout screenshare_type" do
183
+ expect {
184
+ archives.layout(started_archive_id, {
185
+ type: "bestFit",
186
+ screenshare_type: "pip1"
187
+ })
188
+ }.to raise_error(ArgumentError)
189
+ end
190
+
162
191
  it "calls layout on archive object", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
163
192
  archive = archives.find findable_archive_id
164
193
  expect(archive).to be_an_instance_of OpenTok::Archive
@@ -172,6 +172,25 @@ describe OpenTok::Broadcasts do
172
172
  })
173
173
  }.to raise_error(ArgumentError)
174
174
  end
175
+
176
+ it "raise an error if invalid layout type with screenshare_type" do
177
+ expect {
178
+ broadcast.layout(started_broadcast_id, {
179
+ type: "pip",
180
+ screenshare_type: "bestFit"
181
+ })
182
+ }.to raise_error(ArgumentError)
183
+ end
184
+
185
+ it "raise an error if invalid layout screenshare_type" do
186
+ expect {
187
+ broadcast.layout(started_broadcast_id, {
188
+ type: "bestFit",
189
+ screenshare_type: "pip1"
190
+ })
191
+ }.to raise_error(ArgumentError)
192
+ end
193
+
175
194
  it "calls layout on broadcast object", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
176
195
  b = broadcast.find started_broadcast_id
177
196
  expect(b).to be_an_instance_of OpenTok::Broadcast
@@ -182,6 +201,7 @@ describe OpenTok::Broadcasts do
182
201
  )
183
202
  }.to raise_error(ArgumentError)
184
203
  end
204
+
185
205
  it "changes the layout of a broadcast", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
186
206
  stub_request(:put, "https://api.opentok.com/v2/project/#{api_key}/broadcast/#{started_broadcast_id}/layout").
187
207
  to_return(status: 200)
@@ -192,4 +212,15 @@ describe OpenTok::Broadcasts do
192
212
  expect(response).not_to be_nil
193
213
  end
194
214
 
215
+ it "changes the screenshare option in the layout of a broadcast", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do
216
+ stub_request(:put, "https://api.opentok.com/v2/project/#{api_key}/broadcast/#{started_broadcast_id}/layout").
217
+ to_return(status: 200)
218
+
219
+ response = broadcast.layout(started_broadcast_id, {
220
+ :type => "bestFit",
221
+ :screenshare_type => "bestFit"
222
+ })
223
+ expect(response).not_to be_nil
224
+ end
225
+
195
226
  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.1.2
4
+ version: 4.2.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: 2020-07-15 00:00:00.000000000 Z
15
+ date: 2021-01-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -170,9 +170,9 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
+ - ".github/workflows/ci.yml"
173
174
  - ".github/workflows/metrics.yml"
174
175
  - ".gitignore"
175
- - ".travis.yml"
176
176
  - ".yardopts"
177
177
  - CODE_OF_CONDUCT.md
178
178
  - CONTRIBUTING.md
@@ -239,6 +239,7 @@ files:
239
239
  - spec/cassettes/OpenTok_Archives/should_create_custom_layout_archives.yml
240
240
  - spec/cassettes/OpenTok_Archives/should_create_hd_archives.yml
241
241
  - spec/cassettes/OpenTok_Archives/should_create_individual_archives.yml
242
+ - spec/cassettes/OpenTok_Archives/should_create_layout_archives_with_screenshare_layout_types.yml
242
243
  - spec/cassettes/OpenTok_Archives/should_create_named_archives.yml
243
244
  - spec/cassettes/OpenTok_Archives/should_delete_an_archive_by_id.yml
244
245
  - spec/cassettes/OpenTok_Archives/should_find_archives_by_id.yml
@@ -305,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
306
  - !ruby/object:Gem::Version
306
307
  version: '0'
307
308
  requirements: []
308
- rubygems_version: 3.0.0
309
+ rubygems_version: 3.1.4
309
310
  signing_key:
310
311
  specification_version: 4
311
312
  summary: Ruby gem for the OpenTok API
@@ -318,6 +319,7 @@ test_files:
318
319
  - spec/cassettes/OpenTok_Archives/should_create_custom_layout_archives.yml
319
320
  - spec/cassettes/OpenTok_Archives/should_create_hd_archives.yml
320
321
  - spec/cassettes/OpenTok_Archives/should_create_individual_archives.yml
322
+ - spec/cassettes/OpenTok_Archives/should_create_layout_archives_with_screenshare_layout_types.yml
321
323
  - spec/cassettes/OpenTok_Archives/should_create_named_archives.yml
322
324
  - spec/cassettes/OpenTok_Archives/should_delete_an_archive_by_id.yml
323
325
  - spec/cassettes/OpenTok_Archives/should_find_archives_by_id.yml
@@ -1,17 +0,0 @@
1
- # Get container-based infrastructure
2
- sudo: false
3
- language: ruby
4
- # Travis bug, see https://github.com/bundler/bundler/pull/3559
5
- cache: bundler
6
- before_install: gem update bundler
7
- rvm:
8
- - 2.1
9
- - 2.2
10
- - 2.3
11
- - 2.4
12
- - 2.5
13
- - 2.6
14
- - 2.7
15
- notifications:
16
- slack:
17
- secure: agVll2R9PTPvJMcUgbvOh9eGt60zGDc8kPUwEsiQr828rCgXh/ZxD5irYDyKQg3ZsS8+f3MjFCwzU7uQALkia2pDrie9d8g8m1dt4Q5U7Qm6QecshvE0U9JwbB5Ngxaftbqyf0XEFrE7CKs7RI1BzFRpe8m+fdZgfwccX8Gb7pc=