Sha256: 37ce157daf1c0e52cc973b9c9f0c497ce3d2fc2f93810b34925727a765b2dbaa

Contents?: true

Size: 612 Bytes

Versions: 6

Compression:

Stored size: 612 Bytes

Contents

require 'alephant/broker/response'

module Alephant
  module Broker
    module Response
      class Factory
        def self.response_for(request)
          case request
          when Request::Asset
            Asset.new(request.component)
          when Request::Batch
            Batch.new(request.components, request.batch_id)
          when Request::Multi
            Multi.new(request.requests)
          when Request::Status
            Status.new
          else
            NotFound.new
          end
        end

        def self.error
          ServerError.new
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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