Sha256: de2c290b35df5720879b306713aebc94149abfcfbfbd936ee885c2f6eb8c885e

Contents?: true

Size: 677 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
alephant-broker-3.15.0 lib/alephant/broker/request/factory.rb
alephant-broker-3.14.0 lib/alephant/broker/request/factory.rb