From e50736d7d78f184e90c1e243bf00dc9da473647a Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 14:38:06 +0000 Subject: [PATCH 1/6] Adding test for stream_mode --- spec/opentok/archives_spec.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/opentok/archives_spec.rb b/spec/opentok/archives_spec.rb index 027d6d0..5798704 100644 --- a/spec/opentok/archives_spec.rb +++ b/spec/opentok/archives_spec.rb @@ -44,7 +44,7 @@ it "should create an archives with a specified multiArchiveTag", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do archive_tag = 'archive-1' - archive = archives.create session_id, :multiArchiveTag => archive_tag + archive = archives.create session_id, :multi_archive_tag => archive_tag expect(archive).to be_an_instance_of OpenTok::Archive expect(archive.session_id).to eq session_id expect(archive.multiArchiveTag).to eq archive_tag @@ -52,7 +52,7 @@ 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 archive_tag = 'archive-1' - archive = archives.create session_id, :multiArchiveTag => archive_tag + archive = archives.create session_id, :multi_archive_tag => archive_tag expect(archive).to be_an_instance_of OpenTok::Archive expect(archive.multi_archive_tag).to eq archive_tag end @@ -63,6 +63,13 @@ expect(archive.multi_archive_tag).to be_nil end + 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 + stream_mode = 'manual' + archive = archives.create session_id, :stream_mode => stream_mode + expect(archive).to be_an_instance_of OpenTok::Archive + expect(archive.stream_mode).to eq stream_mode + end + it "should create audio only archives", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" } } do archive = archives.create session_id, :has_video => false expect(archive).to be_an_instance_of OpenTok::Archive From 2e99f7b19a6731fe8ab3f5b33c60dda2d9b39727 Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 14:38:29 +0000 Subject: [PATCH 2/6] Adding stream_mode ivar and getter --- lib/opentok/archive.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/opentok/archive.rb b/lib/opentok/archive.rb index 0be13a9..0ef6f93 100644 --- a/lib/opentok/archive.rb +++ b/lib/opentok/archive.rb @@ -72,13 +72,14 @@ module OpenTok # set to null. The download URL is obfuscated, and the file is only available from the URL for # 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method. class Archive - attr_reader :multi_archive_tag + attr_reader :multi_archive_tag, :stream_mode # @private def initialize(interface, json) @interface = interface # TODO: validate json fits schema @json = json @multi_archive_tag = @json['multiArchiveTag'] + @stream_mode = @json['streamMode'] end # A JSON-encoded string representation of the archive. From 45029e50d5e0454dec0ae2742e319aab1bca67a5 Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 14:38:53 +0000 Subject: [PATCH 3/6] Updating valid_opts and doce comments --- lib/opentok/archives.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/opentok/archives.rb b/lib/opentok/archives.rb index 30269a6..e3db3cf 100644 --- a/lib/opentok/archives.rb +++ b/lib/opentok/archives.rb @@ -39,11 +39,11 @@ def initialize(client) # (a video track is included). If you set both has_audio and # has_video to false, the call to the create() # method results in an error. - # @option options [String] :multiArchiveTag (Optional) Set this to support recording multiple archives for the same session simultaneously. + # @option options [String] :multi_archive_tag (Optional) Set this to support recording multiple archives for the same session simultaneously. # 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 # that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}. Note that the `multiArchiveTag` value is not included # in the response for the methods to {https://tokbox.com/developer/rest/#listing_archives list archives} and - # {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multiArchiveTag`, + # {https://tokbox.com/developer/rest/#retrieve_archive_info retrieve archive information}. If you do not specify a unique `multi_archive_tag`, # you can only record one archive at a time for a given session. # {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}. # @option options [String] :output_mode Whether all streams in the archive are recorded @@ -56,7 +56,7 @@ def initialize(client) # (HD portrait), or "1080x1920" (FHD portrait). This property only applies to composed archives. If you set # this property and set the outputMode property to "individual", a call to the method # results in an error. - # @option options [String] :streamMode (Optional) Whether streams included in the archive are selected + # @option options [String] :stream_mode (Optional) Whether streams included in the archive are selected # automatically ("auto", the default) or manually ("manual"). When streams are selected automatically ("auto"), # all streams in the session can be included in the archive. When streams are selected manually ("manual"), # you specify streams to be included based on calls to the {Archives#add_stream} method. You can specify whether a @@ -104,8 +104,8 @@ def create(session_id, options = {}) :output_mode, :resolution, :layout, - :multiArchiveTag, - :streamMode + :multi_archive_tag, + :stream_mode ] opts = options.inject({}) do |m,(k,v)| if valid_opts.include? k.to_sym From 98ddfe4e1c82d6c2b8c3d0efd7c0f77cb293393c Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 14:39:12 +0000 Subject: [PATCH 4/6] Adding VCR cassette for stream_mode test --- ...ode_set_to_specified_stream_mode_value.yml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml diff --git a/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml b/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml new file mode 100644 index 0000000..22cc62f --- /dev/null +++ b/spec/cassettes/OpenTok_Archives/should_create_an_archive_with_streamMode_set_to_specified_stream_mode_value.yml @@ -0,0 +1,52 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.opentok.com/v2/project/123456/archive + body: + encoding: UTF-8 + string: '{"sessionId":"SESSIONID","streamMode":"manual"}' + headers: + User-Agent: + - OpenTok-Ruby-SDK/<%= version %> + X-Opentok-Auth: + - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120 + Content-Type: + - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Wed, 03 Jan 2024 14:32:20 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + body: + encoding: UTF-8 + string: |- + { + "createdAt" : 1395183243556, + "duration" : 0, + "id" : "30b3ebf1-ba36-4f5b-8def-6f70d9986fe9", + "name" : "", + "partnerId" : 123456, + "reason" : "", + "sessionId" : "SESSIONID", + "size" : 0, + "status" : "started", + "url" : null, + "streamMode":"manual" + } + recorded_at: Tue, 18 Apr 2017 10:17:40 GMT +recorded_with: VCR 6.0.0 From 1808cdbf7c2fdfd617cc4e17daf215c56f2a82b9 Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 14:39:33 +0000 Subject: [PATCH 5/6] Bumping patch version --- lib/opentok/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/opentok/version.rb b/lib/opentok/version.rb index 21e8329..a6adfcf 100644 --- a/lib/opentok/version.rb +++ b/lib/opentok/version.rb @@ -1,4 +1,4 @@ module OpenTok # @private - VERSION = '4.8.0' + VERSION = '4.8.1' end From d8153a88a6b5a51178b1e96d43538bb3715b1f53 Mon Sep 17 00:00:00 2001 From: superchilled Date: Wed, 3 Jan 2024 15:40:09 +0000 Subject: [PATCH 6/6] Updating changelog --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 6ab0eea..4ef5162 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +# 4.8.1 + +* 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) + # 4.8.0 * Add support for Captions API [#267](https://github.com/opentok/OpenTok-Ruby-SDK/pull/267)