Class: Yt::Models::Channel
- Includes:
- Associations::Earnings, Associations::Views
- Defined in:
- lib/yt/models/channel.rb
Overview
A channel resource contains information about a YouTube channel.
Instance Attribute Summary collapse
-
#playlists ⇒ Yt::Collections::Playlists
readonly
The channel’s playlists.
-
#statistics_set ⇒ Yt::Models::StatisticsSet
readonly
The statistics for the video.
-
#subscriptions ⇒ Yt::Collections::Subscriptions
readonly
The channel’s subscriptions.
-
#videos ⇒ Yt::Collections::Videos
readonly
The channel’s videos.
Attributes inherited from Resource
Instance Method Summary collapse
- #create_playlist(params = {}) ⇒ Object
- #delete_playlists(attrs = {}) ⇒ Object
-
#subscribe ⇒ Object
Subscribes the authenticated account to the channel.
-
#subscribe! ⇒ Object
Subscribes the authenticated account to the channel.
-
#subscribed? ⇒ Boolean
Returns whether the authenticated account is subscribed to the channel.
-
#unsubscribe ⇒ Object
Unsubscribes the authenticated account from the channel.
-
#unsubscribe! ⇒ Object
Unsubscribes the authenticated account from the channel.
Methods included from Associations::Views
Methods included from Associations::Earnings
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Yt::Models::Resource
Instance Attribute Details
#playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the channel’s playlists.
23 |
# File 'lib/yt/models/channel.rb', line 23 has_many :playlists |
#statistics_set ⇒ Yt::Models::StatisticsSet (readonly)
Returns the statistics for the video.
28 |
# File 'lib/yt/models/channel.rb', line 28 has_one :statistics_set |
#subscriptions ⇒ Yt::Collections::Subscriptions (readonly)
Returns the channel’s subscriptions.
15 |
# File 'lib/yt/models/channel.rb', line 15 has_many :subscriptions |
#videos ⇒ Yt::Collections::Videos (readonly)
Returns the channel’s videos.
19 |
# File 'lib/yt/models/channel.rb', line 19 has_many :videos |
Instance Method Details
#create_playlist(params = {}) ⇒ Object
91 92 93 |
# File 'lib/yt/models/channel.rb', line 91 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attrs = {}) ⇒ Object
95 96 97 |
# File 'lib/yt/models/channel.rb', line 95 def delete_playlists(attrs = {}) playlists.delete_all attrs end |
#subscribe ⇒ Object
50 51 52 |
# File 'lib/yt/models/channel.rb', line 50 def subscribe subscriptions.insert ignore_errors: true end |
#subscribe! ⇒ Object
63 64 65 |
# File 'lib/yt/models/channel.rb', line 63 def subscribe! subscriptions.insert end |
#subscribed? ⇒ Boolean
39 40 41 |
# File 'lib/yt/models/channel.rb', line 39 def subscribed? subscriptions.any?{|s| s.exists?} end |
#unsubscribe ⇒ Object
74 75 76 |
# File 'lib/yt/models/channel.rb', line 74 def unsubscribe subscriptions.delete_all({}, ignore_errors: true) end |
#unsubscribe! ⇒ Object
87 88 89 |
# File 'lib/yt/models/channel.rb', line 87 def unsubscribe! subscriptions.delete_all end |