Class: BOTR::VideoThumbnail
- Defined in:
- lib/botr/videos/video_thumbnail.rb
Overview
The BOTR::VideoThumbnail class contains calls for managing the preview image of a video.
Class Attribute Summary collapse
-
.last_status ⇒ Object
readonly
Returns the value of attribute last_status.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#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.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#strip_error ⇒ Object
readonly
Returns the value of attribute strip_error.
-
#strip_status ⇒ Object
readonly
Returns the value of attribute strip_status.
Class Method Summary collapse
-
.show(video_key) ⇒ BOTR::VideoThumbnail
(also: find)
A new object with the thumbnail status of the video referenced by the video key.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ VideoThumbnail
constructor
A new instance of VideoThumbnail.
-
#update(**options) ⇒ BOTR::VideoThumbnail
Update a video’s thumbnail by either setting a frame from the video or uploading an image.
- #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 = {}) ⇒ VideoThumbnail
Returns a new instance of VideoThumbnail.
47 48 49 50 51 52 53 |
# File 'lib/botr/videos/video_thumbnail.rb', line 47 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.
9 10 11 |
# File 'lib/botr/videos/video_thumbnail.rb', line 9 def last_status @last_status end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def error @error end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def link @link end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def status @status end |
#strip_error ⇒ Object (readonly)
Returns the value of attribute strip_error.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def strip_error @strip_error end |
#strip_status ⇒ Object (readonly)
Returns the value of attribute strip_status.
44 45 46 |
# File 'lib/botr/videos/video_thumbnail.rb', line 44 def strip_status @strip_status end |
Class Method Details
.show(video_key) ⇒ BOTR::VideoThumbnail Also known as: find
Returns a new object with the thumbnail status of the video referenced by the video key.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/botr/videos/video_thumbnail.rb', line 18 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
#update(**options) ⇒ BOTR::VideoThumbnail
Update a video’s thumbnail by either setting a frame from the video or uploading an image.
optional upload link
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/botr/videos/video_thumbnail.rb', line 73 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
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/botr/videos/video_thumbnail.rb', line 86 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 |