Sha256: f1207df67045a482e879e42708d4c7be451e70aa8573085d2a0e9ddeba9cb3bd

Contents?: true

Size: 1.17 KB

Versions: 36

Compression:

Stored size: 1.17 KB

Contents

require_relative '../../controller'

module Inferno
  module Web
    module Controllers
      module TestSessions
        module SessionData
          class ApplyPreset < Controller
            include Import[
                      test_sessions_repo: 'inferno.repositories.test_sessions',
                      presets_repo: 'inferno.repositories.presets'
                    ]

            def self.resource_class
              'SessionData'
            end

            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
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
inferno_core-0.5.0 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.44 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.43 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.42 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.41 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.40 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.39 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.38 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.35 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.34 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.33 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.32 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.31 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.30 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.29 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.28 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.27 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.26 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.25 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.4.24 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb