Sha256: cb8ef175c34c83674642a6684768a2e02b53f2d23dfce92d83690f13ce14d6a3

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

require 'alephant/broker/models/response'
require 'alephant/broker/models/response/asset_response'

module Alephant
  module Broker
    class ResponseFactory

      def initialize(config)
        @config = config
      end

      def response_from(request)

          case request.type
          when :asset
            AssetResponse.new(request, @config)
          when :status
            response(200)
          when :notfound
            response(404)
          when :error
            response(500)
          end

      end

      def response(status)
        Response.new(status)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alephant-broker-0.0.2 lib/alephant/broker/models/response_factory.rb
alephant-broker-0.0.1 lib/alephant/broker/models/response_factory.rb