class ProductHunt::Post
Public Class Methods
get_comments(permalink)
click to toggle source
Get comments for any post
Example:
>> puts ProductHunt::Post.get_comments("/posts/splashbase") => { "status"=>"success", "post"=>{ "title"=>"Splashbase", "votes"=>28, "user"=>{"username"=>"gregoiregilbert", "name"=>"Grégoire Gilbert"}, "rank"=>1, "tagline"=>"Search & discover free, public domain, hi res photos", "comment_count"=>"2", "permalink"=>"/posts/splashbase", "url"=>"http://www.splashbase.co" }, "comments"=>[{ "index"=>1, "user"=>{"username"=>"gregoiregilbert", "name"=>"Grégoire Gilbert"}, "timestamp"=>"1d ago", "comment"=>"\n\nFollowing up the post about @foapapp http://www.producthunt.com/posts/foap few days ago, this website organizes public domain, free to use photos from Unsplash.A good complement to Compfight mentioned by @rrhoover. This could interest you @johnmurch\n", "comment_html"=>"\n\nFollowing up the post about <a href=\"https://twitter.com/foapapp\">@foapapp</a> <a href=\"http://www.producthunt.com/posts/foap\" target=\"_blank\">http://www.producthunt.com/posts/foap</a> few days ago, this website organizes public domain, free to use photos from Unsplash.<br><br>A good complement to Compfight mentioned by <a href=\"https://twitter.com/rrhoover\">@rrhoover</a>. <br><br>This could interest you <a href=\"https://twitter.com/johnmurch\">@johnmurch</a>\n" }, ... ]}}
Arguments:
permalink: (String)
# File lib/producthunt.rb, line 26 def self.get_comments(permalink) url = "http://hook-api.herokuapp.com#{permalink}" res = RestClient.get url return JSON.parse(res) end
get_today()
click to toggle source
Get today’s products
Example:
>> puts ProductHunt::Post.get_today => { "status"=>"success", "hunts"=>[{ "title"=>"Wealthfront", "votes"=>10, "user"=>{"username"=>"hunterwalk", "name"=>"Hunter Walk"}, "rank"=>2, "tagline"=>"Automated, low cost investment service", "comment_count"=>"3", "permalink"=>"/posts/wealthfront", "url"=>"https://www.wealthfront.com/"}, ... ]}
# File lib/producthunt.rb, line 12 def self.get_today url = "http://hook-api.herokuapp.com/today" res = RestClient.get url return JSON.parse(res) end