Sha256: 8499169daf4d2cf398079fda35529966e11462087628bf9a78c258de0b10cd3b

Contents?: true

Size: 515 Bytes

Versions: 1

Compression:

Stored size: 515 Bytes

Contents

module Apitizer
  module Connection
    class Dispatcher
      def initialize(format:, adaptor: :standard, headers: {})
        @format = Format.build(format)
        @adaptor = Adaptor.build(adaptor)
        @headers = headers.merge('Accept' => @format.mime_type)
      end

      def process(request)
        code, _, body = @adaptor.process(request.method, request.address,
          request.parameters, @headers)
        Response.new(code: code, content: @format.process(body.join))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apitizer-0.0.2 lib/apitizer/connection/dispatcher.rb