class Yt::Models::ContentOwner

Provides methods to interact with YouTube CMS accounts. @see cms.youtube.com @see developers.google.com/youtube/analytics/v1/content_owner_reports

Attributes

display_name[R]

@return [String] The display name of the content owner.

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method Yt::Models::Account::new
# File lib/yt/models/content_owner.rb, line 43
def initialize(options = {})
  super options
  @owner_name = options[:owner_name]
  @display_name = options[:display_name]
end

Public Instance Methods

create_asset(params = {}) click to toggle source
# File lib/yt/models/content_owner.rb, line 69
def create_asset(params = {})
  assets.insert params
end
create_claim(params = {}) click to toggle source
# File lib/yt/models/content_owner.rb, line 73
def create_claim(params = {})
  claims.insert params
end
create_reference(params = {}) click to toggle source
# File lib/yt/models/content_owner.rb, line 65
def create_reference(params = {})
  references.insert params
end
insert_playlist_item_params() click to toggle source
# File lib/yt/models/content_owner.rb, line 122
def insert_playlist_item_params
  {on_behalf_of_content_owner: @owner_name}
end
playlist_items_params() click to toggle source
# File lib/yt/models/content_owner.rb, line 106
def playlist_items_params
  {on_behalf_of_content_owner: @owner_name}
end
update_playlist_params() click to toggle source
# File lib/yt/models/content_owner.rb, line 114
def update_playlist_params
  {on_behalf_of_content_owner: @owner_name}
end
update_video_params() click to toggle source
# File lib/yt/models/content_owner.rb, line 110
def update_video_params
  {on_behalf_of_content_owner: @owner_name}
end
upload_params() click to toggle source

@private Tells `has_many :resumable_sessions` what params are set for the object associated to the uploaded file.

# File lib/yt/models/content_owner.rb, line 95
def upload_params
  {part: 'snippet,status', on_behalf_of_content_owner: self.owner_name}
end
upload_path() click to toggle source

@private Tells `has_many :resumable_sessions` what path to hit to upload a file.

# File lib/yt/models/content_owner.rb, line 81
def upload_path
  '/upload/youtube/partner/v1/references'
end
upload_reference_file(path_or_url, params = {}) click to toggle source

Uploads a reference file to YouTube. @param [String] path_or_url is the video or audio file to upload. Can either be the

path of a local file or the URL of a remote file.

@param [Hash] params the metadata to add to the uploaded reference. @option params [String] :asset_id The id of the asset the uploaded reference belongs to. @option params [String] :content_type The type of content being uploaded. @return [Yt::Models::Reference] the newly uploaded reference.

# File lib/yt/models/content_owner.rb, line 56
def upload_reference_file(path_or_url, params = {})
  file = open path_or_url, 'rb'
  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_params() click to toggle source
# File lib/yt/models/content_owner.rb, line 118
def upload_thumbnail_params
  {on_behalf_of_content_owner: @owner_name}
end
video_groups_params() click to toggle source

@private Tells `has_many :video_groups` that content_owner.video_groups should return all the video-groups *on behalf of* the content owner

# File lib/yt/models/content_owner.rb, line 102
def video_groups_params
  {on_behalf_of_content_owner: @owner_name}
end
videos_params() click to toggle source

@private Tells `has_many :videos` that account.videos should return all the videos *on behalf of* the content owner (public, private, unlisted).

# File lib/yt/models/content_owner.rb, line 88
def videos_params
  {for_content_owner: true, on_behalf_of_content_owner: @owner_name}
end