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) 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. 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 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 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 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