Class: BOTR::ChannelView
- Defined in:
- lib/botr/channels/channel_view.rb
Overview
The BOTR::ChannelView class contains calls for requesting channel views statistics.
A channel view is counted every time:
The RSS feed of that channel is requested from the content server. A player from our content server containing a channel is embedded in a webpage.
Class Attribute Summary collapse
-
.last_status ⇒ Object
readonly
Returns the value of attribute last_status.
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#days ⇒ Object
readonly
Returns the value of attribute days.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#last_status ⇒ Object
readonly
Returns the value of attribute last_status.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
-
#years ⇒ Object
readonly
Returns the value of attribute years.
Class Method Summary collapse
- .all ⇒ Object
-
.list(**options) ⇒ Array
A list of objects with the statistics of the all channels matching the given criteria.
-
.show(channel_key, **options) ⇒ BOTR::ChannelView
(also: find)
information.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ ChannelView
constructor
A new instance of ChannelView.
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 = {}) ⇒ ChannelView
Returns a new instance of ChannelView.
134 135 136 137 138 139 140 |
# File 'lib/botr/channels/channel_view.rb', line 134 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.
15 16 17 |
# File 'lib/botr/channels/channel_view.rb', line 15 def last_status @last_status end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def date @date end |
#days ⇒ Object (readonly)
Returns the value of attribute days.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def days @days end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def key @key end |
#last_status ⇒ Object (readonly)
Returns the value of attribute last_status.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def last_status @last_status end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def number @number end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def @timestamp end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def title @title end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def total @total end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def views @views end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def year @year end |
#years ⇒ Object (readonly)
Returns the value of attribute years.
131 132 133 |
# File 'lib/botr/channels/channel_view.rb', line 131 def years @years end |
Class Method Details
.all ⇒ Object
94 95 96 |
# File 'lib/botr/channels/channel_view.rb', line 94 def all list({}) end |
.list(**options) ⇒ Array
Returns a list of objects with the statistics of the all channels matching the given criteria.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/botr/channels/channel_view.rb', line 81 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, **options) ⇒ BOTR::ChannelView Also known as: find
information
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/botr/channels/channel_view.rb', line 37 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 |