Sha256: 32b57ac4d9a502f9edd6de8a83e472c486854b98377dbc6e69570069f6ee154c

Contents?: true

Size: 727 Bytes

Versions: 9

Compression:

Stored size: 727 Bytes

Contents

require 'alephant/broker/request'
require 'alephant/broker/component_factory'

module Alephant
  module Broker
    module Request
      class Factory
        def self.request_type_from(env)
          env.path.split('/')[1]
        end

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

          case request_type_from(env)
          when 'multi'
            Multi.new(env)
          when 'component'
            Asset.new(component_factory, env)
          when 'components'
            Batch.new(component_factory, env)
          when 'status'
            Status.new
          else
            NotFound.new
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alephant-broker-2.1.3 lib/alephant/broker/request/factory.rb
alephant-broker-2.1.2 lib/alephant/broker/request/factory.rb
alephant-broker-2.1.1 lib/alephant/broker/request/factory.rb
alephant-broker-2.1.0 lib/alephant/broker/request/factory.rb
alephant-broker-2.0.3 lib/alephant/broker/request/factory.rb
alephant-broker-2.0.2 lib/alephant/broker/request/factory.rb
alephant-broker-2.0.1 lib/alephant/broker/request/factory.rb
alephant-broker-2.0.0 lib/alephant/broker/request/factory.rb
alephant-broker-1.3.1 lib/alephant/broker/request/factory.rb