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
# File 'lib/yt/models/asset.rb', line 11

def initialize(options = {})
  @data = options.fetch(:data, {})
  @id = options[:id]
  @auth = options[:auth]
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)


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

has_one :ownership

Instance Method Details

#idString


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

has_attribute :id

#labelArray<Yt::Models::Tag>


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

has_attribute :label

#metadata_effectiveObject


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

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

#metadata_mineObject


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

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

#typeString

Returns the asset’s type.


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

has_attribute :type

#update(attributes = {}) ⇒ Object


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

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