Class: Wes::Data::API::Challenge
- Inherits:
-
Object
- Object
- Wes::Data::API::Challenge
show all
- Extended by:
- Base
- Defined in:
- lib/wes/data/api/challenge.rb
Class Method Summary
collapse
Methods included from Base
add_state, client, configuration, map_objects, routes
Class Method Details
.all(state = nil) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/wes/data/api/challenge.rb', line 12
def all(state = nil)
route = add_state(routes.challenges, state)
map_objects(
client.get(route), model_klass
)
end
|
.create(data) ⇒ Object
19
20
21
22
|
# File 'lib/wes/data/api/challenge.rb', line 19
def create(data)
attributes = client.post(routes.challenge, data).first
attributes.nil? ? nil : model_klass.new(attributes)
end
|
.find(key, value) ⇒ Object
24
25
26
27
|
# File 'lib/wes/data/api/challenge.rb', line 24
def find(key, value)
attributes = client.get(find_route(key, value)).first
attributes.nil? ? nil : model_klass.new(attributes)
end
|
.questions ⇒ Object
29
30
31
32
33
34
|
# File 'lib/wes/data/api/challenge.rb', line 29
def questions
route = [routes.challenge, routes.questions].join("/")
map_objects(
client.get(route), Wes::Data::API::Model::ChallengeQuestion
)
end
|