Class: Yt::Models::Account

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

Overview

Provides methods to interact with YouTube accounts.

Direct Known Subclasses

ContentOwner

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

Instance Attribute Details

#channelYt::Models::Channel (readonly)

Returns the account’s channel.

Returns:



11
# File 'lib/yt/models/account.rb', line 11

has_one :channel

#owner_nameString? (readonly)

Returns:

  • (String)

    name of the CMS account, if the account is partnered.

  • (nil)

    if the account is not a partnered content owner.



26
27
28
# File 'lib/yt/models/account.rb', line 26

def owner_name
  @owner_name
end

#resumable_sessionsYt::Collections::ResumableSessions (readonly)

Returns the sessions used to upload videos using the resumable upload protocol.

Returns:



33
# File 'lib/yt/models/account.rb', line 33

has_many :resumable_sessions

#user_infoYt::Models::UserInfo (readonly)

Returns the account’s profile information.

Returns:



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

has_one :user_info

#videosYt::Collections::Videos (readonly)

Returns the videos owned by the account.

Returns:



22
# File 'lib/yt/models/account.rb', line 22

has_many :videos

Instance Method Details

#upload_video(path_or_url, params = {}) ⇒ Yt::Models::Video

Uploads a video

Parameters:

  • path_or_url (String)

    the video 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 video.

Options Hash (params):

  • :title (String)

    The video’s title.

  • :description (String)

    The video’s description.

  • :title (Array<String>)

    The video’s tags.

  • :privacy_status (String)

    The video’s privacy status.

Returns:



44
45
46
47
48
# File 'lib/yt/models/account.rb', line 44

def upload_video(path_or_url, params = {})
  file = open path_or_url, 'rb'
  session = resumable_sessions.insert file.size, params
  session.upload_video file
end