class Yt::Models::Ownership

Provides methods to interact with YouTube ContentID asset ownership, which provide ownership information for the specified asset. @see developers.google.com/youtube/partner/docs/v1/ownership

Public Class Methods

new(options = {}) click to toggle source
# File lib/yt/models/ownership.rb, line 10
def initialize(options = {})
  @data = options[:data] || {}
  @auth = options[:auth]
  @asset_id = options[:asset_id]
end

Public Instance Methods

obtain!() click to toggle source

Assigns 100% of the general ownership of the asset to @auth.

# File lib/yt/models/ownership.rb, line 23
def obtain!
  update general: [{ratio: 100, owner: @auth.owner_name, type: :exclude}]
end
release!() click to toggle source

Releases 100% of the general ownership of the asset from @auth.

# File lib/yt/models/ownership.rb, line 28
def release!
  update general: [{ratio: 0, owner: @auth.owner_name, type: :exclude}]
end
update(attributes = {}) click to toggle source
# File lib/yt/models/ownership.rb, line 16
def update(attributes = {})
  underscore_keys! attributes
  do_update body: attributes
  true
end

Private Instance Methods

as_owners(data) click to toggle source
# File lib/yt/models/ownership.rb, line 70
def as_owners(data)
  (data || []).map{|owner_data| Yt::RightOwner.new data: owner_data}
end
update_params() click to toggle source

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

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