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.

Constant Summary collapse

STATUSES =

Status

%q(active inactive pending)

Instance Attribute Summary collapse

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 = {}) ⇒ 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>



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

has_attribute :label

#metadata_effectiveObject



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

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

#metadata_mineObject



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

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

#typeString



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

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