Sha256: 9d7439af986509ff09a98341e82008181b485e79dbb4cd11379c602b9248929f

Contents?: true

Size: 677 Bytes

Versions: 27

Compression:

Stored size: 677 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 '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

27 entries across 27 versions & 1 rubygems

Version Path
alephant-broker-3.3.1 lib/alephant/broker/request/factory.rb
alephant-broker-3.3.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.2.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.1.1 lib/alephant/broker/request/factory.rb
alephant-broker-3.1.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.0.1 lib/alephant/broker/request/factory.rb
alephant-broker-3.0.0 lib/alephant/broker/request/factory.rb