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.
-
#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 |
#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
84 85 86 |
# File 'lib/yt/models/channel.rb', line 84 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attrs = {}) ⇒ Object
88 89 90 |
# File 'lib/yt/models/channel.rb', line 88 def delete_playlists(attrs = {}) playlists.delete_all attrs end |
#subscribe ⇒ Object
43 44 45 |
# File 'lib/yt/models/channel.rb', line 43 def subscribe subscriptions.insert ignore_errors: true end |
#subscribe! ⇒ Object
56 57 58 |
# File 'lib/yt/models/channel.rb', line 56 def subscribe! subscriptions.insert end |
#subscribed? ⇒ Boolean
32 33 34 |
# File 'lib/yt/models/channel.rb', line 32 def subscribed? subscriptions.any?{|s| s.exists?} end |
#unsubscribe ⇒ Object
67 68 69 |
# File 'lib/yt/models/channel.rb', line 67 def unsubscribe subscriptions.delete_all({}, ignore_errors: true) end |
#unsubscribe! ⇒ Object
80 81 82 |
# File 'lib/yt/models/channel.rb', line 80 def unsubscribe! subscriptions.delete_all end |