Class: Yt::Models::ContentOwnerDetail

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

Overview

Encapsulates channel data that is relevant for YouTube Partners linked with the channel.

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

Returns a new instance of ContentOwnerDetail.



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

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

Instance Method Details

#content_ownerString?

Returns the name of the content owner linked to the channel.

This method requires auth to return an authenticated instance of Yt::Models::ContentOwner that can administer the channel.

Returns:

  • (String)

    if the channel is partnered with a content owner, the name of the content owner linked to the channel.

  • (nil)

    if the channel is not partnered with a content owner.

  • (nil)

    if auth is a content owner without permissions to administer the channel.

Raises:



24
25
26
# File 'lib/yt/models/content_owner_detail.rb', line 24

def content_owner
  @content_owner ||= @data['contentOwner']
end

#linked_atTime?

Returns the date and time of when the channel was linked to the content owner.

This method requires auth to return an authenticated instance of Yt::Models::ContentOwner that can administer the channel.

Returns:

  • (Time)

    if the channel is partnered with a content owner, the date and time when the channel was linked with the content owner.

  • (nil)

    if the channel is not partnered with a content owner.

  • (nil)

    if auth is a content owner without permissions to administer the channel.

Raises:



40
41
42
43
44
# File 'lib/yt/models/content_owner_detail.rb', line 40

def linked_at
  @linked_at ||= if @data['timeLinked']
    Time.parse @data['timeLinked']
  end
end