class Yt::Models::Asset

Provides methods to interact with YouTube ContentID assets. @see developers.google.com/youtube/partner/docs/v1/assets

Attributes

auth[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/yt/models/asset.rb, line 11
def initialize(options = {})
  @data = options.fetch(:data, {})
  @id = options[:id]
  @auth = options[:auth]
  @params = options[:params]
end

Public Instance Methods

metadata_effective() click to toggle source
# File lib/yt/models/asset.rb, line 34
def metadata_effective
  @metadata_effective ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataEffective', {})
end
metadata_mine() click to toggle source
# File lib/yt/models/asset.rb, line 30
def metadata_mine
  @metadata_mine ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataMine', {})
end
ownership_effective() click to toggle source
# File lib/yt/models/asset.rb, line 38
def ownership_effective
  @ownership_effective ||= Yt::Models::Ownership.new data: @data.fetch('ownershipEffective', {})
end
update(attributes = {}) click to toggle source
# File lib/yt/models/asset.rb, line 18
def update(attributes = {})
  underscore_keys! attributes
  do_update body: attributes
  true
end

Private Instance Methods

get_params() click to toggle source

@return [Hash] the parameters to submit to YouTube to get an asset. @see developers.google.com/youtube/partner/docs/v1/assets/get

Calls superclass method
# File lib/yt/models/asset.rb, line 126
def get_params
  super.tap do |params|
    params[:path] = "/youtube/partner/v1/assets/#{@id}"
    params[:params] = {on_behalf_of_content_owner: @auth.owner_name}.merge! @params
  end
end
patch_params() click to toggle source

@see developers.google.com/youtube/partner/docs/v1/assets/patch

Calls superclass method
# File lib/yt/models/asset.rb, line 107
def patch_params
  super.tap do |params|
    params[:expected_response] = Net::HTTPOK
    params[:path] = "/youtube/partner/v1/assets/#{@id}"
    params[:params] = {on_behalf_of_content_owner: @auth.owner_name}
  end
end
update_params() click to toggle source

@see developers.google.com/youtube/partner/docs/v1/assets/update

Calls superclass method
# File lib/yt/models/asset.rb, line 116
def update_params
  super.tap do |params|
    params[:expected_response] = Net::HTTPOK
    params[:path] = "/youtube/partner/v1/assets/#{@id}"
    params[:params] = {on_behalf_of_content_owner: @auth.owner_name}
  end
end