Class: RandomYoutubeComment::YoutubeClient

Inherits:
Object
  • Object
show all
Defined in:
lib/random_youtube_comment/youtube_client.rb

Class Method Summary collapse

Class Method Details

.random_comment_for_video(video_id) ⇒ Object



8
9
10
# File 'lib/random_youtube_comment/youtube_client.rb', line 8

def random_comment_for_video(video_id)
  client.comments(video_id).sample
end

.random_videoObject



12
13
14
15
16
17
# File 'lib/random_youtube_comment/youtube_client.rb', line 12

def random_video
  begin
    video = search_for_videos.sample
  end while video.nil? || video.comment_count < 2
  video
end