Sha256: 7ad7c1f51336a5eaf8b8be293499d48a066d6fb5ccdfbf9ccbe39d1c0dec219c

Contents?: true

Size: 458 Bytes

Versions: 6

Compression:

Stored size: 458 Bytes

Contents

require 'alephant/broker/request'

module Alephant::Broker::Request
  class Factory

    def self.request_type_from(env)
      env.path.split('/')[1]
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alephant-broker-1.2.1 lib/alephant/broker/request/factory.rb
alephant-broker-1.2.0 lib/alephant/broker/request/factory.rb
alephant-broker-1.1.3 lib/alephant/broker/request/factory.rb
alephant-broker-1.1.2 lib/alephant/broker/request/factory.rb
alephant-broker-1.1.1 lib/alephant/broker/request/factory.rb
alephant-broker-1.1.0 lib/alephant/broker/request/factory.rb