Class: Yt::Collections::Playlists

Inherits:
Resources show all
Defined in:
lib/yt/collections/playlists.rb

Instance Method Summary collapse

Methods inherited from Resources

#delete_all

Methods inherited from Base

#initialize, of, #where

Methods included from Actions::List

#first!

Constructor Details

This class inherits a constructor from Yt::Collections::Base

Instance Method Details

#insert(options = {}) ⇒ Object

Valid body (no defaults) are: title (string), description (string), privacy_status (string), tags (array of strings)



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/yt/collections/playlists.rb', line 9

def insert(options = {})
  body = {}

  snippet = options.slice :title, :description, :tags
  body[:snippet] = snippet if snippet.any?

  status = options[:privacy_status]
  body[:status] = {privacyStatus: status} if status

  do_insert body: body, params: {part: 'snippet,status'}
end