Class: OpenTok::Archive
- Inherits:
-
Object
- Object
- OpenTok::Archive
- Defined in:
- lib/opentok/archive.rb
Overview
Represents an archive of an OpenTok session.
Instance Attribute Summary (collapse)
-
- (int) created_at
The time at which the archive was created, in milliseconds since the UNIX epoch.
-
- (string) duration
The duration of the archive, in milliseconds.
-
- (string) id
The archive ID.
-
- (string) name
The name of the archive.
-
- (string) partner_id
The API key associated with the archive.
-
- (string) reason
For archives with the status "stopped", this can be set to "90 mins exceeded", "failure", "session ended", or "user initiated".
-
- (string) session_id
The session ID of the OpenTok session associated with this archive.
-
- (float) size
The size of the MP4 file.
-
- (string) status
The status of the archive, which can be one of the following:.
-
- (string) url
The download URL of the available MP4 file.
Instance Method Summary (collapse)
-
- (Object) delete
Deletes an OpenTok archive.
-
- (Object) stop
Stops an OpenTok archive that is being recorded.
-
- (Object) to_json
A JSON encoded string representation of the archive.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(method, *args, &block)
84 85 86 87 88 89 90 91 92 |
# File 'lib/opentok/archive.rb', line 84 def method_missing(method, *args, &block) camelized_method = method.to_s.camelize(:lower) if @json.has_key? camelized_method and args.empty? # TODO: convert create_time method call to a Time object @json[camelized_method] else super method, *args, &block end end |
Instance Attribute Details
- (int) created_at
The time at which the archive was created, in milliseconds since the UNIX epoch.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def created_at @created_at end |
- (string) duration
The duration of the archive, in milliseconds.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def duration @duration end |
- (string) id
The archive ID.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def id @id end |
- (string) name
The name of the archive. If no name was provided when the archive was created, this is set to null.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def name @name end |
- (string) partner_id
The API key associated with the archive.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def partner_id @partner_id end |
- (string) reason
For archives with the status "stopped", this can be set to "90 mins exceeded", "failure", "session ended", or "user initiated". For archives with the status "failed", this can be set to "system failure".
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def reason @reason end |
- (string) session_id
The session ID of the OpenTok session associated with this archive.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def session_id @session_id end |
- (float) size
The size of the MP4 file. For archives that have not been generated, this value is set to 0.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def size @size end |
- (string) status
The status of the archive, which can be one of the following:
-
"available" -- The archive is available for download from the OpenTok cloud.
-
"expired" -- The archive is no longer available for download from the OpenTok cloud.
-
"failed" -- The archive recording failed.
-
"started" -- The archive started and is in the process of being recorded.
-
"stopped" -- The archive stopped recording.
-
"uploaded" -- The archive is available for download from the the upload target Amazon S3 bucket or Windows Azure container you set at the OpenTok dashboard (dashboard.tokbox.com).
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def status @status end |
- (string) url
The download URL of the available MP4 file. This is only set for an archive with the status set to "available"; for other archives, (including archives with the status "uploaded") this property is 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.
50 51 52 |
# File 'lib/opentok/archive.rb', line 50 def url @url end |
Instance Method Details
- (Object) delete
Deletes an OpenTok archive.
You can only delete an archive which has a status of "available" or "uploaded". Deleting an archive removes its record from the list of archives. For an "available" archive, it also removes the archive file, making it unavailable for download.
78 79 80 81 |
# File 'lib/opentok/archive.rb', line 78 def delete # TODO: validate returned json fits schema @json = @interface.delete_by_id @json['id'] end |
- (Object) stop
Stops an OpenTok archive that is being recorded.
Archives automatically stop recording after 90 minutes or when all clients have disconnected from the session being archived.
68 69 70 71 |
# File 'lib/opentok/archive.rb', line 68 def stop # TODO: validate returned json fits schema @json = @interface.stop_by_id @json['id'] end |
- (Object) to_json
A JSON encoded string representation of the archive
60 61 62 |
# File 'lib/opentok/archive.rb', line 60 def to_json @json.to_json end |