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.
137 |
# File 'lib/yt/models/account.rb', line 137 has_one :channel |
#content_owners ⇒ Yt::Collections::ContentOwners (readonly)
Returns the content owners that the account can manage.
126 |
# File 'lib/yt/models/account.rb', line 126 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.
131 132 133 |
# File 'lib/yt/models/account.rb', line 131 def owner_name @owner_name end |
#playlists ⇒ Yt::Collections::Playlists (readonly)
Returns the playlists owned by the account.
141 |
# File 'lib/yt/models/account.rb', line 141 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.
147 |
# File 'lib/yt/models/account.rb', line 147 delegate :related_playlists, to: :channel |
#subscribed_channels ⇒ Yt::Collections::SubscribedChannels (readonly)
Returns the channels that the account is subscribed to.
152 |
# File 'lib/yt/models/account.rb', line 152 delegate :subscribed_channels, to: :channel |
#subscribers ⇒ Yt::Collections::Subscribers (readonly)
Returns the channels subscribed to the account’s channel.
161 |
# File 'lib/yt/models/account.rb', line 161 has_many :subscribers |
#video_groups ⇒ Yt::Collections::VideoGroups (readonly)
Returns the video-groups created by the account.
172 |
# File 'lib/yt/models/account.rb', line 172 has_many :video_groups |
#videos ⇒ Yt::Collections::Videos (readonly)
Returns the videos owned by the account.
156 |
# File 'lib/yt/models/account.rb', line 156 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.
102 103 104 |
# File 'lib/yt/models/account.rb', line 102 def create_playlist(params = {}) playlists.insert params end |
#delete_playlists(attributes = {}) ⇒ Array<Boolean>
Deletes the account’s playlists matching all the given attributes.
119 |
# File 'lib/yt/models/account.rb', line 119 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 |
#insert_playlist_item_params ⇒ Object
253 254 255 |
# File 'lib/yt/models/account.rb', line 253 def insert_playlist_item_params {} end |
#locale ⇒ String
Returns the account’s preferred locale.
54 |
# File 'lib/yt/models/account.rb', line 54 delegate :locale, to: :user_info |
#playlist_items_params ⇒ Object
201 202 203 |
# File 'lib/yt/models/account.rb', line 201 def playlist_items_params {} end |
#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 |
#update_playlist_params ⇒ Object
245 246 247 |
# File 'lib/yt/models/account.rb', line 245 def update_playlist_params {} end |
#update_video_params ⇒ Object
241 242 243 |
# File 'lib/yt/models/account.rb', line 241 def update_video_params {} end |
#upload_thumbnail_params ⇒ Object
249 250 251 |
# File 'lib/yt/models/account.rb', line 249 def upload_thumbnail_params {} end |
#upload_video(path_or_url, params = {}) ⇒ Yt::Models::Video
Uploads a video to the account’s channel.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/yt/models/account.rb', line 72 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['status'], auth: self ) end end |