Sha256: 2102453c59fde3da687e8a7b467e16be810bfeac173be98b7172d675e4b1f7aa

Contents?: true

Size: 555 Bytes

Versions: 1

Compression:

Stored size: 555 Bytes

Contents

module Apitizer
  module Connection
    class Dispatcher
      def initialize(options)
        @format = Format.build(options.fetch(:format))
        @adaptor = Adaptor.build(options[:adaptor] || :standard)
        @headers = options[: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.3 lib/apitizer/connection/dispatcher.rb