Class: Inferno::Web::Controllers::TestSuites::Requirements::Index

Inherits:
Controller
  • Object
show all
Defined in:
lib/inferno/apps/web/controllers/test_suites/requirements/index.rb

Instance Method Summary collapse

Methods inherited from Controller

call, resource_class, resource_name

Instance Method Details

#handle(req, res) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/inferno/apps/web/controllers/test_suites/requirements/index.rb', line 10

def handle(req, res)
  test_suite = test_suites_repo.find(req.params[:id])
  halt 404, "Test Suite `#{req.params[:id]}` not found" if test_suite.nil?

  test_session = nil
  if req.params[:session_id]
    test_session = test_sessions_repo.find(req.params[:session_id])
    halt 404, "Test session `#{req.params[:session_id]}` not found" if test_session.nil?
  end

  requirements = repo.requirements_for_suite(test_suite.id, test_session&.id)

  res.body = serialize(requirements)
end