Class: Yt::Models::ContentOwner

Inherits:
Account
  • Object
show all
Defined in:
lib/yt/models/content_owner.rb

Overview

Provides methods to interact with YouTube CMS accounts.

Instance Attribute Summary collapse

Attributes inherited from Account

#channel, #content_owners, #email, #family_name, #given_name, #id, #name, #owner_name, #playlists, #related_playlists, #sub, #subscribed_channels, #subscribers, #videos

Instance Method Summary collapse

Methods inherited from Account

#avatar_url, #create_playlist, #delete_playlists, #gender, #has_verified_email?, #hd, #locale, #profile_url, #upload_video

Constructor Details

#initialize(options = {}) ⇒ ContentOwner

Returns a new instance of ContentOwner.



47
48
49
50
51
# File 'lib/yt/models/content_owner.rb', line 47

def initialize(options = {})
  super options
  @owner_name = options[:owner_name]
  @display_name = options[:display_name]
end

Instance Attribute Details

#assetsYt::Collection::Assets (readonly)

Returns the assets administered by the content owner.

Returns:

  • (Yt::Collection::Assets)

    the assets administered by the content owner.



24
# File 'lib/yt/models/content_owner.rb', line 24

has_many :assets

#bulk_report_jobsYt::Collections::BulkReportJobs (readonly)

Returns the bulk reporting jobs managed by the content owner.

Returns:

  • (Yt::Collections::BulkReportJobs)

    the bulk reporting jobs managed by the content owner.



45
# File 'lib/yt/models/content_owner.rb', line 45

has_many :bulk_report_jobs

#claimsYt::Collections::Claims (readonly)

Returns the claims administered by the content owner.

Returns:



20
# File 'lib/yt/models/content_owner.rb', line 20

has_many :claims

#display_nameString (readonly)

Returns The display name of the content owner.

Returns:

  • (String)

    The display name of the content owner.



35
36
37
# File 'lib/yt/models/content_owner.rb', line 35

def display_name
  @display_name
end

#live_cuepointsYt::Collections::LiveCuepoints (readonly)

Returns the live_cuepoints inserted by the content owner.

Returns:



16
# File 'lib/yt/models/content_owner.rb', line 16

has_many :live_cuepoints

#partnered_channelsYt::Collections::PartneredChannels (readonly)

Returns the channels managed by the CMS account.

Returns:



12
# File 'lib/yt/models/content_owner.rb', line 12

has_many :partnered_channels

#policiesYt::Collections::Policies (readonly)

Returns the policies saved by the content owner.

Returns:



32
# File 'lib/yt/models/content_owner.rb', line 32

has_many :policies

#referencesYt::Collections::References (readonly)

Returns the references administered by the content owner.

Returns:



28
# File 'lib/yt/models/content_owner.rb', line 28

has_many :references

#video_groupsYt::Collections::VideoGroups (readonly)

Returns the video-groups managed by the content owner.

Returns:

  • (Yt::Collections::VideoGroups)

    the video-groups managed by the content owner.



40
# File 'lib/yt/models/content_owner.rb', line 40

has_many :video_groups

Instance Method Details

#create_asset(params = {}) ⇒ Object



73
74
75
# File 'lib/yt/models/content_owner.rb', line 73

def create_asset(params = {})
  assets.insert params
end

#create_claim(params = {}) ⇒ Object



77
78
79
# File 'lib/yt/models/content_owner.rb', line 77

def create_claim(params = {})
  claims.insert params
end

#create_reference(params = {}) ⇒ Object



69
70
71
# File 'lib/yt/models/content_owner.rb', line 69

def create_reference(params = {})
  references.insert params
end

#insert_playlist_item_paramsObject



126
127
128
# File 'lib/yt/models/content_owner.rb', line 126

def insert_playlist_item_params
  {on_behalf_of_content_owner: @owner_name}
end

#playlist_items_paramsObject



110
111
112
# File 'lib/yt/models/content_owner.rb', line 110

def playlist_items_params
  {on_behalf_of_content_owner: @owner_name}
end

#update_playlist_paramsObject



118
119
120
# File 'lib/yt/models/content_owner.rb', line 118

def update_playlist_params
  {on_behalf_of_content_owner: @owner_name}
end

#update_video_paramsObject



114
115
116
# File 'lib/yt/models/content_owner.rb', line 114

def update_video_params
  {on_behalf_of_content_owner: @owner_name}
end

#upload_reference_file(path_or_url, params = {}) ⇒ Yt::Models::Reference

Uploads a reference file to YouTube.

Parameters:

  • path_or_url (String)

    is the video or audio file to upload. Can either be the path of a local file or the URL of a remote file.

  • params (Hash) (defaults to: {})

    the metadata to add to the uploaded reference.

Options Hash (params):

  • :asset_id (String)

    The id of the asset the uploaded reference belongs to.

  • :content_type (String)

    The type of content being uploaded.

Returns:



60
61
62
63
64
65
66
67
# File 'lib/yt/models/content_owner.rb', line 60

def upload_reference_file(path_or_url, params = {})
  file = URI.open(path_or_url)
  session = resumable_sessions.insert file.size, params

  session.update(body: file) do |data|
    Yt::Reference.new id: data['id'], data: data, auth: self
  end
end

#upload_thumbnail_paramsObject



122
123
124
# File 'lib/yt/models/content_owner.rb', line 122

def upload_thumbnail_params
  {on_behalf_of_content_owner: @owner_name}
end