Class: BOTR::VideoCaption
- Defined in:
- lib/botr/videos/video_caption.rb
Overview
The BOTR::VideoCaption class contains calls for manipulating videos captions.
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.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#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.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.list(video_key, **options) ⇒ Array
Return a list of videos captions.
-
.show(video_key) ⇒ BOTR::VideoCaption
(also: find)
A new object with the properties of the caption referenced by the caption_key.
Instance Method Summary collapse
-
#create(video_key, **options) ⇒ BOTR::VideoCaption
Create a new video caption.
-
#delete ⇒ BOTR::VideoCaption
Delete a video caption.
-
#initialize(params = {}) ⇒ VideoCaption
constructor
A new instance of VideoCaption.
-
#update(**options) ⇒ BOTR::VideoCaption
Update video caption.
- #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 = {}) ⇒ VideoCaption
Returns a new instance of VideoCaption.
92 93 94 95 96 97 98 |
# File 'lib/botr/videos/video_caption.rb', line 92 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.
8 9 10 |
# File 'lib/botr/videos/video_caption.rb', line 8 def last_status @last_status end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def error @error end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def format @format end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def label @label end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def link @link end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def md5 @md5 end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def position @position end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
89 90 91 |
# File 'lib/botr/videos/video_caption.rb', line 89 def status @status end |
Class Method Details
.list(video_key, **options) ⇒ Array
Return a list of videos captions.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/botr/videos/video_caption.rb', line 55 def list(video_key, **) json = get_request(.merge(:method => 'list', :video_key => video_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(video_key) ⇒ BOTR::VideoCaption Also known as: find
Returns a new object with the properties of the caption referenced by the caption_key.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/botr/videos/video_caption.rb', line 17 def show(video_key) json = get_request({:method => 'show', :caption_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(video_key, **options) ⇒ BOTR::VideoCaption
Create a new video caption.
caption; default is to insert at the end of the list
114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/botr/videos/video_caption.rb', line 114 def create(video_key, **) json = get_request(.merge(:method => 'create', :video_key => video_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::VideoCaption
Delete a video caption.
167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/botr/videos/video_caption.rb', line 167 def delete json = delete_request({:caption_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::VideoCaption
Update video caption.
caption; default is to insert at the end of the list
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/botr/videos/video_caption.rb', line 151 def update(**) json = put_request(.merge(:caption_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
128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/botr/videos/video_caption.rb', line 128 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 |