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
# File lib/yt/models/snippet.rb, line 16 def initialize(options = {}) @data = options[:data] @auth = options[:auth] end
Public Instance Methods
# File lib/yt/models/snippet.rb, line 49 def can_reply? @can_reply ||= data.fetch 'canReply', false 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.
# File lib/yt/models/snippet.rb, line 66 def complete? @complete ||= data.fetch :complete, true end
# File lib/yt/models/snippet.rb, line 45 def public? @public ||= data.fetch 'isPublic', false end
# File lib/yt/models/snippet.rb, line 41 def thumbnail_url(size = :default) thumbnails.fetch(size.to_s, {})['url'] end
# File lib/yt/models/snippet.rb, line 53 def top_level_comment @top_level_comment ||= Yt::Comment.new data['topLevelComment'].symbolize_keys end