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.
- #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.
136 |
# File 'lib/yt/models/account.rb', line 136 has_one :channel |
#content_owners ⇒ Yt::Collections::ContentOwners (readonly)
Returns the content owners that the account can manage.
125 |
# File 'lib/yt/models/account.rb', line 125 has_many :content_owners |
#email ⇒ String (readonly)
Returns the account’s email address.
19 |
# File 'lib/yt/models/account.rb', line 19 delegate :email, to: :user_info |
#family_name ⇒ String (readonly)
Returns the user’s family (last) name.
36 |
# File 'lib/yt/models/account.rb', line 36 delegate :family_name, to: :user_info |
#given_name ⇒ String (readonly)
Returns the user’s given (first) name.
32 |
# File 'lib/yt/models/account.rb', line 32 delegate :given_name, to: :user_info |
#id ⇒ String (readonly)
Returns the (Google+) account’s ID.
15 |
# File 'lib/yt/models/account.rb', line 15 delegate :id, to: :user_info |
#name ⇒ String (readonly)
Returns the account’s full name.
28 |
# File 'lib/yt/models/account.rb', line 28 delegate :name, to: :user_info |
#owner_name ⇒ String? (readonly)
The name of the content owner managing the account.
130 131 132 |
# File 'lib/yt/models/account.rb', line 130 def owner_name @owner_name end |
#playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the playlists owned by the account.
140 |
# File 'lib/yt/models/account.rb', line 140 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.
146 |
# File 'lib/yt/models/account.rb', line 146 delegate :related_playlists, to: :channel |
#subscribed_channels ⇒ Yt::Collections::SubscribedChannels (readonly)
Returns the channels that the account is subscribed to.
151 |
# File 'lib/yt/models/account.rb', line 151 delegate :subscribed_channels, to: :channel |
#subscribers ⇒ Yt::Collections::Subscribers (readonly)
Returns the channels subscribed to the account’s channel.
160 |
# File 'lib/yt/models/account.rb', line 160 has_many :subscribers |
#video_groups ⇒ Yt::Collections::VideoGroups (readonly)
Returns the video-groups created by the account.
171 |
# File 'lib/yt/models/account.rb', line 171 has_many :video_groups |
#videos ⇒ Yt::Collections::Videos (readonly)
Returns the videos owned by the account.
155 |
# File 'lib/yt/models/account.rb', line 155 has_many :videos |
Instance Method Details
#avatar_url ⇒ String
Returns the URL of the account’s (Google +) profile picture.
44 45 46 |
# File 'lib/yt/models/account.rb', line 44 def avatar_url user_info.picture end |
#create_playlist(params = {}) ⇒ Yt::Models::Playlist
Creates a playlist in the account’s channel.
101 102 103 |
# File 'lib/yt/models/account.rb', line 101 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attributes = {}) ⇒ Array<Boolean>
Deletes the account’s playlists matching all the given attributes.
118 |
# File 'lib/yt/models/account.rb', line 118 delegate :delete_playlists, to: :channel |
#gender ⇒ String
Returns the account’s gender. Possible values include, but are not limited to, ‘male’, ‘female’, ‘other’.
50 |
# File 'lib/yt/models/account.rb', line 50 delegate :gender, to: :user_info |
#has_verified_email? ⇒ Boolean
Returns whether the email address is verified.
22 23 24 |
# File 'lib/yt/models/account.rb', line 22 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.
57 |
# File 'lib/yt/models/account.rb', line 57 delegate :hd, to: :user_info |
#insert_playlist_item_params ⇒ Object
252 253 254 |
# File 'lib/yt/models/account.rb', line 252 def insert_playlist_item_params {} end |
#locale ⇒ String
Returns the account’s preferred locale.
53 |
# File 'lib/yt/models/account.rb', line 53 delegate :locale, to: :user_info |
#playlist_items_params ⇒ Object
200 201 202 |
# File 'lib/yt/models/account.rb', line 200 def playlist_items_params {} end |
#profile_url ⇒ String
Returns the URL of the account’s (Google +) profile page.
39 40 41 |
# File 'lib/yt/models/account.rb', line 39 def profile_url user_info.link end |
#update_playlist_params ⇒ Object
244 245 246 |
# File 'lib/yt/models/account.rb', line 244 def update_playlist_params {} end |
#update_video_params ⇒ Object
240 241 242 |
# File 'lib/yt/models/account.rb', line 240 def update_video_params {} end |
#upload_thumbnail_params ⇒ Object
248 249 250 |
# File 'lib/yt/models/account.rb', line 248 def upload_thumbnail_params {} 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 79 80 81 82 83 |
# File 'lib/yt/models/account.rb', line 71 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 |