Sha256: 42357122e1e3fe61d76fd72f3e94e47b9f002defbedacfa178e5480adfb7d087

Contents?: true

Size: 605 Bytes

Versions: 24

Compression:

Stored size: 605 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::Status
            Status.new
          else
            NotFound.new
          end
        end

        def self.error
          ServerError.new
        end

        def self.not_found
          NotFound.new
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
alephant-broker-3.1.1 lib/alephant/broker/response/factory.rb
alephant-broker-3.1.0 lib/alephant/broker/response/factory.rb
alephant-broker-3.0.1 lib/alephant/broker/response/factory.rb
alephant-broker-3.0.0 lib/alephant/broker/response/factory.rb