Class: Yt::Models::PlaylistItem
- Defined in:
- lib/yt/models/playlist_item.rb
Overview
Provides methods to interact with YouTube playlist items.
Instance Attribute Summary collapse
-
#id ⇒ String
readonly
The ID that uniquely identify a YouTube playlist item.
-
#position ⇒ String
readonly
The order in which the item appears in the playlist.
-
#video ⇒ Object
readonly
Returns the value of attribute video.
Instance Method Summary collapse
- #delete(options = {}) ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(options = {}) ⇒ PlaylistItem
constructor
A new instance of PlaylistItem.
Constructor Details
#initialize(options = {}) ⇒ PlaylistItem
Returns a new instance of PlaylistItem.
18 19 20 21 22 23 24 25 |
# File 'lib/yt/models/playlist_item.rb', line 18 def initialize( = {}) @id = [:id] @auth = [:auth] if [:snippet] @position = [:snippet]['position'] @video = Video.new video_params_for end end |
Instance Attribute Details
#id ⇒ String (readonly)
Returns the ID that uniquely identify a YouTube playlist item.
9 10 11 |
# File 'lib/yt/models/playlist_item.rb', line 9 def id @id end |
#position ⇒ String (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, the second item has a position of 1, and so forth.
14 15 16 |
# File 'lib/yt/models/playlist_item.rb', line 14 def position @position end |
#video ⇒ Object (readonly)
Returns the value of attribute video.
16 17 18 |
# File 'lib/yt/models/playlist_item.rb', line 16 def video @video end |
Instance Method Details
#delete(options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/yt/models/playlist_item.rb', line 27 def delete( = {}) do_delete {@id = nil} !exists? end |
#exists? ⇒ Boolean
32 33 34 |
# File 'lib/yt/models/playlist_item.rb', line 32 def exists? !@id.nil? end |