opentok 4.6.0 → 4.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0021225949fed3de846b22c82a91de9a62d5b6a1dd3c272377cd96d0ebe0dffc'
4
- data.tar.gz: acdc9387e49e85384f25970be630fcbd7a3d6d2e6abe335ed062c2b670eeaed9
3
+ metadata.gz: 79b0b3d6e3be3dd4a73ec63d8f2be58973c2db372bd1fe56257c6a990b66b544
4
+ data.tar.gz: 7a468b0466b4aa3dce26a543667e1491add67df02fe0a78de4fb437ebd0d5b0b
5
5
  SHA512:
6
- metadata.gz: d8d9704ef411eae5a133ab8bd69846f6fc2f9a671e5480e033400abf157e984b2f3e06efbe5e57eac15a832baa95b7ce6b85e28b2fd5c46039a9407c764ab5e4
7
- data.tar.gz: 63e762828405233f30260842206f837ef25ea1e3156dc5cc3ff339fc6fa46b5ce4eb99f0ebbf096e707c35719c191b2f419a0c31f06fb01e1332b6d8339e1c8c
6
+ metadata.gz: 5e5ecc34657bb50eaf4da9951a205b12c23fd4379c6c3e2fc484fab2f2911c622ff85221412dd2aa774605bdda737966d561d6ada4b49816fbb21e687abfb22b
7
+ data.tar.gz: 5888fdc7ab677937f3e17e7c5cb293fdccaff970f75099a7900ef4b75bc12916bd843460247f2426e2345122537b23f8bb5c3955e567f1ad94d0f4dc3a757f8c
data/CHANGES.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 4.7.1
2
+
3
+ * Updates docs comments for `Broadcasts` and `Sip` [#266](https://github.com/opentok/OpenTok-Ruby-SDK/pull/266)
4
+
5
+ # 4.7.0
6
+
7
+ * Adds support for the End-to-end encryption (E2EE) feature [#259](https://github.com/opentok/OpenTok-Ruby-SDK/pull/259)
8
+ * Implements Auto-archive improvements [#262](https://github.com/opentok/OpenTok-Ruby-SDK/pull/262)
9
+ * Updates the README to explain appending a custom value to the `UserAgent` header [#263](https://github.com/opentok/OpenTok-Ruby-SDK/pull/263)
10
+
1
11
  # 4.6.0
2
12
 
3
13
  * Adds functionality for working with the Audio Connector feature [#247](https://github.com/opentok/OpenTok-Ruby-SDK/pull/247)
data/README.md CHANGED
@@ -59,6 +59,8 @@ opentok = OpenTok::OpenTok.new api_key, api_secret
59
59
 
60
60
  #### Initialization Options
61
61
 
62
+ **Custom Timeout**
63
+
62
64
  You can specify a custom timeout value for HTTP requests when initializing a new `OpenTok::OpenTok`
63
65
  object:
64
66
 
@@ -71,6 +73,23 @@ opentok = OpenTok::OpenTok.new api_key, api_secret, :timeout_length => 10
71
73
  The value for `:timeout_length` is an integer representing the number of seconds to wait for an HTTP
72
74
  request to complete. The default is set to 2 seconds.
73
75
 
76
+ **UA Addendum**
77
+
78
+ You can also append a custom string to the `User-Agent` header value for HTTP requests when initializing a new `OpenTok::OpenTok`
79
+ object:
80
+
81
+ ```ruby
82
+ require "opentok"
83
+
84
+ opentok = OpenTok::OpenTok.new api_key, api_secret, :ua_addendum => 'FOO'
85
+ ```
86
+
87
+ The above would generate a `User-Agent` header something like this:
88
+
89
+ ```
90
+ User-Agent: OpenTok-Ruby-SDK/4.6.0-Ruby-Version-3.1.2-p20 FOO
91
+ ```
92
+
74
93
  ### Creating Sessions
75
94
 
76
95
  To create an OpenTok Session, use the `OpenTok#create_session(properties)` method.
@@ -101,6 +120,9 @@ session = opentok.create_session :location => '12.34.56.78'
101
120
  # A session with automatic archiving (must use the routed media mode):
102
121
  session = opentok.create_session :archive_mode => :always, :media_mode => :routed
103
122
 
123
+ # A session with end-to-end encryption (must use the routed media mode):
124
+ session = opentok.create_session :e2ee => true, :media_mode => :routed
125
+
104
126
  # Store this sessionId in the database for later use:
105
127
  session_id = session.session_id
106
128
  ```
@@ -19,6 +19,15 @@ module OpenTok
19
19
  # @attr [int] updated_at
20
20
  # For this start method, this timestamp matches the createdAt timestamp.
21
21
  #
22
+ # @attr [int] maxBitRate
23
+ # The maximum bitrate for the broadcast stream(s), in bits per second.
24
+ #
25
+ # @attr [boolean] hasAudio
26
+ # The broadcast has audio enabled
27
+ #
28
+ # @attr [boolean] hasVideo
29
+ # The broadcast has video enabled
30
+ #
22
31
  # @attr [string] resolution
23
32
  # The resolution of the broadcast: either "640x480" (SD landscape, the default), "1280x720" (HD landscape),
24
33
  # "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait).
@@ -33,6 +42,12 @@ module OpenTok
33
42
  # You can include HLS, RTMP, or both as broadcast streams. If you include RTMP streaming,
34
43
  # you can specify up to five target RTMP streams (or just one).
35
44
  # The (<code>:hls</code>) property is set to an empty [Hash] object. The HLS URL is returned in the response.
45
+ # The `hlsStatus` property is set to one of the following:
46
+ # - "connecting" — The OpenTok server is in the process of starting transcoders. This is the initial state.
47
+ # - "ready" — The OpenTok server has succesfully initialized but the CDN is not consuming media.
48
+ # - "live" — The OpenTok server has succesfully initialized and the CDN is consuming media.
49
+ # - "ended" — The source stream has ended. If DVR is enabled and pre-recorded media is requested, then the status will transition to "live".
50
+ # - "error" — There is an error in the OpenTok platform.
36
51
  # The (<code>:rtmp</code>) property is set to an [Array] of Rtmp [Hash] properties.
37
52
  # For each RTMP stream, specify (<code>:serverUrl</code>) for the RTMP server URL,
38
53
  # (<code>:streamName</code>) such as the YouTube Live stream name or the Facebook stream key),
@@ -37,12 +37,16 @@ module OpenTok
37
37
  # If you do not specify an initial layout type, the broadcast uses the best fit
38
38
  # layout type.
39
39
  #
40
- # @option options [String] :multiBroadcastTag (Optional) Set this to support multiple broadcasts for the same session simultaneously.
41
- # Set this to a unique string for each simultaneous broadcast of an ongoing session. Note that the `multiBroadcastTag` value is *not* included
42
- # in the response for the methods to {https://tokbox.com/developer/rest/#list_broadcasts list live streaming broadcasts} and
43
- # {https://tokbox.com/developer/rest/#get_info_broadcast get information about a live streaming broadcast}.
40
+ # @option options [String] :multiBroadcastTag (Optional) Set this to support multiple broadcasts for the same session simultaneously.
41
+ # Set this to a unique string for each simultaneous broadcast of an ongoing session. Note that the `multiBroadcastTag` value is *not* included
42
+ # in the response for the methods to {https://tokbox.com/developer/rest/#list_broadcasts list live streaming broadcasts} and
43
+ # {https://tokbox.com/developer/rest/#get_info_broadcast get information about a live streaming broadcast}.
44
44
  # {https://tokbox.com/developer/guides/broadcast/live-streaming#simultaneous-broadcasts See Simultaneous broadcasts}.
45
45
  #
46
+ # @option options [int] maxBitRate
47
+ # The maximum bitrate for the broadcast stream(s), in bits per second.
48
+ # The minimum value is 100,000 and the maximum is 6,000,000.
49
+ #
46
50
  # @option options [int] maxDuration
47
51
  # The maximum duration for the broadcast, in seconds. The broadcast will automatically stop when
48
52
  # the maximum duration is reached. You can set the maximum duration to a value from 60 (60 seconds) to 36000 (10 hours).
@@ -95,6 +99,10 @@ module OpenTok
95
99
  # on {https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules stream prioritization rules}.
96
100
  # Important: this feature is currently available in the Standard environment only.
97
101
  #
102
+ # @option options [Boolean] :hasAudio Whether the broadcast has audio (default `true`)
103
+ #
104
+ # @option options [Boolean] :hasVideo Whether the broadcast has video (default `true`)
105
+ #
98
106
  # @return [Broadcast] The broadcast object, which includes properties defining the broadcast,
99
107
  # including the broadcast ID.
100
108
  #
@@ -144,11 +144,26 @@ module OpenTok
144
144
  # automatically (<code>:always</code>) or not (<code>:manual</code>). When using automatic
145
145
  # archiving, the session must use the <code>:routed</code> media mode.
146
146
  #
147
+ # @option opts [Symbol] :archive_name The name to use for archives in auto-archived sessions.
148
+ # When setting this option, the :archive_mode option must be set to :always or an error will result.
149
+ # The length of the archive name can be up to 80 chars.
150
+ # Due to encoding limitations the following special characters are translated to a colon (:) character: ~, -, _.
151
+ # If you do not set a name and the archiveMode option is set to always, the archive name will be empty.
152
+ #
153
+ # @option opts [Symbol] :archive_resolution The resolution of archives in an auto-archived session.
154
+ # Valid values are "480x640", "640x480" (the default), "720x1280", "1280x720", "1080x1920", and "1920x1080".
155
+ # When setting this option, the :archive_mode option must be set to :always or an error will result.
156
+ #
157
+ # @option opts [true, false] :e2ee
158
+ # (Boolean, optional) — Whether the session uses end-to-end encryption from client to client (default: false).
159
+ # This should not be set to `true` if `:media_mode` is `:relayed`.
160
+ # See the {https://tokbox.com/developer/guides/end-to-end-encryption/ documentation} for more information.
161
+ #
147
162
  # @return [Session] The Session object. The session_id property of the object is the session ID.
148
163
  def create_session(opts={})
149
164
 
150
165
  # normalize opts so all keys are symbols and only include valid_opts
151
- valid_opts = [ :media_mode, :location, :archive_mode ]
166
+ valid_opts = [ :media_mode, :location, :archive_mode, :archive_name, :archive_resolution, :e2ee ]
152
167
  opts = opts.inject({}) do |m,(k,v)|
153
168
  if valid_opts.include? k.to_sym
154
169
  m[k.to_sym] = v
@@ -159,6 +174,13 @@ module OpenTok
159
174
  # keep opts around for Session constructor, build REST params
160
175
  params = opts.clone
161
176
 
177
+ # validate input combinations
178
+ raise ArgumentError, "A session with always archive mode must also have the routed media mode." if (params[:archive_mode] == :always && params[:media_mode] == :relayed)
179
+
180
+ raise ArgumentError, "A session with relayed media mode should not have e2ee set to true." if (params[:media_mode] == :relayed && params[:e2ee] == true)
181
+
182
+ raise ArgumentError, "A session with always archive mode must not have e2ee set to true." if (params[:archive_mode] == :always && params[:e2ee] == true)
183
+
162
184
  # anything other than :relayed sets the REST param to "disabled", in which case we force
163
185
  # opts to be :routed. if we were more strict we could raise an error when the value isn't
164
186
  # either :relayed or :routed
@@ -175,10 +197,9 @@ module OpenTok
175
197
  # archive mode is optional, but it has to be one of the valid values if present
176
198
  unless params[:archive_mode].nil?
177
199
  raise "archive mode must be either always or manual" unless ARCHIVE_MODES.include? params[:archive_mode].to_sym
200
+ raise ArgumentError, "archive name and/or archive resolution must not be set if archive mode is manual" if params[:archive_mode] == :manual && (params[:archive_name] || params[:archive_resolution])
178
201
  end
179
202
 
180
- raise "A session with always archive mode must also have the routed media mode." if (params[:archive_mode] == :always && params[:media_mode] == :relayed)
181
-
182
203
  response = client.create_session(params)
183
204
  Session.new api_key, api_secret, response['sessions']['Session']['session_id'], opts
184
205
  end
@@ -20,6 +20,10 @@ module OpenTok
20
20
  # @attr_reader [String] archive_mode Whether the session will be archived automatically
21
21
  # (<code>:always</code>) or not (<code>:manual</code>).
22
22
  #
23
+ # @attr_reader [String] archive_name The name to use for archives in auto-archived sessions.
24
+ #
25
+ # @attr_reader [String] :archive_resolution The resolution of archives in an auto-archived session.
26
+ #
23
27
  # @!method generate_token(options)
24
28
  # Generates a token.
25
29
  #
@@ -57,7 +61,7 @@ module OpenTok
57
61
  :session_id => ->(instance) { instance.session_id }
58
62
  })
59
63
 
60
- attr_reader :session_id, :media_mode, :location, :archive_mode, :api_key, :api_secret
64
+ attr_reader :session_id, :media_mode, :location, :archive_mode, :archive_name, :archive_resolution, :e2ee, :api_key, :api_secret
61
65
 
62
66
  # @private
63
67
  # this implementation doesn't completely understand the format of a Session ID
@@ -73,7 +77,12 @@ module OpenTok
73
77
  # @private
74
78
  def initialize(api_key, api_secret, session_id, opts={})
75
79
  @api_key, @api_secret, @session_id = api_key, api_secret, session_id
76
- @media_mode, @location, @archive_mode = opts.fetch(:media_mode, :relayed), opts[:location], opts.fetch(:archive_mode, :manual)
80
+ @media_mode = opts.fetch(:media_mode, :relayed)
81
+ @location = opts[:location]
82
+ @archive_mode = opts.fetch(:archive_mode, :manual)
83
+ @archive_name = opts.fetch(:archive_name, '') if archive_mode == :always
84
+ @archive_resolution = opts.fetch(:archive_resolution, "640x480") if archive_mode == :always
85
+ @e2ee = opts.fetch(:e2ee, :false)
77
86
  end
78
87
 
79
88
  # @private
data/lib/opentok/sip.rb CHANGED
@@ -38,13 +38,15 @@ module OpenTok
38
38
  # @option opts [true, false] :secure Whether the media must be transmitted
39
39
  # encrypted (​true​) or not (​false​, the default).
40
40
  # @option opts [true, false] :video Whether the SIP call will include
41
- # video (​true​) or not (​false​, the default). With video included, the SIP
42
- # client's video is included in the OpenTok stream that is sent to the
43
- # OpenTok session. The SIP client will receive a single composed video of
44
- # the published streams in the OpenTok session.
41
+ # video (​true​) or not (​false​, the default). With video included, the SIP
42
+ # client's video is included in the OpenTok stream that is sent to the
43
+ # OpenTok session. The SIP client will receive a single composed video of
44
+ # the published streams in the OpenTok session.
45
45
  # @option opts [true, false] :observe_force_mute Whether the SIP end point
46
- # observes {https://tokbox.com/developer/guides/moderation/#force_mute force mute moderation}
47
- # (true) or not (false, the default).
46
+ # observes {https://tokbox.com/developer/guides/moderation/#force_mute force mute moderation}
47
+ # (true) or not (false, the default).
48
+ # @option opts [Array] :streams An array of stream IDs for streams to include in the SIP call.
49
+ # If you do not set this property, all streams in the session are included in the call.
48
50
  def dial(session_id, token, sip_uri, opts)
49
51
  response = @client.dial(session_id, token, sip_uri, opts)
50
52
  end
@@ -1,4 +1,4 @@
1
1
  module OpenTok
2
2
  # @private
3
- VERSION = '4.6.0'
3
+ VERSION = '4.7.1'
4
4
  end
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/session/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: archiveMode=always&archiveName=foo&p2p.preference=disabled
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Mon, 12 Jun 2023 16:17:36 GMT
27
+ Content-Type:
28
+ - text/xml
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ X-Tb-Host:
34
+ - fms503-nyc.tokbox.com
35
+ Content-Length:
36
+ - '282'
37
+ body:
38
+ encoding: UTF-8
39
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
40
+ Jun 12 16:17:36 GMT 2023</create_dt></Session></sessions>
41
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
42
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/session/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: archiveMode=always&archiveName=foo&archiveResolution=720x1280&p2p.preference=disabled
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Mon, 12 Jun 2023 16:17:36 GMT
27
+ Content-Type:
28
+ - text/xml
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ X-Tb-Host:
34
+ - fms503-nyc.tokbox.com
35
+ Content-Length:
36
+ - '282'
37
+ body:
38
+ encoding: UTF-8
39
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
40
+ Jun 12 16:17:36 GMT 2023</create_dt></Session></sessions>
41
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
42
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/session/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: archiveMode=always&archiveResolution=720x1280&p2p.preference=disabled
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Mon, 12 Jun 2023 16:17:36 GMT
27
+ Content-Type:
28
+ - text/xml
29
+ Connection:
30
+ - keep-alive
31
+ Access-Control-Allow-Origin:
32
+ - '*'
33
+ X-Tb-Host:
34
+ - fms503-nyc.tokbox.com
35
+ Content-Length:
36
+ - '282'
37
+ body:
38
+ encoding: UTF-8
39
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
40
+ Jun 12 16:17:36 GMT 2023</create_dt></Session></sessions>
41
+ recorded_at: Tue, 18 Apr 2017 10:17:40 GMT
42
+ recorded_with: VCR 6.0.0
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/session/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: e2ee=true&p2p.preference=disabled
9
+ headers:
10
+ User-Agent:
11
+ - OpenTok-Ruby-SDK/<%= version %>
12
+ X-Opentok-Auth:
13
+ - eyJpc3QiOiJwcm9qZWN0IiwiYWxnIjoiSFMyNTYifQ.eyJpc3MiOiIxMjM0NTYiLCJpYXQiOjE0OTI1MTA2NjAsImV4cCI6MTQ5MjUxMDk2MH0.BplMVhJWx4ld7KLKXqEmow6MjNPPFw9W8IHCMfeb120
14
+ Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
15
+ Accept: "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx
23
+ Date:
24
+ - Tue, 18 Apr 2023 16:17:40 GMT
25
+ Content-Type:
26
+ - text/xml
27
+ Connection:
28
+ - keep-alive
29
+ Access-Control-Allow-Origin:
30
+ - '*'
31
+ X-Tb-Host:
32
+ - mantis503-nyc.tokbox.com
33
+ Content-Length:
34
+ - '304'
35
+ body:
36
+ encoding: UTF-8
37
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-MTIuMzQuNTYuNzh-TW9uIE1hciAxNyAwMTo0ODo1NSBQRFQgMjAxNH4wLjM0MTM0MzE0MDIyOTU4Mjh-</session_id><partner_id>123456</partner_id><create_dt>Tue
38
+ Apr 18 08:17:40 PDT 2023</create_dt></Session></sessions>
39
+ recorded_at: Tue, 18 Apr 2023 16:17:40 GMT
40
+ recorded_with: VCR 6.0.0
@@ -97,6 +97,7 @@ describe OpenTok::OpenTok do
97
97
  expect(session.media_mode).to eq :relayed
98
98
  expect(session.location).to eq nil
99
99
  end
100
+
100
101
  it "creates always archived sessions", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
101
102
  session = opentok.create_session :media_mode => :routed, :archive_mode => :always
102
103
  expect(session).to be_an_instance_of OpenTok::Session
@@ -105,9 +106,80 @@ describe OpenTok::OpenTok do
105
106
  expect(session.location).to eq nil
106
107
  end
107
108
 
109
+ it "creates always archived sessions with a set archive name", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
110
+ session = opentok.create_session :media_mode => :routed, :archive_mode => :always, :archive_name => 'foo'
111
+ expect(session).to be_an_instance_of OpenTok::Session
112
+ expect(session.session_id).to be_an_instance_of String
113
+ expect(session.archive_mode).to eq :always
114
+ expect(session.archive_name).to eq 'foo'
115
+ expect(session.location).to eq nil
116
+ end
117
+
118
+ it "creates always archived sessions with a set archive resolution", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
119
+ session = opentok.create_session :media_mode => :routed, :archive_mode => :always, :archive_resolution => "720x1280"
120
+ expect(session).to be_an_instance_of OpenTok::Session
121
+ expect(session.session_id).to be_an_instance_of String
122
+ expect(session.archive_mode).to eq :always
123
+ expect(session.archive_resolution).to eq "720x1280"
124
+ expect(session.location).to eq nil
125
+ end
126
+
127
+ it "creates always archived sessions with a set archive name and resolution", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
128
+ session = opentok.create_session :media_mode => :routed, :archive_mode => :always, :archive_name => 'foo', :archive_resolution => "720x1280"
129
+ expect(session).to be_an_instance_of OpenTok::Session
130
+ expect(session.session_id).to be_an_instance_of String
131
+ expect(session.archive_mode).to eq :always
132
+ expect(session.archive_name).to eq 'foo'
133
+ expect(session.archive_resolution).to eq "720x1280"
134
+ expect(session.location).to eq nil
135
+ end
136
+
137
+ it "creates e2ee sessions", :vcr => { :erb => { :version => OpenTok::VERSION + "-Ruby-Version-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"} } do
138
+ session = opentok.create_session :media_mode => :routed, :e2ee => :true
139
+ expect(session).to be_an_instance_of OpenTok::Session
140
+ expect(session.session_id).to be_an_instance_of String
141
+ expect(session.e2ee).to eq :true
142
+ expect(session.location).to eq nil
143
+ end
144
+
108
145
  context "with relayed media mode and always archive mode" do
109
- subject { -> { session = opentok.create_session :archive_mode => :always, :media_mode => :relayed }}
110
- it { should raise_error }
146
+ it "raises an error" do
147
+ expect {
148
+ opentok.create_session :archive_mode => :always, :media_mode => :relayed
149
+ }.to raise_error ArgumentError
150
+ end
151
+ end
152
+
153
+ context "with archive name set and manual archive mode" do
154
+ it "raises an error" do
155
+ expect {
156
+ opentok.create_session :archive_mode => :manual, :archive_name => 'foo'
157
+ }.to raise_error ArgumentError
158
+ end
159
+ end
160
+
161
+ context "with archive resolution set and manual archive mode" do
162
+ it "raises an error" do
163
+ expect {
164
+ opentok.create_session :archive_mode => :manual, :archive_resolution => "720x1280"
165
+ }.to raise_error ArgumentError
166
+ end
167
+ end
168
+
169
+ context "with relayed media mode and e2ee set to true" do
170
+ it "raises an error" do
171
+ expect {
172
+ opentok.create_session :media_mode => :relayed, :e2ee => true
173
+ }.to raise_error ArgumentError
174
+ end
175
+ end
176
+
177
+ context "with always archive mode and e2ee set to true" do
178
+ it "raises an error" do
179
+ expect {
180
+ opentok.create_session :archive_mode => :always, :e2ee => true
181
+ }.to raise_error ArgumentError
182
+ end
111
183
  end
112
184
 
113
185
  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.6.0
4
+ version: 4.7.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: 2023-03-09 00:00:00.000000000 Z
15
+ date: 2023-08-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -282,7 +282,11 @@ files:
282
282
  - spec/cassettes/OpenTok_Broadcasts/stops_a_broadcast.yml
283
283
  - spec/cassettes/OpenTok_Connections/forces_a_connection_to_be_terminated.yml
284
284
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions.yml
285
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_name.yml
286
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_name_and_resolution.yml
287
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_resolution.yml
285
288
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_default_sessions.yml
289
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_e2ee_sessions.yml
286
290
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions.yml
287
291
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_for_invalid_media_modes.yml
288
292
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_with_a_location_hint.yml
@@ -394,7 +398,11 @@ test_files:
394
398
  - spec/cassettes/OpenTok_Broadcasts/stops_a_broadcast.yml
395
399
  - spec/cassettes/OpenTok_Connections/forces_a_connection_to_be_terminated.yml
396
400
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions.yml
401
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_name.yml
402
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_name_and_resolution.yml
403
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions_with_a_set_archive_resolution.yml
397
404
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_default_sessions.yml
405
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_e2ee_sessions.yml
398
406
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions.yml
399
407
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_for_invalid_media_modes.yml
400
408
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_relayed_media_sessions_with_a_location_hint.yml