Module: ProductHunt::API::Users

Included in:
ProductHunt::API
Defined in:
lib/product_hunt/api/users.rb

Constant Summary collapse

USERS_PATH =
"/users"
CURRENT_USER_PATH =
"/me"

Instance Method Summary collapse

Instance Method Details

#current_user(options = {}) ⇒ Object



20
21
22
23
24
# File 'lib/product_hunt/api/users.rb', line 20

def current_user(options = {})
  process(CURRENT_USER_PATH, options) do |response|
    User.new(response["user"], self)
  end
end

#user(id, options = {}) ⇒ Object



14
15
16
17
18
# File 'lib/product_hunt/api/users.rb', line 14

def user(id, options = {})
  process(USERS_PATH + "/#{id}", options) do |response|
    User.new(response["user"], self)
  end
end

#users(options = {}) ⇒ Object



8
9
10
11
12
# File 'lib/product_hunt/api/users.rb', line 8

def users(options = {})
  process(USERS_PATH, options) do |response|
    response["users"].map{ |user| User.new(user, self) }
  end
end