class HTTPI::Adapter::Base

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.

Public Class Methods

new(request) click to toggle source
# File lib/httpi/adapter/base.rb, line 18
def initialize(request)
end
register(name, options = {}) click to toggle source

Registers an adapter.

# File lib/httpi/adapter/base.rb, line 13
def self.register(name, options = {})
  deps = options.fetch(:deps, [])
  Adapter.register(name, self, deps)
end

Public Instance Methods

client() click to toggle source

Returns a client instance.

# File lib/httpi/adapter/base.rb, line 22
def client
  raise NotImplementedError, "Adapters need to implement a #client method"
end
request(method) click to toggle source

Executes arbitrary HTTP requests. @see HTTPI.request

# File lib/httpi/adapter/base.rb, line 28
def request(method)
  raise NotImplementedError, "Adapters need to implement a #request method"
end