Sha256: b9a0d10ae6e82d034038865d43ff17a78f887c0ad2e1b0f07c1761323ff27a94

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

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

module Alephant
  module Broker
    class ResponseFactory

      def initialize(config = nil)
        @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

1 entries across 1 versions & 1 rubygems

Version Path
alephant-broker-0.0.3 lib/alephant/broker/models/response_factory.rb