opentok 2.2.4 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -17
  3. data/doc/OpenTok.html +20 -13
  4. data/doc/OpenTok/Archive.html +350 -68
  5. data/doc/OpenTok/ArchiveList.html +3 -3
  6. data/doc/OpenTok/Archives.html +114 -42
  7. data/doc/OpenTok/HashExtensions.html +184 -0
  8. data/doc/OpenTok/OpenTok.html +89 -44
  9. data/doc/OpenTok/OpenTokArchiveError.html +3 -3
  10. data/doc/OpenTok/OpenTokAuthenticationError.html +3 -3
  11. data/doc/OpenTok/OpenTokError.html +3 -3
  12. data/doc/OpenTok/Session.html +116 -24
  13. data/doc/_index.html +22 -7
  14. data/doc/class_list.html +6 -2
  15. data/doc/file.README.html +3 -3
  16. data/doc/file_list.html +5 -1
  17. data/doc/frames.html +1 -1
  18. data/doc/index.html +3 -3
  19. data/doc/js/full_list.js +4 -1
  20. data/doc/method_list.html +45 -11
  21. data/doc/top-level-namespace.html +3 -3
  22. data/lib/extensions/hash.rb +12 -0
  23. data/lib/opentok/archive.rb +22 -2
  24. data/lib/opentok/archives.rb +33 -6
  25. data/lib/opentok/client.rb +21 -4
  26. data/lib/opentok/constants.rb +1 -0
  27. data/lib/opentok/opentok.rb +25 -13
  28. data/lib/opentok/session.rb +6 -3
  29. data/lib/opentok/version.rb +1 -1
  30. data/sample/Archiving/README.md +16 -10
  31. data/sample/Archiving/archiving_sample.rb +6 -3
  32. data/sample/Archiving/public/js/host.js +25 -12
  33. data/sample/Archiving/views/host.erb +24 -0
  34. data/sample/HelloWorld/README.md +1 -1
  35. data/spec/cassettes/OpenTok_Archives/should_create_archives.yml +1 -1
  36. data/spec/cassettes/OpenTok_Archives/should_create_audio_only_archives.yml +50 -0
  37. data/spec/cassettes/OpenTok_Archives/should_create_individual_archives.yml +51 -0
  38. data/spec/cassettes/OpenTok_Archives/should_find_paused_archives_by_id.yml +46 -0
  39. data/spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_always_archived_sessions.yml +39 -0
  40. data/spec/opentok/archives_spec.rb +32 -0
  41. data/spec/opentok/opentok_spec.rb +27 -3
  42. data/spec/spec_helper.rb +1 -0
  43. metadata +36 -26
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
6
  <title>
7
- Documentation by YARD 0.8.7.4
7
+ Documentation by YARD 0.8.7.6
8
8
 
9
9
  </title>
10
10
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  <iframe id="search_frame"></iframe>
58
58
 
59
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7.4</h1>
59
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7.6</h1>
60
60
  <div id="listing">
61
61
  <h1 class="alphaindex">Alphabetic Index</h1>
62
62
 
@@ -109,15 +109,25 @@
109
109
  </ul>
110
110
 
111
111
 
112
- <ul id="alpha_O" class="alpha">
113
- <li class="letter">O</li>
112
+ <ul id="alpha_H" class="alpha">
113
+ <li class="letter">H</li>
114
114
  <ul>
115
115
 
116
116
  <li>
117
- <span class='object_link'><a href="OpenTok.html" title="OpenTok (module)">OpenTok</a></span>
117
+ <span class='object_link'><a href="OpenTok/HashExtensions.html" title="OpenTok::HashExtensions (module)">HashExtensions</a></span>
118
+
119
+ <small>(OpenTok)</small>
118
120
 
119
121
  </li>
120
122
 
123
+ </ul>
124
+ </ul>
125
+
126
+
127
+ <ul id="alpha_O" class="alpha">
128
+ <li class="letter">O</li>
129
+ <ul>
130
+
121
131
  <li>
122
132
  <span class='object_link'><a href="OpenTok/OpenTok.html" title="OpenTok::OpenTok (class)">OpenTok</a></span>
123
133
 
@@ -125,6 +135,11 @@
125
135
 
126
136
  </li>
127
137
 
138
+ <li>
139
+ <span class='object_link'><a href="OpenTok.html" title="OpenTok (module)">OpenTok</a></span>
140
+
141
+ </li>
142
+
128
143
  <li>
129
144
  <span class='object_link'><a href="OpenTok/OpenTokArchiveError.html" title="OpenTok::OpenTokArchiveError (class)">OpenTokArchiveError</a></span>
130
145
 
@@ -173,9 +188,9 @@
173
188
  </div>
174
189
 
175
190
  <div id="footer">
176
- Generated on Fri Jun 20 12:49:10 2014 by
191
+ Generated on Mon May 25 15:52:46 2015 by
177
192
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
178
- 0.8.7.4 (ruby-1.9.3).
193
+ 0.8.7.6 (ruby-1.9.3).
179
194
  </div>
180
195
 
181
196
  </body>
@@ -20,7 +20,11 @@
20
20
  </head>
21
21
  <body>
22
22
  <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
24
28
  document.getElementById('base_target').target = 'main';
25
29
  document.body.className = 'frames';
26
30
  }
@@ -46,7 +50,7 @@
46
50
 
47
51
  <ul id="full_list" class="class">
48
52
  <li><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></li>
49
- <li><a class='toggle'></a> <span class='object_link'><a href="OpenTok.html" title="OpenTok (module)">OpenTok</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="OpenTok/Archive.html" title="OpenTok::Archive (class)">Archive</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/ArchiveList.html" title="OpenTok::ArchiveList (class)">ArchiveList</a></span> &lt; Array<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/Archives.html" title="OpenTok::Archives (class)">Archives</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTok.html" title="OpenTok::OpenTok (class)">OpenTok</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokArchiveError.html" title="OpenTok::OpenTokArchiveError (class)">OpenTokArchiveError</a></span> &lt; OpenTokError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokAuthenticationError.html" title="OpenTok::OpenTokAuthenticationError (class)">OpenTokAuthenticationError</a></span> &lt; OpenTokError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokError.html" title="OpenTok::OpenTokError (class)">OpenTokError</a></span> &lt; StandardError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/Session.html" title="OpenTok::Session (class)">Session</a></span> &lt; Object<small class='search_info'>OpenTok</small></li></ul>
53
+ <li><a class='toggle'></a> <span class='object_link'><a href="OpenTok.html" title="OpenTok (module)">OpenTok</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="OpenTok/Archive.html" title="OpenTok::Archive (class)">Archive</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/ArchiveList.html" title="OpenTok::ArchiveList (class)">ArchiveList</a></span> &lt; Array<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/Archives.html" title="OpenTok::Archives (class)">Archives</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/HashExtensions.html" title="OpenTok::HashExtensions (module)">HashExtensions</a></span><small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTok.html" title="OpenTok::OpenTok (class)">OpenTok</a></span> &lt; Object<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokArchiveError.html" title="OpenTok::OpenTokArchiveError (class)">OpenTokArchiveError</a></span> &lt; OpenTokError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokAuthenticationError.html" title="OpenTok::OpenTokAuthenticationError (class)">OpenTokAuthenticationError</a></span> &lt; OpenTokError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/OpenTokError.html" title="OpenTok::OpenTokError (class)">OpenTokError</a></span> &lt; StandardError<small class='search_info'>OpenTok</small></li><li><span class='object_link'><a href="OpenTok/Session.html" title="OpenTok::Session (class)">Session</a></span> &lt; Object<small class='search_info'>OpenTok</small></li></ul>
50
54
 
51
55
  </ul>
52
56
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -78,9 +78,9 @@
78
78
  </div></div>
79
79
 
80
80
  <div id="footer">
81
- Generated on Fri Jun 20 12:49:10 2014 by
81
+ Generated on Mon May 25 15:52:46 2015 by
82
82
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
83
- 0.8.7.4 (ruby-1.9.3).
83
+ 0.8.7.6 (ruby-1.9.3).
84
84
  </div>
85
85
 
86
86
  </body>
@@ -20,7 +20,11 @@
20
20
  </head>
21
21
  <body>
22
22
  <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
24
28
  document.getElementById('base_target').target = 'main';
25
29
  document.body.className = 'frames';
26
30
  }
@@ -4,7 +4,7 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.7.4</title>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -78,9 +78,9 @@
78
78
  </div></div>
79
79
 
80
80
  <div id="footer">
81
- Generated on Fri Jun 20 12:49:10 2014 by
81
+ Generated on Mon May 25 15:52:46 2015 by
82
82
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
83
- 0.8.7.4 (ruby-1.9.3).
83
+ 0.8.7.6 (ruby-1.9.3).
84
84
  </div>
85
85
 
86
86
  </body>
@@ -123,7 +123,10 @@ function linkList() {
123
123
  }
124
124
  }
125
125
  if (clicked) clicked.removeClass('clicked');
126
- var win = window.top.frames.main ? window.top.frames.main : window.parent;
126
+ var win;
127
+ try {
128
+ win = window.top.frames.main ? window.top.frames.main : window.parent;
129
+ } catch (e) { win = window.parent; }
127
130
  if (this.tagName.toLowerCase() == "a") {
128
131
  clicked = $(this).parents('li').addClass('clicked');
129
132
  win.location = this.href;
@@ -20,7 +20,11 @@
20
20
  </head>
21
21
  <body>
22
22
  <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
24
28
  document.getElementById('base_target').target = 'main';
25
29
  document.body.className = 'frames';
26
30
  }
@@ -54,11 +58,23 @@
54
58
 
55
59
 
56
60
  <li class="r2 ">
61
+ <span class='object_link'><a href="OpenTok/Session.html#archive_mode-instance_method" title="OpenTok::Session#archive_mode (method)">#archive_mode</a></span>
62
+ <small>OpenTok::Session</small>
63
+ </li>
64
+
65
+
66
+ <li class="r1 ">
57
67
  <span class='object_link'><a href="OpenTok/OpenTok.html#archives-instance_method" title="OpenTok::OpenTok#archives (method)">#archives</a></span>
58
68
  <small>OpenTok::OpenTok</small>
59
69
  </li>
60
70
 
61
71
 
72
+ <li class="r2 ">
73
+ <span class='object_link'><a href="OpenTok/HashExtensions.html#camelize_keys%21-instance_method" title="OpenTok::HashExtensions#camelize_keys! (method)">#camelize_keys!</a></span>
74
+ <small>OpenTok::HashExtensions</small>
75
+ </li>
76
+
77
+
62
78
  <li class="r1 ">
63
79
  <span class='object_link'><a href="OpenTok/Archives.html#create-instance_method" title="OpenTok::Archives#create (method)">#create</a></span>
64
80
  <small>OpenTok::Archives</small>
@@ -125,6 +141,18 @@
125
141
  </li>
126
142
 
127
143
 
144
+ <li class="r2 ">
145
+ <span class='object_link'><a href="OpenTok/Archive.html#has_audio-instance_method" title="OpenTok::Archive#has_audio (method)">#has_audio</a></span>
146
+ <small>OpenTok::Archive</small>
147
+ </li>
148
+
149
+
150
+ <li class="r1 ">
151
+ <span class='object_link'><a href="OpenTok/Archive.html#has_video-instance_method" title="OpenTok::Archive#has_video (method)">#has_video</a></span>
152
+ <small>OpenTok::Archive</small>
153
+ </li>
154
+
155
+
128
156
  <li class="r2 ">
129
157
  <span class='object_link'><a href="OpenTok/Archive.html#id-instance_method" title="OpenTok::Archive#id (method)">#id</a></span>
130
158
  <small>OpenTok::Archive</small>
@@ -156,20 +184,20 @@
156
184
 
157
185
 
158
186
  <li class="r1 ">
159
- <span class='object_link'><a href="OpenTok/Archive.html#partner_id-instance_method" title="OpenTok::Archive#partner_id (method)">#partner_id</a></span>
187
+ <span class='object_link'><a href="OpenTok/Archive.html#output_mode-instance_method" title="OpenTok::Archive#output_mode (method)">#output_mode</a></span>
160
188
  <small>OpenTok::Archive</small>
161
189
  </li>
162
190
 
163
191
 
164
192
  <li class="r2 ">
165
- <span class='object_link'><a href="OpenTok/Archive.html#reason-instance_method" title="OpenTok::Archive#reason (method)">#reason</a></span>
193
+ <span class='object_link'><a href="OpenTok/Archive.html#partner_id-instance_method" title="OpenTok::Archive#partner_id (method)">#partner_id</a></span>
166
194
  <small>OpenTok::Archive</small>
167
195
  </li>
168
196
 
169
197
 
170
198
  <li class="r1 ">
171
- <span class='object_link'><a href="OpenTok/Session.html#session_id-instance_method" title="OpenTok::Session#session_id (method)">#session_id</a></span>
172
- <small>OpenTok::Session</small>
199
+ <span class='object_link'><a href="OpenTok/Archive.html#reason-instance_method" title="OpenTok::Archive#reason (method)">#reason</a></span>
200
+ <small>OpenTok::Archive</small>
173
201
  </li>
174
202
 
175
203
 
@@ -180,42 +208,48 @@
180
208
 
181
209
 
182
210
  <li class="r1 ">
211
+ <span class='object_link'><a href="OpenTok/Session.html#session_id-instance_method" title="OpenTok::Session#session_id (method)">#session_id</a></span>
212
+ <small>OpenTok::Session</small>
213
+ </li>
214
+
215
+
216
+ <li class="r2 ">
183
217
  <span class='object_link'><a href="OpenTok/Archive.html#size-instance_method" title="OpenTok::Archive#size (method)">#size</a></span>
184
218
  <small>OpenTok::Archive</small>
185
219
  </li>
186
220
 
187
221
 
188
- <li class="r2 ">
222
+ <li class="r1 ">
189
223
  <span class='object_link'><a href="OpenTok/Archive.html#status-instance_method" title="OpenTok::Archive#status (method)">#status</a></span>
190
224
  <small>OpenTok::Archive</small>
191
225
  </li>
192
226
 
193
227
 
194
- <li class="r1 ">
228
+ <li class="r2 ">
195
229
  <span class='object_link'><a href="OpenTok/Archive.html#stop-instance_method" title="OpenTok::Archive#stop (method)">#stop</a></span>
196
230
  <small>OpenTok::Archive</small>
197
231
  </li>
198
232
 
199
233
 
200
- <li class="r2 ">
234
+ <li class="r1 ">
201
235
  <span class='object_link'><a href="OpenTok/Archives.html#stop_by_id-instance_method" title="OpenTok::Archives#stop_by_id (method)">#stop_by_id</a></span>
202
236
  <small>OpenTok::Archives</small>
203
237
  </li>
204
238
 
205
239
 
206
- <li class="r1 ">
240
+ <li class="r2 ">
207
241
  <span class='object_link'><a href="OpenTok/Archive.html#to_json-instance_method" title="OpenTok::Archive#to_json (method)">#to_json</a></span>
208
242
  <small>OpenTok::Archive</small>
209
243
  </li>
210
244
 
211
245
 
212
- <li class="r2 ">
246
+ <li class="r1 ">
213
247
  <span class='object_link'><a href="OpenTok/ArchiveList.html#total-instance_method" title="OpenTok::ArchiveList#total (method)">#total</a></span>
214
248
  <small>OpenTok::ArchiveList</small>
215
249
  </li>
216
250
 
217
251
 
218
- <li class="r1 ">
252
+ <li class="r2 ">
219
253
  <span class='object_link'><a href="OpenTok/Archive.html#url-instance_method" title="OpenTok::Archive#url (method)">#url</a></span>
220
254
  <small>OpenTok::Archive</small>
221
255
  </li>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Top Level Namespace
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -103,9 +103,9 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Fri Jun 20 12:49:10 2014 by
106
+ Generated on Mon May 25 15:52:46 2015 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
- 0.8.7.4 (ruby-1.9.3).
108
+ 0.8.7.6 (ruby-1.9.3).
109
109
  </div>
110
110
 
111
111
  </body>
@@ -0,0 +1,12 @@
1
+ module OpenTok
2
+ module HashExtensions
3
+ def camelize_keys!
4
+ keys.each do |k|
5
+ new_key = k.to_s.camelize(:lower)
6
+ new_key = new_key.to_sym if k.is_a? Symbol
7
+ self[new_key] = self.delete(k)
8
+ end
9
+ self
10
+ end
11
+ end
12
+ end
@@ -16,6 +16,16 @@ module OpenTok
16
16
  # The name of the archive. If no name was provided when the archive was created, this is set
17
17
  # to null.
18
18
  #
19
+ # @attr [true, false] has_audio
20
+ # Whether the archive has an audio track (true) or not (false).
21
+ #
22
+ # @attr [true, false] has_video
23
+ # Whether the archive has a video track (true) or not (false).
24
+ #
25
+ # @attr [String] output_mode
26
+ # Whether all streams in the archive are recorded to a single file (<code>:composed</code>)
27
+ # or to individual files (<code>:individual</code>).
28
+ #
19
29
  # @attr [string] partner_id
20
30
  # The API key associated with the archive.
21
31
  #
@@ -36,6 +46,12 @@ module OpenTok
36
46
  # * "available" -- The archive is available for download from the OpenTok cloud.
37
47
  # * "expired" -- The archive is no longer available for download from the OpenTok cloud.
38
48
  # * "failed" -- The archive recording failed.
49
+ # * "paused" -- The archive is in progress and no clients are publishing streams to the
50
+ # session. When an archive is in progress and any client publishes a stream, the status is
51
+ # "started". When an archive is paused, nothing is recorded. When a client starts publishing
52
+ # a stream, the recording starts (or resumes). If all clients disconnect from a session that
53
+ # is being archived, the status changes to "paused", and after 60 seconds the archive
54
+ # recording stops (and the status changes to "stopped").
39
55
  # * "started" -- The archive started and is in the process of being recorded.
40
56
  # * "stopped" -- The archive stopped recording.
41
57
  # * "uploaded" -- The archive is available for download from the the upload target
@@ -47,7 +63,7 @@ module OpenTok
47
63
  # "available"; for other archives, (including archives with the status "uploaded") this property is
48
64
  # set to null. The download URL is obfuscated, and the file is only available from the URL for
49
65
  # 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.
50
- class Archive
66
+ class Archive
51
67
 
52
68
  # @private
53
69
  def initialize(interface, json)
@@ -85,7 +101,11 @@ module OpenTok
85
101
  camelized_method = method.to_s.camelize(:lower)
86
102
  if @json.has_key? camelized_method and args.empty?
87
103
  # TODO: convert create_time method call to a Time object
88
- @json[camelized_method]
104
+ if camelized_method == 'outputMode'
105
+ @json[camelized_method].to_sym
106
+ else
107
+ @json[camelized_method]
108
+ end
89
109
  else
90
110
  super method, *args, &block
91
111
  end
@@ -3,7 +3,7 @@ require "opentok/archive"
3
3
  require "opentok/archive_list"
4
4
 
5
5
  module OpenTok
6
- # A class for working with OpenTok 2.0 archives.
6
+ # A class for working with OpenTok archives.
7
7
  class Archives
8
8
 
9
9
  # @private
@@ -11,7 +11,7 @@ module OpenTok
11
11
  @client = client
12
12
  end
13
13
 
14
- # Starts archiving an OpenTok 2.0 session.
14
+ # Starts archiving an OpenTok session.
15
15
  #
16
16
  # Clients must be actively connected to the OpenTok session for you to successfully start
17
17
  # recording an archive.
@@ -20,11 +20,30 @@ module OpenTok
20
20
  # of sessions that use the OpenTok Media Router (sessions with the media mode set to routed);
21
21
  # you cannot archive sessions with the media mode set to relayed.
22
22
  #
23
+ # For more information on archiving, see the
24
+ # {https://tokbox.com/opentok/tutorials/archiving OpenTok archiving} programming guide.
25
+ #
23
26
  # @param [String] session_id The session ID of the OpenTok session to archive.
24
- # @param [Hash] options A hash with the key 'name' or :name.
27
+ # @param [Hash] options A hash with the key 'name', 'has_audio', and 'has_video' (or
28
+ # :name.
25
29
  # @option options [String] :name This is the name of the archive. You can use this name
26
30
  # to identify the archive. It is a property of the Archive object, and it is a property
27
- # of archive-related events in the OpenTok.js library.
31
+ # of archive-related events in the OpenTok client SDKs.
32
+ # @option options [true, false] :has_audio Whether the archive will include an audio track
33
+ # (<code>true</code>) or not <code>false</code>). The default value is <code>true</code>
34
+ # (an audio track is included). If you set both <code>has_audio</code> and
35
+ # <code>has_video</code> to <code>false</code>, the call to the <code>create()</code>
36
+ # method results in an error.
37
+ # @option options [true, false] :has_video Whether the archive will include a video track
38
+ # (<code>true</code>) or not <code>false</code>). The default value is <code>true</code>
39
+ # (a video track is included). If you set both <code>has_audio</code> and
40
+ # <code>has_video</code> to <code>false</code>, the call to the <code>create()</code>
41
+ # method results in an error.
42
+ # @option options [String] :output_mode Whether all streams in the archive are recorded
43
+ # to a single file (<code>:composed</code>, the default) or to individual files
44
+ # (<code>:individual</code>). For more information on archiving and the archive file
45
+ # formats, see the {https://tokbox.com/opentok/tutorials/archiving OpenTok archiving}
46
+ # programming guide.
28
47
  #
29
48
  # @return [Archive] The Archive object, which includes properties defining the archive,
30
49
  # including the archive ID.
@@ -39,8 +58,16 @@ module OpenTok
39
58
  # @raise [OpenTokArchiveError] The archive could not be started.
40
59
  def create(session_id, options = {})
41
60
  raise ArgumentError, "session_id not provided" if session_id.to_s.empty?
42
- opts = Hash.new
43
- opts[:name] = options[:name].to_s || options["name"].to_s
61
+
62
+ # normalize opts so all keys are symbols and only include valid_opts
63
+ valid_opts = [ :name, :has_audio, :has_video, :output_mode ]
64
+ opts = options.inject({}) do |m,(k,v)|
65
+ if valid_opts.include? k.to_sym
66
+ m[k.to_sym] = v
67
+ end
68
+ m
69
+ end
70
+
44
71
  archive_json = @client.start_archive(session_id, opts)
45
72
  Archive.new self, archive_json
46
73
  end