Class: ProductHunt::Post
- Inherits:
-
Object
- Object
- ProductHunt::Post
- Defined in:
- lib/producthunt.rb
Class Method Summary collapse
-
.get_comments(permalink) ⇒ Object
Get comments for any post.
-
.get_today ⇒ Object
Get today’s products.
Class Method Details
.get_comments(permalink) ⇒ Object
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”=>“www.splashbase.co”
> }, “comments”=>[
>
> “index”=>1, “user”=>{“username”=>“gregoiregilbert”, “name”=>“Grégoire Gilbert”, “timestamp”=>“1d ago”,
> “comment”=>“nnFollowing up the post about @foapapp 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 @johnmurchn“,
> “comment_html”=>“nnFollowing up the post about <a href="twitter.com/foapapp">@foapapp</a>
> <a href="www.producthunt.com/posts/foap" target="_blank">www.producthunt.com/posts/foap</a> few days ago,
> this website organizes public domain, free to use photos from Unsplash.
A good complement to Compfight mentioned by
> <a href="twitter.com/rrhoover">@rrhoover</a>.
This could interest you <a href="twitter.com/johnmurch">@johnmurch</a>n“
> }, … ]}}
> “index”=>1, “user”=>{“username”=>“gregoiregilbert”, “name”=>“Grégoire Gilbert”, “timestamp”=>“1d ago”,
> “comment”=>“nnFollowing up the post about @foapapp 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 @johnmurchn“,
> “comment_html”=>“nnFollowing up the post about <a href="twitter.com/foapapp">@foapapp</a>
> <a href="www.producthunt.com/posts/foap" target="_blank">www.producthunt.com/posts/foap</a> few days ago,
> this website organizes public domain, free to use photos from Unsplash.
A good complement to Compfight mentioned by
> <a href="twitter.com/rrhoover">@rrhoover</a>.
This could interest you <a href="twitter.com/johnmurch">@johnmurch</a>n“
> }, … ]}}
Arguments:
permalink: (String)
49 50 51 52 53 |
# File 'lib/producthunt.rb', line 49 def self.get_comments(permalink) url = "http://hook-api.herokuapp.com#{permalink}" res = RestClient.get url return JSON.parse(res) end |
.get_today ⇒ Object
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”=>“www.wealthfront.com/”
> }, … ]}
19 20 21 22 23 |
# File 'lib/producthunt.rb', line 19 def self.get_today url = "http://hook-api.herokuapp.com/today" res = RestClient.get url return JSON.parse(res) end |