class Socialinvestigator::CLI::Hn
Public Instance Methods
search( url )
click to toggle source
# File lib/socialinvestigator/cli/hn.rb, line 8 def search( url ) result = client.search_by_date( url, options[:tag] ).parsed_response puts "#{result['nbHits']} Hits" result['hits'].each do |hit| puts "#{hit['title']}#{hit['story_title']}" puts " #{hit['url']}" if hit['url'] != "" puts " #{hit['points']} points" puts " #{hit['num_comments']} comments" if hit['num_comments'] puts " https://news.ycombinator.com/item?id=#{hit['objectID']}" puts end end
Private Instance Methods
client()
click to toggle source
# File lib/socialinvestigator/cli/hn.rb, line 24 def client @client ||= Socialinvestigator::Client::Hn.new end