Class: Yt::Models::Account
- Inherits:
-
Base
- Object
- Base
- Yt::Models::Account
- Defined in:
- lib/yt/models/account.rb
Overview
Provides methods to interact with YouTube accounts.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#channel ⇒ Yt::Models::Channel
readonly
The YouTube channel of the account.
-
#content_owners ⇒ Yt::Collections::ContentOwners
readonly
The content owners that the account can manage.
-
#email ⇒ String
readonly
The account’s email address.
-
#family_name ⇒ String
readonly
The user’s family (last) name.
-
#given_name ⇒ String
readonly
The user’s given (first) name.
-
#id ⇒ String
readonly
The (Google+) account’s ID.
-
#name ⇒ String
readonly
The account’s full name.
-
#owner_name ⇒ String?
readonly
The name of the content owner managing the account.
-
#playlists ⇒ Yt::Collections::Playlists
readonly
The playlists owned by the account.
-
#related_playlists ⇒ Yt::Collections::Playlists
readonly
The playlists associated with the account, such as the playlist of uploaded or liked videos.
-
#subscribed_channels ⇒ Yt::Collections::SubscribedChannels
readonly
The channels that the account is subscribed to.
-
#subscribers ⇒ Yt::Collections::Subscribers
readonly
The channels subscribed to the account’s channel.
-
#video_groups ⇒ Yt::Collections::VideoGroups
readonly
The video-groups created by the account.
-
#videos ⇒ Yt::Collections::Videos
readonly
The videos owned by the account.
Instance Method Summary collapse
-
#avatar_url ⇒ String
The URL of the account’s (Google +) profile picture.
-
#create_playlist(params = {}) ⇒ Yt::Models::Playlist
Creates a playlist in the account’s channel.
-
#delete_playlists(attributes = {}) ⇒ Array<Boolean>
Deletes the account’s playlists matching all the given attributes.
-
#gender ⇒ String
The account’s gender.
-
#has_verified_email? ⇒ Boolean
Whether the email address is verified.
-
#hd ⇒ String
The hosted domain name for the user’s Google Apps account.
-
#locale ⇒ String
The account’s preferred locale.
-
#profile_url ⇒ String
The URL of the account’s (Google +) profile page.
-
#upload_video(path_or_url, params = {}) ⇒ Yt::Models::Video
Uploads a video to the account’s channel.
Instance Attribute Details
#channel ⇒ Yt::Models::Channel (readonly)
Returns the YouTube channel of the account.
131 |
# File 'lib/yt/models/account.rb', line 131 has_one :channel |
#content_owners ⇒ Yt::Collections::ContentOwners (readonly)
Returns the content owners that the account can manage.
120 |
# File 'lib/yt/models/account.rb', line 120 has_many :content_owners |
#email ⇒ String (readonly)
Returns the account’s email address.
20 |
# File 'lib/yt/models/account.rb', line 20 delegate :email, to: :user_info |
#family_name ⇒ String (readonly)
Returns the user’s family (last) name.
37 |
# File 'lib/yt/models/account.rb', line 37 delegate :family_name, to: :user_info |
#given_name ⇒ String (readonly)
Returns the user’s given (first) name.
33 |
# File 'lib/yt/models/account.rb', line 33 delegate :given_name, to: :user_info |
#id ⇒ String (readonly)
Returns the (Google+) account’s ID.
16 |
# File 'lib/yt/models/account.rb', line 16 delegate :id, to: :user_info |
#name ⇒ String (readonly)
Returns the account’s full name.
29 |
# File 'lib/yt/models/account.rb', line 29 delegate :name, to: :user_info |
#owner_name ⇒ String? (readonly)
The name of the content owner managing the account.
125 126 127 |
# File 'lib/yt/models/account.rb', line 125 def owner_name @owner_name end |
#playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the playlists owned by the account.
135 |
# File 'lib/yt/models/account.rb', line 135 delegate :playlists, to: :channel |
#related_playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the playlists associated with the account, such as the playlist of uploaded or liked videos.
141 |
# File 'lib/yt/models/account.rb', line 141 delegate :related_playlists, to: :channel |
#subscribed_channels ⇒ Yt::Collections::SubscribedChannels (readonly)
Returns the channels that the account is subscribed to.
146 |
# File 'lib/yt/models/account.rb', line 146 delegate :subscribed_channels, to: :channel |
#subscribers ⇒ Yt::Collections::Subscribers (readonly)
Returns the channels subscribed to the account’s channel.
155 |
# File 'lib/yt/models/account.rb', line 155 has_many :subscribers |
#video_groups ⇒ Yt::Collections::VideoGroups (readonly)
Returns the video-groups created by the account.
166 |
# File 'lib/yt/models/account.rb', line 166 has_many :video_groups |
#videos ⇒ Yt::Collections::Videos (readonly)
Returns the videos owned by the account.
150 |
# File 'lib/yt/models/account.rb', line 150 has_many :videos |
Instance Method Details
#avatar_url ⇒ String
Returns the URL of the account’s (Google +) profile picture.
45 46 47 |
# File 'lib/yt/models/account.rb', line 45 def avatar_url user_info.picture end |
#create_playlist(params = {}) ⇒ Yt::Models::Playlist
Creates a playlist in the account’s channel.
96 97 98 |
# File 'lib/yt/models/account.rb', line 96 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attributes = {}) ⇒ Array<Boolean>
Deletes the account’s playlists matching all the given attributes.
113 |
# File 'lib/yt/models/account.rb', line 113 delegate :delete_playlists, to: :channel |
#gender ⇒ String
Returns the account’s gender. Possible values include, but are not limited to, ‘male’, ‘female’, ‘other’.
51 |
# File 'lib/yt/models/account.rb', line 51 delegate :gender, to: :user_info |
#has_verified_email? ⇒ Boolean
Returns whether the email address is verified.
23 24 25 |
# File 'lib/yt/models/account.rb', line 23 def has_verified_email? user_info.verified_email end |
#hd ⇒ String
Returns the hosted domain name for the user’s Google Apps account. For instance, example.com.
58 |
# File 'lib/yt/models/account.rb', line 58 delegate :hd, to: :user_info |
#locale ⇒ String
Returns the account’s preferred locale.
54 |
# File 'lib/yt/models/account.rb', line 54 delegate :locale, to: :user_info |
#profile_url ⇒ String
Returns the URL of the account’s (Google +) profile page.
40 41 42 |
# File 'lib/yt/models/account.rb', line 40 def profile_url user_info.link end |
#upload_video(path_or_url, params = {}) ⇒ Yt::Models::Video
Uploads a video to the account’s channel.
71 72 73 74 75 76 77 78 |
# File 'lib/yt/models/account.rb', line 71 def upload_video(path_or_url, params = {}) file = open path_or_url, 'rb' session = resumable_sessions.insert file.size, upload_body(params) session.update(body: file) do |data| Yt::Video.new id: data['id'], snippet: data['snippet'], status: data['privacyStatus'], auth: self end end |