Class: StackExchange::StackOverflow::Badge
- Inherits:
-
Base
- Object
- Base
- StackExchange::StackOverflow::Badge
show all
- Defined in:
- lib/pilha/stack_overflow/badge.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#api_methods, client, #initialize, parse_with_class, request, setup_delegators
Class Method Details
.all(options = {}) ⇒ Object
10
11
12
13
|
# File 'lib/pilha/stack_overflow/badge.rb', line 10
def all(options = {})
method = select_method(options)
request(method, nil, options)
end
|
.parse(response) ⇒ Object
20
21
22
23
|
# File 'lib/pilha/stack_overflow/badge.rb', line 20
def parse(response)
parse_with_class(response, 'badges', Badge)
OpenStruct.new response
end
|
.select_method(options) ⇒ Object
15
16
17
18
|
# File 'lib/pilha/stack_overflow/badge.rb', line 15
def select_method(options)
tag_based = options[:tag_based] || options['tag_based']
tag_based ? '/badges/tags' : '/badges'
end
|
Instance Method Details
#id ⇒ Object
26
27
28
|
# File 'lib/pilha/stack_overflow/badge.rb', line 26
def id
@struct.badge_id
end
|