class Yt::Models::Snippet
@private Provides methods to interact with the snippet of YouTube resources. @see developers.google.com/youtube/v3/docs/channels#resource @see developers.google.com/youtube/v3/docs/videos#resource @see developers.google.com/youtube/v3/docs/playlists#resource @see developers.google.com/youtube/v3/docs/playlistItems#resource @see developers.google.com/youtube/v3/docs/commentThreads#resource @see developers.google.com/youtube/v3/docs/comments#resource
Attributes
Public Class Methods
Source
# File lib/yt/models/snippet.rb, line 16 def initialize(options = {}) @data = options[:data] @auth = options[:auth] end
Public Instance Methods
Source
# File lib/yt/models/snippet.rb, line 54 def can_reply? @can_reply ||= data.fetch 'canReply', false end
Source
# File lib/yt/models/snippet.rb, line 71 def complete? @complete ||= data.fetch :complete, true end
Returns whether YouTube API includes all attributes in this snippet. For instance, YouTube API only returns tags and categoryId on Videos#list, not on Videos#search. And returns position on PlaylistItems#list, not on PlaylistItems#insert. This method is used to guarantee that, when a video was instantiated by one of the methods above, an additional call to is made to retrieve the full snippet in case an attribute is missing. @see developers.google.com/youtube/v3/docs/videos @return [Boolean] whether YouTube API includes the complete snippet.
Source
# File lib/yt/models/snippet.rb, line 50 def public? @public ||= data.fetch 'isPublic', false end
Source
# File lib/yt/models/snippet.rb, line 46 def thumbnail_url(size = :default) thumbnails.fetch(size.to_s, {})['url'] end
Source
# File lib/yt/models/snippet.rb, line 58 def top_level_comment @top_level_comment ||= Yt::Comment.new data['topLevelComment'].symbolize_keys end