Class: BOTR::VideoConversion
- Defined in:
- lib/botr/videos/video_conversion.rb
Overview
The BOTR::VideoConversion class calls are used to create, search for and delete individual video files (conversions) inside a video object.
A conversion is always created by applying a transcoding template to a video. A template contains information for the dimensions, bitrate and watermark of the resulting conversion.
Class Attribute Summary collapse
-
.last_status ⇒ Object
readonly
Returns the value of attribute last_status.
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#filesize ⇒ Object
readonly
Returns the value of attribute filesize.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#last_status ⇒ Object
readonly
Returns the value of attribute last_status.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#mediatype ⇒ Object
readonly
Returns the value of attribute mediatype.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Class Method Summary collapse
-
.list(key, **options) ⇒ Array
List conversions for a given video.
-
.show(conversion_key) ⇒ BOTR::VideoConversion
(also: find)
A new object with the properties of the conversion referenced by the conversion_key.
Instance Method Summary collapse
-
#create(video_key, template_key) ⇒ BOTR::VideoConversion
Create a new conversion of a video.
-
#delete ⇒ BOTR::VideoConversion
Delete a video conversion from the CDN.
-
#initialize(params = {}) ⇒ VideoConversion
constructor
A new instance of VideoConversion.
Methods included from Authentication
Methods included from API
#api_call_class, #api_format, #api_key, #api_nonce, #api_protocol, #api_secret_key, #api_server, #api_timestamp, #api_url, #api_version, #progress_url, #upload_address, #upload_key, #upload_protocol, #upload_token, #upload_url
Methods included from HTTP
#client, #delete_request, #get_request, #post_request, #put_request
Constructor Details
#initialize(params = {}) ⇒ VideoConversion
Returns a new instance of VideoConversion.
90 91 92 93 94 95 96 |
# File 'lib/botr/videos/video_conversion.rb', line 90 def initialize(params = {}) params.each do |key, val| param = "@#{key.to_s}" next unless methods.include? key.to_sym instance_variable_set(param, val) end end |
Class Attribute Details
.last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
13 14 15 |
# File 'lib/botr/videos/video_conversion.rb', line 13 def last_status @last_status end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def duration @duration end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def error @error end |
#filesize ⇒ Object (readonly)
Returns the value of attribute filesize.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def filesize @filesize end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def height @height end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def link @link end |
#mediatype ⇒ Object (readonly)
Returns the value of attribute mediatype.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def mediatype @mediatype end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def status @status end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def template @template end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
87 88 89 |
# File 'lib/botr/videos/video_conversion.rb', line 87 def width @width end |
Class Method Details
.list(key, **options) ⇒ Array
List conversions for a given video.
conversions
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/botr/videos/video_conversion.rb', line 53 def list(key, **) json = get_request(.merge(:method => 'list', :video_key => key)) res = JSON.parse(json.body) if json.status == 200 results = process_list_response(res) else raise "HTTP Error #{json.status}: #{json.body}" end return results end |
.show(conversion_key) ⇒ BOTR::VideoConversion Also known as: find
Returns a new object with the properties of the conversion referenced by the conversion_key.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/botr/videos/video_conversion.rb', line 22 def show(conversion_key) json = get_request({:method => 'show', :conversion_key => conversion_key}) res = JSON.parse(json.body) if json.status == 200 params = process_show_response(res) else raise "HTTP Error #{json.status}: #{json.body}" end return new(params) end |
Instance Method Details
#create(video_key, template_key) ⇒ BOTR::VideoConversion
Create a new conversion of a video.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/botr/videos/video_conversion.rb', line 107 def create(video_key, template_key) json = get_request({:method => 'create', :video_key => video_key, :template_key => template_key}) res = JSON.parse(json.body) if json.status == 200 process_create_response(res) else raise "HTTP Error #{json.status}: #{json.body}" end return self end |
#delete ⇒ BOTR::VideoConversion
Delete a video conversion from the CDN.
125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/botr/videos/video_conversion.rb', line 125 def delete json = delete_request({:conversion_key => @key}) res = JSON.parse(json.body) if json.status == 200 process_delete_response(res) else raise "HTTP Error #{json.status}: #{json.body}" end return self end |