Skip to content

Commit

Permalink
Delete playlist items via content owner (#375)
Browse files Browse the repository at this point in the history
* Delete playlist items via content owner

* Add default to params[:params]
  • Loading branch information
dgb committed Feb 7, 2020
1 parent d70171d commit b2ea040
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/yt/models/account.rb
Expand Up @@ -192,6 +192,10 @@ def video_groups_params
{mine: true}
end

def playlist_items_params
{}
end

# @private
# Tells `has_many :resumable_sessions` what path to hit to upload a file.
def upload_path
Expand Down
4 changes: 4 additions & 0 deletions lib/yt/models/content_owner.rb
Expand Up @@ -102,6 +102,10 @@ def upload_params
def video_groups_params
{on_behalf_of_content_owner: @owner_name}
end

def playlist_items_params
{on_behalf_of_content_owner: @owner_name}
end
end
end
end
9 changes: 8 additions & 1 deletion lib/yt/models/playlist_item.rb
Expand Up @@ -101,6 +101,13 @@ def resource_id
{kind: 'youtube#video', videoId: video_id}
end

def delete_params
super.tap do |params|
params[:params] ||= {}
params[:params].merge! @auth.playlist_items_params
end
end

# @see https://developers.google.com/youtube/v3/docs/playlistItems/update
def update_parts
keys = [:position, :playlist_id, :resource_id]
Expand All @@ -109,4 +116,4 @@ def update_parts
end
end
end
end
end

0 comments on commit b2ea040

Please sign in to comment.