Sha256: bacb7f47c5241c02e7e2045f5218c55f243627de43f89dfbcadd911f3bbfac42

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

require "alephant/logger"
require "alephant/broker/request"
require "alephant/broker/component_factory"

module Alephant
  module Broker
    module Request
      class Factory
        extend Logger

        def self.request_type_from(env)
          env.path.split("/")[1]
        end

        def self.request_for(load_strategy, env)
          component_factory = ComponentFactory.new load_strategy

          logger.metric('RequestCount')

          case request_type_from(env)
          when "component"
            logger.metric('ActionableRequestCount')
            Asset.new(component_factory, env)
          when "components"
            logger.metric('ActionableRequestCount')
            Batch.new(component_factory, env)
          when "status"
            logger.metric('StatusRequest')
            Status.new
          else
            logger.metric('NotFoundRequest')
            NotFound.new
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alephant-broker-3.15.1 lib/alephant/broker/request/factory.rb