Class: Yt::Models::Playlist
Instance Attribute Summary
Attributes inherited from Resource
#auth
Instance Method Summary
collapse
Methods inherited from Resource
#initialize, #kind, #username
#has_many
Instance Method Details
#delete ⇒ Object
8
9
10
11
|
# File 'lib/yt/models/playlist.rb', line 8
def delete
do_delete {@id = nil}
!exists?
end
|
#exists? ⇒ Boolean
31
32
33
|
# File 'lib/yt/models/playlist.rb', line 31
def exists?
!@id.nil?
end
|
#update(options = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/yt/models/playlist.rb', line 13
def update(options = {})
options[:title] ||= title
options[:description] ||= description
options[:tags] ||= tags
options[:privacy_status] ||= privacy_status
snippet = options.slice :title, :description, :tags
status = {privacyStatus: options[:privacy_status]}
body = {id: @id, snippet: snippet, status: status}
do_update(params: {part: 'snippet,status'}, body: body) do |data|
@id = data['id']
@snippet = Snippet.new data: data['snippet'] if data['snippet']
@status = Status.new data: data['status'] if data['status']
true
end
end
|