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.
-
#sub ⇒ String
readonly
The (Google) account’s unique ID.
-
#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.
- #insert_playlist_item_params ⇒ Object
-
#locale ⇒ String
The account’s preferred locale.
- #playlist_items_params ⇒ Object
-
#profile_url ⇒ String
The URL of the account’s (Google +) profile page.
- #update_playlist_params ⇒ Object
- #update_video_params ⇒ Object
- #upload_thumbnail_params ⇒ Object
-
#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.
141 |
# File 'lib/yt/models/account.rb', line 141 has_one :channel |
#content_owners ⇒ Yt::Collections::ContentOwners (readonly)
Returns the content owners that the account can manage.
130 |
# File 'lib/yt/models/account.rb', line 130 has_many :content_owners |
#email ⇒ String (readonly)
Returns the account’s email address.
24 |
# File 'lib/yt/models/account.rb', line 24 delegate :email, to: :user_info |
#family_name ⇒ String (readonly)
Returns the user’s family (last) name.
41 |
# File 'lib/yt/models/account.rb', line 41 delegate :family_name, to: :user_info |
#given_name ⇒ String (readonly)
Returns the user’s given (first) name.
37 |
# File 'lib/yt/models/account.rb', line 37 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.
33 |
# File 'lib/yt/models/account.rb', line 33 delegate :name, to: :user_info |
#owner_name ⇒ String? (readonly)
The name of the content owner managing the account.
135 136 137 |
# File 'lib/yt/models/account.rb', line 135 def owner_name @owner_name end |
#playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the playlists owned by the account.
145 |
# File 'lib/yt/models/account.rb', line 145 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.
151 |
# File 'lib/yt/models/account.rb', line 151 delegate :related_playlists, to: :channel |
#sub ⇒ String (readonly)
Returns the (Google) account’s unique ID.
20 |
# File 'lib/yt/models/account.rb', line 20 delegate :sub, to: :user_info |
#subscribed_channels ⇒ Yt::Collections::SubscribedChannels (readonly)
Returns the channels that the account is subscribed to.
156 |
# File 'lib/yt/models/account.rb', line 156 delegate :subscribed_channels, to: :channel |
#subscribers ⇒ Yt::Collections::Subscribers (readonly)
Returns the channels subscribed to the account’s channel.
165 |
# File 'lib/yt/models/account.rb', line 165 has_many :subscribers |
#video_groups ⇒ Yt::Collections::VideoGroups (readonly)
Returns the video-groups created by the account.
176 |
# File 'lib/yt/models/account.rb', line 176 has_many :video_groups |
#videos ⇒ Yt::Collections::Videos (readonly)
Returns the videos owned by the account.
160 |
# File 'lib/yt/models/account.rb', line 160 has_many :videos |
Instance Method Details
#avatar_url ⇒ String
Returns the URL of the account’s (Google +) profile picture.
49 50 51 |
# File 'lib/yt/models/account.rb', line 49 def avatar_url user_info.picture end |
#create_playlist(params = {}) ⇒ Yt::Models::Playlist
Creates a playlist in the account’s channel.
106 107 108 |
# File 'lib/yt/models/account.rb', line 106 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attributes = {}) ⇒ Array<Boolean>
Deletes the account’s playlists matching all the given attributes.
123 |
# File 'lib/yt/models/account.rb', line 123 delegate :delete_playlists, to: :channel |
#gender ⇒ String
Returns the account’s gender. Possible values include, but are not limited to, ‘male’, ‘female’, ‘other’.
55 |
# File 'lib/yt/models/account.rb', line 55 delegate :gender, to: :user_info |
#has_verified_email? ⇒ Boolean
Returns whether the email address is verified.
27 28 29 |
# File 'lib/yt/models/account.rb', line 27 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.
62 |
# File 'lib/yt/models/account.rb', line 62 delegate :hd, to: :user_info |
#insert_playlist_item_params ⇒ Object
257 258 259 |
# File 'lib/yt/models/account.rb', line 257 def insert_playlist_item_params {} end |
#locale ⇒ String
Returns the account’s preferred locale.
58 |
# File 'lib/yt/models/account.rb', line 58 delegate :locale, to: :user_info |
#playlist_items_params ⇒ Object
205 206 207 |
# File 'lib/yt/models/account.rb', line 205 def playlist_items_params {} end |
#profile_url ⇒ String
Returns the URL of the account’s (Google +) profile page.
44 45 46 |
# File 'lib/yt/models/account.rb', line 44 def profile_url user_info.link end |
#update_playlist_params ⇒ Object
249 250 251 |
# File 'lib/yt/models/account.rb', line 249 def update_playlist_params {} end |
#update_video_params ⇒ Object
245 246 247 |
# File 'lib/yt/models/account.rb', line 245 def update_video_params {} end |
#upload_thumbnail_params ⇒ Object
253 254 255 |
# File 'lib/yt/models/account.rb', line 253 def upload_thumbnail_params {} end |
#upload_video(path_or_url, params = {}) ⇒ Yt::Models::Video
Uploads a video to the account’s channel.
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/yt/models/account.rb', line 76 def upload_video(path_or_url, params = {}) file = URI.open(path_or_url) 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['status'], auth: self ) end end |