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

Methods included from Associations::HasReports

#has_report

Methods included from Associations::HasViewerPercentages

#has_viewer_percentages

Methods included from Associations::HasOne

#has_one

Methods included from Associations::HasMany

#has_many

Methods included from Associations::HasAuthentication

#has_authentication

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.



32
33
34
# File 'lib/yt/models/ownership.rb', line 32

def general_owners
  @general_owners ||= as_owners @data['general']
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.



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

def mechanical_owners
  @mechanical_owners ||= as_owners @data['mechanical']
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.



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

def performance_owners
  @performance_owners ||= as_owners @data['performance']
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.



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

def synchronization_owners
  @synchronization_owners ||= as_owners @data['synchronization']
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