Class: BOTR::ChannelVideo
- Defined in:
- lib/botr/channels/channel_video.rb
Overview
The BOTR::ChannelVideo class contains calls for requesting channel videos in the dynamic playlist. For manual channels, these calls can also be used to add, change video position or remove video from the playlist.
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.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#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.
-
#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
-
.list(channel_key, **options) ⇒ Array
A list of video objects in the channel specified by the channel key.
-
.show(channel_key, **options) ⇒ BOTR::ChannelVideo
(also: find)
A new object with the properties of the video referenced by the video key or the position.
-
.update(channel_key, **options) ⇒ BOTR::ChannelVideo
This object with the status of the move operation.
Instance Method Summary collapse
-
#create(channel_key, **options) ⇒ BOTR::ChannelVideo
Add a video to the playlist of a manual channel.
-
#delete(channel_key, **options) ⇒ BOTR::ChannelVideo
Delete a video from the playlist of a manual channel.
-
#initialize(params = {}) ⇒ ChannelVideo
constructor
A new instance of ChannelVideo.
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 = {}) ⇒ ChannelVideo
Returns a new instance of ChannelVideo.
120 121 122 123 124 125 126 127 |
# File 'lib/botr/channels/channel_video.rb', line 120 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 raise ArgumentError, "You must specify a video key." if @key.nil? end |
Class Attribute Details
.last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
10 11 12 |
# File 'lib/botr/channels/channel_video.rb', line 10 def last_status @last_status end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def @author end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def description @description end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def duration @duration end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def link @link end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def md5 @md5 end |
#mediatype ⇒ Object (readonly)
Returns the value of attribute mediatype.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def mediatype @mediatype end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def @tags end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def title @title end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
117 118 119 |
# File 'lib/botr/channels/channel_video.rb', line 117 def views @views end |
Class Method Details
.list(channel_key, **options) ⇒ Array
Returns a list of video objects in the channel specified by the channel key.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/botr/channels/channel_video.rb', line 54 def list(channel_key, **) json = get_request(.merge(:method => 'list', :channel_key => channel_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(channel_key, **options) ⇒ BOTR::ChannelVideo Also known as: find
Returns a new object with the properties of the video referenced by the video key or the position.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/botr/channels/channel_video.rb', line 25 def show(channel_key, **) json = get_request(.merge(:method => 'show', :channel_key => channel_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 |
.update(channel_key, **options) ⇒ BOTR::ChannelVideo
Returns this object with the status of the move operation.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/botr/channels/channel_video.rb', line 81 def update(channel_key, **) json = put_request(.merge(:channel_key => channel_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 |
Instance Method Details
#create(channel_key, **options) ⇒ BOTR::ChannelVideo
Add a video to the playlist of a manual channel.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/botr/channels/channel_video.rb', line 142 def create(channel_key, **) json = get_request(.merge(:method => 'create', :channel_key => channel_key, :video_key => @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(channel_key, **options) ⇒ BOTR::ChannelVideo
Delete a video from the playlist of a manual channel.
170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/botr/channels/channel_video.rb', line 170 def delete(channel_key, **) json = delete_request(.merge(:channel_key => channel_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 |