Class: StackExchange::StackOverflow::User

Inherits:
Base
  • Object
show all
Defined in:
lib/pilha/stack_overflow/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#api_methods, client, #initialize, parse_with_class, request, setup_delegators

Constructor Details

This class inherits a constructor from StackExchange::StackOverflow::Base

Class Method Details

.all(options = {}) ⇒ Object



15
16
17
# File 'lib/pilha/stack_overflow/user.rb', line 15

def all(options = {})
  request('/users', nil, options)
end

.find(id, options = {}) ⇒ Object



23
24
25
# File 'lib/pilha/stack_overflow/user.rb', line 23

def find(id, options = {})
  request('/users/:id', id, options).users.first
end

.find_by_badge_id(id, options = {}) ⇒ Object



19
20
21
# File 'lib/pilha/stack_overflow/user.rb', line 19

def find_by_badge_id(id, options = {})
  request('/badges/:id', id, options)
end

.parse(response) ⇒ Object



27
28
29
30
# File 'lib/pilha/stack_overflow/user.rb', line 27

def parse(response)
  parse_with_class(response, 'users', User)
  OpenStruct.new response
end

Instance Method Details

#idObject



33
34
35
# File 'lib/pilha/stack_overflow/user.rb', line 33

def id
  @struct.user_id
end