Class: Yt::Models::Policy

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

Overview

Provides methods to interact with YouTube ContentID policies. A policy resource specifies rules that define a particular usage or match policy that a partner can associate with an asset or claim.

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

Returns a new instance of Policy.



11
12
13
# File 'lib/yt/models/policy.rb', line 11

def initialize(options = {})
  @data = options[:data]
end

Instance Method Details

#descriptionString

Returns the policy’s description.

Returns:

  • (String)

    the policy’s description.



27
28
29
# File 'lib/yt/models/policy.rb', line 27

def description
  @name ||= @data['description']
end

#idString

Returns the ID that YouTube assigns and uses to uniquely identify the policy.

Returns:

  • (String)

    the ID that YouTube assigns and uses to uniquely identify the policy.



17
18
19
# File 'lib/yt/models/policy.rb', line 17

def id
  @id ||= @data['id']
end

#nameString

Returns the policy’s name.

Returns:

  • (String)

    the policy’s name.



22
23
24
# File 'lib/yt/models/policy.rb', line 22

def name
  @name ||= @data['name']
end

#rulesArray<PolicyRule>

Returns a list of rules that specify the action that YouTube should take and may optionally specify the conditions under which that action is enforced.

Returns:

  • (Array<PolicyRule>)

    a list of rules that specify the action that YouTube should take and may optionally specify the conditions under which that action is enforced.



40
41
42
# File 'lib/yt/models/policy.rb', line 40

def rules
  @rules ||= @data['rules'].map{|rule| PolicyRule.new data: rule}
end

#updated_atString Also known as: time_updated

Returns the time the policy was updated.

Returns:

  • (String)

    the time the policy was updated.



32
33
34
# File 'lib/yt/models/policy.rb', line 32

def updated_at
  @updated_at ||= Time.parse @data['timeUpdated']
end