Class: Yt::Models::PlaylistItem
- Defined in:
- lib/yt/models/playlist_item.rb
Overview
Provides methods to interact with YouTube playlist items.
Constant Summary
Constants inherited from Resource
Resource::CHANNEL_PATTERNS, Resource::PLAYLIST_PATTERNS, Resource::VIDEO_PATTERNS
Instance Attribute Summary collapse
-
#channel_id ⇒ String
readonly
The ID of the channel that the item belongs to.
-
#channel_title ⇒ String
readonly
The title of the channel that the item belongs to.
-
#description ⇒ String
readonly
The item’s description.
-
#playlist_id ⇒ String
readonly
The ID of the playlist that the item is in.
-
#published_at ⇒ Time
readonly
The time that the item was added to the playlist.
-
#title ⇒ String
readonly
The item’s title.
Attributes inherited from Resource
Instance Method Summary collapse
-
#delete(options = {}) ⇒ Boolean
Deletes the playlist item.
-
#position ⇒ Integer
The order in which the item appears in a playlist.
-
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the item’s thumbnail.
-
#update(attributes = {}) ⇒ Boolean
Updates the attributes of a playlist item.
-
#video ⇒ Yt::Models::Video
The video referred by the item.
-
#video_id ⇒ String
The ID of the video referred by the item.
Methods inherited from Resource
#private?, #public?, #unlisted?
Instance Attribute Details
#channel_id ⇒ String (readonly)
Returns the ID of the channel that the item belongs to.
34 |
# File 'lib/yt/models/playlist_item.rb', line 34 delegate :channel_id, to: :snippet |
#channel_title ⇒ String (readonly)
Returns the title of the channel that the item belongs to.
38 |
# File 'lib/yt/models/playlist_item.rb', line 38 delegate :channel_title, to: :snippet |
#description ⇒ String (readonly)
Returns the item’s description.
17 |
# File 'lib/yt/models/playlist_item.rb', line 17 delegate :description, to: :snippet |
#playlist_id ⇒ String (readonly)
Returns the ID of the playlist that the item is in.
42 |
# File 'lib/yt/models/playlist_item.rb', line 42 delegate :playlist_id, to: :snippet |
#published_at ⇒ Time (readonly)
Returns the time that the item was added to the playlist.
30 |
# File 'lib/yt/models/playlist_item.rb', line 30 delegate :published_at, to: :snippet |
#title ⇒ String (readonly)
Returns the item’s title.
13 |
# File 'lib/yt/models/playlist_item.rb', line 13 delegate :title, to: :snippet |
Instance Method Details
#delete(options = {}) ⇒ Boolean
Deletes the playlist item.
61 62 63 64 |
# File 'lib/yt/models/playlist_item.rb', line 61 def delete( = {}) do_delete {@id = nil} !exists? end |
#position ⇒ Integer
Returns the order in which the item appears in a playlist. The value is zero-based, so the first item has a position of 0.
51 52 53 |
# File 'lib/yt/models/playlist_item.rb', line 51 def position ensure_complete_snippet :position end |
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the item’s thumbnail.
26 |
# File 'lib/yt/models/playlist_item.rb', line 26 delegate :thumbnail_url, to: :snippet |
#update(attributes = {}) ⇒ Boolean
Updates the attributes of a playlist item.
73 74 75 |
# File 'lib/yt/models/playlist_item.rb', line 73 def update(attributes = {}) super end |
#video ⇒ Yt::Models::Video
Returns the video referred by the item.
80 81 82 |
# File 'lib/yt/models/playlist_item.rb', line 80 def video @video ||= Video.new id: video_id, auth: @auth if video_id end |
#video_id ⇒ String
Returns the ID of the video referred by the item.
45 46 47 |
# File 'lib/yt/models/playlist_item.rb', line 45 def video_id snippet.resource_id['videoId'] end |