Class: Yt::PlaylistItem
Overview
Provides methods to interact with YouTube playlist items.
Instance Attribute Summary collapse
-
#channel_id ⇒ String
readonly
The ID of the channel that the playlist belongs to.
-
#channel_title ⇒ String
readonly
The title of the channel that the playlist belongs to.
-
#description ⇒ String
readonly
The item’s description.
-
#playlist_id ⇒ String
readonly
The ID of the playlist that the item belongs to.
-
#position ⇒ Integer
readonly
The order in which the item appears in the playlist.
-
#privacy_status ⇒ String
readonly
The item’s privacy status.
-
#published_at ⇒ Time
readonly
The date and time that the item was added to the playlist.
-
#thumbnails ⇒ Hash<String, Hash>
readonly
The thumbnails associated with the item.
-
#title ⇒ String
readonly
The item’s title.
-
#video_id ⇒ String
readonly
The ID of the video that the item refers to.
Attributes inherited from Resource
Instance Method Summary collapse
-
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the item’s thumbnail.
Methods inherited from Resource
#id, #initialize, #inspect, #select, where
Constructor Details
This class inherits a constructor from Yt::Resource
Instance Attribute Details
#channel_id ⇒ String (readonly)
Returns the ID of the channel that the playlist belongs to.
23 |
# File 'lib/yt/playlist_item.rb', line 23 has_attribute :channel_id, in: :snippet |
#channel_title ⇒ String (readonly)
Returns the title of the channel that the playlist belongs to.
27 |
# File 'lib/yt/playlist_item.rb', line 27 has_attribute :channel_title, in: :snippet |
#description ⇒ String (readonly)
Returns the item’s description.
|
# File 'lib/yt/playlist_item.rb', line 9
|
#playlist_id ⇒ String (readonly)
Returns the ID of the playlist that the item belongs to.
31 |
# File 'lib/yt/playlist_item.rb', line 31 has_attribute :playlist_id, in: :snippet |
#position ⇒ Integer (readonly)
Returns the order in which the item appears in the playlist. The value uses a zero-based index so the first item has a position of 0.
36 |
# File 'lib/yt/playlist_item.rb', line 36 has_attribute :position, in: :snippet, type: Integer |
#privacy_status ⇒ String (readonly)
Returns the item’s privacy status. Valid values are: “private”, “public”, and “unlisted”.
45 |
# File 'lib/yt/playlist_item.rb', line 45 has_attribute :privacy_status, in: :status |
#published_at ⇒ Time (readonly)
Returns the date and time that the item was added to the playlist.
15 |
# File 'lib/yt/playlist_item.rb', line 15 has_attribute :published_at, in: :snippet, type: Time |
#thumbnails ⇒ Hash<String, Hash> (readonly)
Returns the thumbnails associated with the item.
19 |
# File 'lib/yt/playlist_item.rb', line 19 has_attribute :thumbnails, in: :snippet |
#title ⇒ String (readonly)
Returns the item’s title.
7 |
# File 'lib/yt/playlist_item.rb', line 7 has_attribute :title, in: :snippet |
#video_id ⇒ String (readonly)
Returns the ID of the video that the item refers to.
40 |
# File 'lib/yt/playlist_item.rb', line 40 has_attribute :video_id, in: %i(snippet resource_id) |
Instance Method Details
#thumbnail_url(size = :default) ⇒ String?
Returns the URL of the item’s thumbnail.
55 56 57 |
# File 'lib/yt/playlist_item.rb', line 55 def thumbnail_url(size = :default) thumbnails.fetch(size.to_s, {})['url'] end |