Class: ProductHunt::Post

Inherits:
Object
  • Object
show all
Includes:
Entity
Defined in:
lib/product_hunt/post.rb

Instance Method Summary collapse

Methods included from Entity

#[], #initialize

Instance Method Details

#comments(options = {}) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/product_hunt/post.rb', line 21

def comments(options = {})
  if options != @comments_options
    @comments = @client.comments_for_post(self["id"], options)
    @comments_options = options
  end
  @comments
end

#created_atObject



5
6
7
# File 'lib/product_hunt/post.rb', line 5

def created_at
  Time.parse(self["created_at"])
end

#dayObject



9
10
11
# File 'lib/product_hunt/post.rb', line 9

def day
  Time.parse(self["day"]).to_date
end

#votes(options = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/product_hunt/post.rb', line 13

def votes(options = {})
  if options != @votes_options
    @votes = @client.votes_for_post(self["id"], options)
    @votes_options = options
  end
  @votes
end