Class: Yt::Models::Asset

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

Overview

Provides methods to interact with YouTube ContentID assets.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Asset


11
12
13
14
15
16
# File 'lib/yt/models/asset.rb', line 11

def initialize(options = {})
  @data = options.fetch(:data, {})
  @id = options[:id]
  @auth = options[:auth]
  @params = options[:params]
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth


9
10
11
# File 'lib/yt/models/asset.rb', line 9

def auth
  @auth
end

#ownershipYt::Models::Ownership (readonly)


26
# File 'lib/yt/models/asset.rb', line 26

has_one :ownership

Instance Method Details

#idString


59
# File 'lib/yt/models/asset.rb', line 59

has_attribute :id

#labelArray<String>


76
# File 'lib/yt/models/asset.rb', line 76

has_attribute :label, default: []

#metadata_effectiveObject


34
35
36
# File 'lib/yt/models/asset.rb', line 34

def 
  @metadata_effective ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataEffective', {})
end

#metadata_mineObject


30
31
32
# File 'lib/yt/models/asset.rb', line 30

def 
  @metadata_mine ||= Yt::Models::AssetMetadata.new data: @data.fetch('metadataMine', {})
end

#ownership_effectiveObject


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

def ownership_effective
  @ownership_effective ||= Yt::Models::Ownership.new data: @data.fetch('ownershipEffective', {})
end

#typeString

Returns the asset’s type.


70
# File 'lib/yt/models/asset.rb', line 70

has_attribute :type

#update(attributes = {}) ⇒ Object


18
19
20
21
22
# File 'lib/yt/models/asset.rb', line 18

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