Sha256: 4f4af97f2468edf17c97140ee19c32f86761079d70a65ae069462e6a587f948d

Contents?: true

Size: 677 Bytes

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
alephant-broker-3.13.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.12.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.11.0 lib/alephant/broker/request/factory.rb