Class: BOTR::Channel
Overview
The BOTR::Channel class contains calls for creating new channels, searching for channels, managing the channel properties (title, description etc.) and deleting channels.
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.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#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.
-
#sort_order ⇒ Object
readonly
Returns the value of attribute sort_order.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tags_mode ⇒ Object
readonly
Returns the value of attribute tags_mode.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#videos ⇒ Object
readonly
Returns the value of attribute videos.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Class Method Summary collapse
- .all ⇒ Object
-
.list(**options) ⇒ BOTR::Channel
A new object with the properties of the channel referenced by the channel key.
-
.show(channel_key) ⇒ BOTR::Channel
(also: find)
information.
Instance Method Summary collapse
-
#create(type, **options) ⇒ BOTR::Channel
Create a new (dynamic or manual) channel.
-
#delete ⇒ BOTR::Channel
Delete a channel.
-
#initialize(params = {}) ⇒ Channel
constructor
A new instance of Channel.
-
#update(**options) ⇒ BOTR::Channel
Configure or update the properties of a channel.
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 = {}) ⇒ Channel
Returns a new instance of Channel.
95 96 97 98 99 100 101 |
# File 'lib/botr/channels/channel.rb', line 95 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.
10 11 12 |
# File 'lib/botr/channels/channel.rb', line 10 def last_status @last_status end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def @author end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def description @description end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def last_status @last_status end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def link @link end |
#sort_order ⇒ Object (readonly)
Returns the value of attribute sort_order.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def sort_order @sort_order end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def @tags end |
#tags_mode ⇒ Object (readonly)
Returns the value of attribute tags_mode.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def @tags_mode end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def type @type end |
#videos ⇒ Object (readonly)
Returns the value of attribute videos.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def videos @videos end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
92 93 94 |
# File 'lib/botr/channels/channel.rb', line 92 def views @views end |
Class Method Details
.all ⇒ Object
69 70 71 |
# File 'lib/botr/channels/channel.rb', line 69 def all list({}) end |
.list(**options) ⇒ BOTR::Channel
Returns a new object with the properties of the channel referenced by the channel key.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/botr/channels/channel.rb', line 56 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(channel_key) ⇒ BOTR::Channel Also known as: find
information
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/botr/channels/channel.rb', line 19 def show(channel_key) json = get_request({: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 |
Instance Method Details
#create(type, **options) ⇒ BOTR::Channel
Create a new (dynamic or manual) channel.
information
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/botr/channels/channel.rb', line 116 def create(type, **) json = get_request(.merge(:method => 'create', :type => type)) 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::Channel
Delete a channel.
172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/botr/channels/channel.rb', line 172 def delete json = delete_request({:channel_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::Channel
Configure or update the properties of a channel.
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/botr/channels/channel.rb', line 156 def update(**) json = put_request(.merge(:channel_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 |