Class: Yt::Models::PlaylistItem

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Associations

#has_many

Constructor Details

#initialize(options = {}) ⇒ PlaylistItem

Returns a new instance of PlaylistItem.



8
9
10
11
12
13
14
15
# File 'lib/yt/models/playlist_item.rb', line 8

def initialize(options = {})
  @id = options[:id]
  @auth = options[:auth]
  if options[:snippet]
    @position = options[:snippet]['position']
    @video = Video.new video_params_for options
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/yt/models/playlist_item.rb', line 6

def id
  @id
end

#positionObject (readonly)

Returns the value of attribute position.



6
7
8
# File 'lib/yt/models/playlist_item.rb', line 6

def position
  @position
end

#videoObject (readonly)

Returns the value of attribute video.



6
7
8
# File 'lib/yt/models/playlist_item.rb', line 6

def video
  @video
end

Instance Method Details

#deleteObject



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

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

#exists?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/yt/models/playlist_item.rb', line 22

def exists?
  !@id.nil?
end