Sha256: 29a94d9358d79251e4d8e5b828990cc035fa4120bf788282ed253f7de5392d49

Contents?: true

Size: 841 Bytes

Versions: 13

Compression:

Stored size: 841 Bytes

Contents

require "httpi"
require "httpi/adapter"

module HTTPI
  module Adapter

    # HTTPI::Adapter::Base
    #
    # Allows you to build your own adapter by implementing all public instance methods.
    # Register your adapter by calling the base class' .register method.
    class Base

      # Registers an adapter.
      def self.register(name, options = {})
        deps = options.fetch(:deps, [])
        Adapter.register(name, self, deps)
      end

      def initialize(request)
      end

      # Returns a client instance.
      def client
        raise NotImplementedError, "Adapters need to implement a #client method"
      end

      # Executes arbitrary HTTP requests.
      # @see HTTPI.request
      def request(method)
        raise NotImplementedError, "Adapters need to implement a #request method"
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
httpi-2.1.1 lib/httpi/adapter/base.rb
httpi-2.2.7 lib/httpi/adapter/base.rb
httpi-2.2.6 lib/httpi/adapter/base.rb
httpi-2.2.5 lib/httpi/adapter/base.rb
httpi-2.2.4 lib/httpi/adapter/base.rb
httpi-2.2.3 lib/httpi/adapter/base.rb
httpi-2.2.1 lib/httpi/adapter/base.rb
httpi-2.2.0 lib/httpi/adapter/base.rb
httpi-2.1.0 lib/httpi/adapter/base.rb
httpi-2.0.2 lib/httpi/adapter/base.rb
httpi-2.0.1 lib/httpi/adapter/base.rb
httpi-2.0.0 lib/httpi/adapter/base.rb
httpi-2.0.0.rc1 lib/httpi/adapter/base.rb