class Yt::Collections::Assets
Provides methods to interact with a collection of Content ID assets.
Resources
with assets are: {Yt::Models::ContentOwner content owners}.
Public Instance Methods
Source
# File lib/yt/collections/assets.rb, line 11 def insert(attributes = {}) params = {on_behalf_of_content_owner: @auth.owner_name} do_insert(params: params, body: attributes) end
Private Instance Methods
Source
# File lib/yt/collections/assets.rb, line 33 def assets_params apply_where_params! on_behalf_of_content_owner: @auth.owner_name end
Source
# File lib/yt/collections/assets.rb, line 40 def assets_path @where_params ||= {} if @where_params.key?(:id) '/youtube/partner/v1/assets' else '/youtube/partner/v1/assetSearch' end end
@private @todo: This is one of three places outside of base.rb where @where_params
is accessed; it should be replaced with a filter on params instead.
Source
# File lib/yt/collections/assets.rb, line 51 def insert_params super.tap do |params| params[:path] = '/youtube/partner/v1/assets' end end
@return [Hash] the parameters to submit to YouTube to add a asset. @see developers.google.com/youtube/partner/docs/v1/assets/insert
Calls superclass method
Source
# File lib/yt/collections/assets.rb, line 26 def list_params super.tap do |params| params[:path] = assets_path params[:params] = assets_params end end
@return [Hash] the parameters to submit to YouTube to list assets
owned by the content owner.
@see developers.google.com/youtube/partner/docs/v1/assets/list
Calls superclass method
Source
# File lib/yt/collections/assets.rb, line 18 def new_item(data) klass = (data["kind"] == "youtubePartner#assetSnippet") ? Yt::AssetSnippet : Yt::Asset klass.new attributes_for_new_item(data) end