class YoutubeVideo::Comment

signle comment on video's comment threads

Attributes

author[R]
comment_id[R]
like_count[R]
published_at[R]
text_display[R]
time_tags[R]
updated_at[R]

Public Class Methods

find(comment_id:) click to toggle source
# File lib/YPBT/comment.rb, line 16
def self.find(comment_id:)
  comment_data = YoutubeVideo::YtApi.comment_info(comment_id)
  new(data: comment_data)
end
new(data: nil) click to toggle source
# File lib/YPBT/comment.rb, line 12
def initialize(data: nil)
  load_data(data)
end

Private Instance Methods

load_data(comment_data) click to toggle source
# File lib/YPBT/comment.rb, line 23
def load_data(comment_data)
  @comment_id = comment_data['id']
  @like_count = comment_data['likeCount'].to_i
  @updated_at = comment_data['updateAt']
  @text_display = comment_data['textDisplay']
  @published_at = comment_data['publishedAt']
  @author = YoutubeVideo::Author.new(comment_data)
  @time_tags = YoutubeVideo::Timetag.find(comment: self)
end