Sha256: 0077042a6d6f5c933fe1200a067f2db3d35df64a4dde3eaf035800532b8cf681

Contents?: true

Size: 983 Bytes

Versions: 8

Compression:

Stored size: 983 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.increment('request_count')

          case request_type_from(env)
          when "component"
            logger.increment('actionable_request_count')
            Asset.new(component_factory, env)
          when "components"
            logger.increment('actionable_request_count')
            Batch.new(component_factory, env)
          when "status"
            logger.increment('status_request')
            Status.new
          else
            logger.increment('not_found_request')
            NotFound.new
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alephant-broker-3.19.1 lib/alephant/broker/request/factory.rb
alephant-broker-3.19.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.18.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.17.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.16.2 lib/alephant/broker/request/factory.rb
alephant-broker-3.16.1 lib/alephant/broker/request/factory.rb
alephant-broker-3.16.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.15.2 lib/alephant/broker/request/factory.rb