Class: Yt::Models::Ownership
- Inherits:
-
Base
- Object
- Base
- Yt::Models::Ownership
- 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
-
#general_owners ⇒ Array<RightOwner>
A list that identifies the owners of an asset and the territories where each owner has ownership.
-
#initialize(options = {}) ⇒ Ownership
constructor
A new instance of Ownership.
-
#mechanical_owners ⇒ Array<RightOwner>
A list that identifies owners of the mechanical rights for a composition asset.
-
#obtain! ⇒ Object
Assigns 100% of the general ownership of the asset to @auth.
-
#performance_owners ⇒ Array<RightOwner>
A list that identifies owners of the performance rights for a composition asset.
-
#release! ⇒ Object
Releases 100% of the general ownership of the asset from @auth.
-
#synchronization_owners ⇒ Array<RightOwner>
A list that identifies owners of the synchronization rights for a composition asset.
- #update(attributes = {}) ⇒ Object
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( = {}) @data = [:data] || {} @auth = [:auth] @asset_id = [:asset_id] end |
Instance Method Details
#general_owners ⇒ Array<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.
37 38 39 |
# File 'lib/yt/models/ownership.rb', line 37 has_attribute :general_owners, from: :general do |data| as_owners data end |
#mechanical_owners ⇒ Array<RightOwner>
Returns 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_owners ⇒ Array<RightOwner>
Returns 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_owners ⇒ Array<RightOwner>
Returns 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 |