Class: Yt::CommentThread

Inherits:
Resource show all
Defined in:
lib/yt/comment_thread.rb

Overview

Provides methods to interact with YouTube comment threads.

Instance Attribute Summary collapse

Attributes inherited from Resource

#data

Instance Method Summary collapse

Methods inherited from Resource

#id, #initialize, #inspect, #select, where

Constructor Details

This class inherits a constructor from Yt::Resource

Instance Attribute Details

#channel_idString? (readonly)

Returns:

  • (String)

    the ID of the channel that the comments refer to.

  • (nil)

    if the comment does not refer to a channel.



8
# File 'lib/yt/comment_thread.rb', line 8

has_attribute :channel_id, in: :snippet

#top_level_commentComment (readonly)

Returns the thread’s top-level comment.

Returns:

  • (Comment)

    the thread’s top-level comment.



17
# File 'lib/yt/comment_thread.rb', line 17

has_attribute :top_level_comment, in: :snippet, type: Comment

#video_idString? (readonly)

Returns:

  • (String)

    the ID of the video that the comments refer to.

  • (nil)

    if the comment refers to the channel itself.



13
# File 'lib/yt/comment_thread.rb', line 13

has_attribute :video_id, in: :snippet

Instance Method Details

#commentsYt::Relation<Yt::Comment>

Returns the comments of a thread.

Returns:

  • (Yt::Relation<Yt::Comment>)

    the comments of a thread.



20
21
22
23
24
25
# File 'lib/yt/comment_thread.rb', line 20

def comments
  @comments ||= Relation.new(Comment, parent_id: id,
    initial_items: -> {[top_level_comment]}) do |options|
    get '/youtube/v3/comments', thread_comments_params(options)
  end
end