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

#content_ownersYt::Collections::ContentOwners (readonly)

Returns the content_owners accessible by the account.

Returns:



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

has_many :content_owners

#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.



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

def owner_name
  @owner_name
end

#playlistsYt::Collections::Playlists (readonly)

Returns the account’s playlists.

Returns:



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

has_many :playlists

#resumable_sessionsYt::Collections::ResumableSessions (readonly)

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

Returns:



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

has_many :resumable_sessions

#subscribersYt::Collections::Subscribers (readonly)

Returns the channels subscribed to the account.

Returns:



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

has_many :subscribers

#user_infoYt::Models::UserInfo (readonly)

Returns the account’s profile information.

Returns:



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

has_one :user_info

#videosYt::Collections::Videos (readonly)

Returns the videos owned by the account.

Returns:



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

has_many :videos

Instance Method Details

#create_playlist(params = {}) ⇒ Object



64
65
66
# File 'lib/yt/models/account.rb', line 64

def create_playlist(params = {})
  playlists.insert params
end

#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:



58
59
60
61
62
# File 'lib/yt/models/account.rb', line 58

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