Class: Yt::Models::Ownership

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/ownership.rb

Overview

Provides methods to interact with YouTube ContentID asset ownership, which provide ownership information for the specified asset.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Ownership

Returns a new instance of Ownership.



10
11
12
13
14
# File 'lib/yt/models/ownership.rb', line 10

def initialize(options = {})
  @data = options[:data] || {}
  @auth = options[:auth]
  @asset_id = options[:asset_id]
end

Instance Method Details

#general_ownersArray<RightOwner>

Returns a list that identifies the owners of an asset and the territories where each owner has ownership. General asset ownership is used for all types of assets and is the only type of ownership data that can be provided for assets that are not compositions.

Returns:

  • (Array<RightOwner>)

    a list that identifies the owners of an asset and the territories where each owner has ownership. General asset ownership is used for all types of assets and is the only type of ownership data that can be provided for assets that are not compositions.



37
38
39
# File 'lib/yt/models/ownership.rb', line 37

has_attribute :general_owners, from: :general do |data|
  as_owners data
end

#mechanical_ownersArray<RightOwner>

Returns a list that identifies owners of the mechanical rights for a composition asset.

Returns:

  • (Array<RightOwner>)

    a list that identifies owners of the mechanical rights for a composition asset.



55
56
57
# File 'lib/yt/models/ownership.rb', line 55

has_attribute :mechanical_owners, from: :mechanical do |data|
  as_owners data
end

#obtain!Object

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



23
24
25
# File 'lib/yt/models/ownership.rb', line 23

def obtain!
  update general: [{ratio: 100, owner: @auth.owner_name, type: :exclude}]
end

#performance_ownersArray<RightOwner>

Returns a list that identifies owners of the performance rights for a composition asset.

Returns:

  • (Array<RightOwner>)

    a list that identifies owners of the performance rights for a composition asset.



43
44
45
# File 'lib/yt/models/ownership.rb', line 43

has_attribute :performance_owners, from: :performance do |data|
  as_owners data
end

#release!Object

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



28
29
30
# File 'lib/yt/models/ownership.rb', line 28

def release!
  update general: [{ratio: 0, owner: @auth.owner_name, type: :exclude}]
end

#synchronization_ownersArray<RightOwner>

Returns a list that identifies owners of the synchronization rights for a composition asset.

Returns:

  • (Array<RightOwner>)

    a list that identifies owners of the synchronization rights for a composition asset.



49
50
51
# File 'lib/yt/models/ownership.rb', line 49

has_attribute :synchronization_owners, from: :synchronization do |data|
  as_owners data
end

#update(attributes = {}) ⇒ Object



16
17
18
19
20
# File 'lib/yt/models/ownership.rb', line 16

def update(attributes = {})
  underscore_keys! attributes
  do_update body: attributes
  true
end