Module: ProductHunt::API::Posts
- Included in:
- ProductHunt::API
- Defined in:
- lib/product_hunt/api/posts.rb
Constant Summary collapse
- PATH =
"/posts"
Instance Method Summary collapse
- #all_posts(options = {}) ⇒ Object
- #comments_for_post(id, options = {}) ⇒ Object
- #post(id, options = {}) ⇒ Object
- #posts(options = {}) ⇒ Object
- #votes_for_post(id, options = {}) ⇒ Object
Instance Method Details
#all_posts(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/product_hunt/api/posts.rb', line 13 def all_posts( = {}) process(PATH + "/all", ) do |response| response["posts"].map{ |post| Post.new(post, self) } end end |
#comments_for_post(id, options = {}) ⇒ Object
25 26 27 28 29 |
# File 'lib/product_hunt/api/posts.rb', line 25 def comments_for_post(id, = {}) process(PATH + "/#{id}/comments", ) do |response| response["comments"].map{ |c| Comment.new(c, self) } end end |
#post(id, options = {}) ⇒ Object
19 20 21 22 23 |
# File 'lib/product_hunt/api/posts.rb', line 19 def post(id, = {}) process(PATH + "/#{id}", ) do |response| Post.new(response["post"], self) end end |