Class: Wes::Data::API::Brief
- Inherits:
-
Object
- Object
- Wes::Data::API::Brief
show all
- Extended by:
- Base
- Defined in:
- lib/wes/data/api/brief.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/brief.rb', line 12
def all(state = nil)
route = add_state(routes.briefs, state)
map_objects(
client.get(route), model_klass
)
end
|
.create(data) ⇒ Object
19
20
21
22
|
# File 'lib/wes/data/api/brief.rb', line 19
def create(data)
attributes = client.post(routes.brief, data).first
attributes.nil? ? nil : model_klass.new(attributes)
end
|
.find(key, value) ⇒ Object
24
25
26
27
|
# File 'lib/wes/data/api/brief.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/brief.rb', line 29
def questions
route = [routes.brief, routes.questions].join('/')
map_objects(
client.get(route), Wes::Data::API::Model::BriefQuestion
)
end
|