Class: Inferno::Web::Controllers::TestSessions::SessionData::ApplyPreset
- Inherits:
-
Controller
- Object
- Hanami::Action
- Controller
- Inferno::Web::Controllers::TestSessions::SessionData::ApplyPreset
show all
- Defined in:
- lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Controller
call, inherited, resource_name
Class Method Details
.resource_class ⇒ Object
14
15
16
|
# File 'lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb', line 14
def self.resource_class
'SessionData'
end
|
Instance Method Details
#handle(req, res) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb', line 18
def handle(req, res)
test_session_id = req.params[:id]
test_session = test_sessions_repo.find(test_session_id)
if test_session.nil?
Application[:logger].error("Unknown test session #{test_session_id}")
halt 404
end
preset_id = req.params[:preset_id]
preset = presets_repo.find(preset_id)
if preset.nil?
Application[:logger].error("Unknown preset #{preset_id}")
halt 404
end
test_sessions_repo.apply_preset(test_session, preset_id)
res.status = 200
end
|