Class: Yt::Models::PlaylistItem

Inherits:
Resource
  • Object
show all
Defined in:
lib/yt/models/playlist_item.rb

Overview

Provides methods to interact with YouTube playlist items.

Instance Attribute Summary collapse

Attributes inherited from Resource

#id, #privacy_status

Instance Method Summary collapse

Methods inherited from Resource

#private?, #public?, #unlisted?

Instance Attribute Details

#channel_idString (readonly)


34
# File 'lib/yt/models/playlist_item.rb', line 34

delegate :channel_id, to: :snippet

#channel_titleString (readonly)


38
# File 'lib/yt/models/playlist_item.rb', line 38

delegate :channel_title, to: :snippet

#descriptionString (readonly)


17
# File 'lib/yt/models/playlist_item.rb', line 17

delegate :description, to: :snippet

#playlist_idString (readonly)


42
# File 'lib/yt/models/playlist_item.rb', line 42

delegate :playlist_id, to: :snippet

#published_atTime (readonly)


30
# File 'lib/yt/models/playlist_item.rb', line 30

delegate :published_at, to: :snippet

#titleString (readonly)


13
# File 'lib/yt/models/playlist_item.rb', line 13

delegate :title, to: :snippet

Instance Method Details

#delete(options = {}) ⇒ Boolean

Deletes the playlist item.

Raises:


61
62
63
64
# File 'lib/yt/models/playlist_item.rb', line 61

def delete(options = {})
  do_delete {@id = nil}
  !exists?
end

#positionInteger


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.

Options Hash (attributes):

  • the (Integer)

    order in which the item should appear in a playlist. The value is zero-based, so the first position of 0.

Raises:


73
74
75
# File 'lib/yt/models/playlist_item.rb', line 73

def update(attributes = {})
  super
end

#videoYt::Models::Video


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_idString


45
46
47
# File 'lib/yt/models/playlist_item.rb', line 45

def video_id
  snippet.resource_id['videoId']
end