Sha256: 452be760b68aa8072dbd82438f5abef25381a5a16039dee2287e7af51f53e0d5

Contents?: true

Size: 1.19 KB

Versions: 20

Compression:

Stored size: 1.19 KB

Contents

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

            def self.resource_class
              'SessionData'
            end

            def call(params)
              test_session_id = params[:test_session_id]
              test_session = test_sessions_repo.find(test_session_id)

              if test_session.nil?
                Application[:logger].error("Unknown test session #{test_session_id}")
                self.status = 404
                return
              end

              preset_id = params[:preset_id]
              preset = presets_repo.find(preset_id)

              if preset.nil?
                Application[:logger].error("Unknown preset #{preset_id}")
                self.status = 404
                return
              end

              test_sessions_repo.apply_preset(test_session_id, preset_id)
              self.status = 200
            end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
inferno_core-0.3.12 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.11 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.10 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.9 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.8 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.7 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.6 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.5 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.4 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.3 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.2 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.1 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.0 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.3.0.rc1 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.2.0 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.2.0.rc4 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.2.0.rc3 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.2.0.rc2 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.2.0.rc1 lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb
inferno_core-0.1.4.pre lib/inferno/apps/web/controllers/test_sessions/session_data/apply_preset.rb