Class: Yt::Collections::PlaylistItems
- Defined in:
- lib/yt/collections/playlist_items.rb
Instance Method Summary collapse
- #delete_all(params = {}) ⇒ Object
-
#insert(attrs = {}, options = {}) ⇒ Object
attrs are id and kind.
Methods inherited from Base
Methods included from Actions::List
Constructor Details
This class inherits a constructor from Yt::Collections::Base
Instance Method Details
#delete_all(params = {}) ⇒ Object
19 20 21 |
# File 'lib/yt/collections/playlist_items.rb', line 19 def delete_all(params = {}) do_delete_all params end |
#insert(attrs = {}, options = {}) ⇒ Object
attrs are id and kind
9 10 11 12 13 14 15 16 17 |
# File 'lib/yt/collections/playlist_items.rb', line 9 def insert(attrs = {}, = {}) # resource = {kind: "youtube##{attrs[:kind]}"} resource["#{attrs[:kind]}Id"] = attrs[:id] snippet = {playlistId: @parent.id, resourceId: resource} do_insert body: {snippet: snippet}, params: {part: 'snippet,status'} rescue Yt::Error => error ignorable_errors = error.reasons & ['videoNotFound', 'forbidden'] raise error unless [:ignore_errors] && ignorable_errors.any? end |