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


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>


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>


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>


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>


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