Class: Yt::Models::PlaylistItem
- Defined in:
- lib/yt/models/playlist_item.rb
Overview
Provides methods to interact with YouTube playlist items.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #delete(options = {}) ⇒ Object
- #exists? ⇒ Boolean
-
#position ⇒ Integer
Returns the position of the item in the playlist.
Methods inherited from Resource
#initialize, #kind, #update, #username
Methods included from Associations::HasReports
Methods included from Associations::HasViewerPercentages
Methods included from Associations::HasOne
Methods included from Associations::HasMany
Methods included from Associations::HasAuthentication
Constructor Details
This class inherits a constructor from Yt::Models::Resource
Instance Method Details
#delete(options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/yt/models/playlist_item.rb', line 11 def delete( = {}) do_delete {@id = nil} !exists? end |
#exists? ⇒ Boolean
16 17 18 |
# File 'lib/yt/models/playlist_item.rb', line 16 def exists? !@id.nil? end |
#position ⇒ Integer
Returns the position of the item in the playlist. Since YouTube API does not return the position on PlaylistItem#create, the memoized @snippet is erased if the video was instantiated like that, so that the full snippet (with position) is loaded, rather than the partial one.
27 28 29 30 31 32 |
# File 'lib/yt/models/playlist_item.rb', line 27 def position unless snippet.position || snippet.complete? || @auth.nil? @snippet = nil end snippet.position end |