Class: BOTR::Video
Overview
The BOTR::Video class contains calls for creating (uploading) videos, searching for videos, editing video metadata (title, description, tags etc.) and deleting videos.
A video object is a metadata container that actually contains multiple video files (conversions). It does not reference the actual video file located on the content server.
Class Attribute Summary collapse
-
.last_status ⇒ Object
readonly
Returns the value of attribute last_status.
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#download_url ⇒ Object
readonly
Returns the value of attribute download_url.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#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.
-
#md5 ⇒ Object
readonly
Returns the value of attribute md5.
-
#mediatype ⇒ Object
readonly
Returns the value of attribute mediatype.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#sourcetype ⇒ Object
readonly
Returns the value of attribute sourcetype.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Class Method Summary collapse
-
.all ⇒ Object
Return a list of all videos.
-
.list(**options) ⇒ Array
Return a list of videos.
-
.show(video_key) ⇒ BOTR::Video
(also: find)
A new object with the properties of the video referenced by the video_key.
Instance Method Summary collapse
-
#create(**options) ⇒ BOTR::Video
Create a new video by sending metadata and requesting an upload URL.
-
#delete ⇒ BOTR::Video
Remove a video and all of its conversions from the server.
-
#initialize(params = {}) ⇒ Video
constructor
A new instance of Video.
-
#update(**options) ⇒ BOTR::Video
Update the properties of a video.
- #upload(data_path, **options) ⇒ Object
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 = {}) ⇒ Video
Returns a new instance of Video.
115 116 117 118 119 120 121 |
# File 'lib/botr/videos/video.rb', line 115 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.
14 15 16 |
# File 'lib/botr/videos/video.rb', line 14 def last_status @last_status end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def @author end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def description @description end |
#download_url ⇒ Object (readonly)
Returns the value of attribute download_url.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def download_url @download_url end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def duration @duration end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def error @error end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def file @file end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def link @link end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def md5 @md5 end |
#mediatype ⇒ Object (readonly)
Returns the value of attribute mediatype.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def mediatype @mediatype end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def size @size end |
#sourcetype ⇒ Object (readonly)
Returns the value of attribute sourcetype.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def sourcetype @sourcetype end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def status @status end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def @tags end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def title @title end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
111 112 113 |
# File 'lib/botr/videos/video.rb', line 111 def views @views end |
Class Method Details
.all ⇒ Object
Same as calling list
with no arguments given.
Return a list of all videos.
87 88 89 |
# File 'lib/botr/videos/video.rb', line 87 def all list({}) end |
.list(**options) ⇒ Array
Return a list of videos.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/botr/videos/video.rb', line 71 def list(**) json = get_request(.merge(:method => 'list')) 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(video_key) ⇒ BOTR::Video Also known as: find
Returns a new object with the properties of the video referenced by the video_key.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/botr/videos/video.rb', line 23 def show(video_key) json = get_request({:method => 'show', :video_key => video_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(**options) ⇒ BOTR::Video
Create a new video by sending metadata and requesting an upload URL.
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/botr/videos/video.rb', line 142 def create(**) json = get_request(.merge(:method => 'create')) 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::Video
Remove a video and all of its conversions from the server.
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/botr/videos/video.rb', line 203 def delete json = delete_request({:video_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 |
#update(**options) ⇒ BOTR::Video
Update the properties of a video.
187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/botr/videos/video.rb', line 187 def update(**) json = put_request(.merge(:video_key => @key)) res = JSON.parse(json.body) if json.status == 200 process_update_response(res, ) else raise "HTTP Error #{json.status}: #{json.body}" end return self end |
#upload(data_path, **options) ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/botr/videos/video.rb', line 155 def upload(data_path, **) json = post_request(, data_path) res = JSON.parse(json.body) if json.status == 200 process_upload_response(res) else raise "HTTP Error #{json.status}: #{json.body}" end return self end |