Class: Apis::Adapter::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/apis/adapter/abstract.rb

Direct Known Subclasses

NetHTTP, RackTest

Defined Under Namespace

Classes: NotImplemented

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Abstract

Returns a new instance of Abstract.



8
9
10
11
12
# File 'lib/apis/adapter/abstract.rb', line 8

def initialize(options = {})
  options.each do |key, value|
    send("#{key}=", value) if respond_to?("#{key}=")
  end
end

Instance Attribute Details

#uriObject

Returns the value of attribute uri.



6
7
8
# File 'lib/apis/adapter/abstract.rb', line 6

def uri
  @uri
end

Instance Method Details

#run(method, path, params = {}, headers = {}) ⇒ Array

Performs request to resource

Parameters:

  • method (Symbol, String)

    HTTP method to perform

  • path (String)

    Relative path to resource host

  • params (Hash) (defaults to: {})

    Params to be sent

  • headers (Hash) (defaults to: {})

    Headers to be sent

Returns:

  • (Array)

    headers, body

Raises:



22
23
24
# File 'lib/apis/adapter/abstract.rb', line 22

def run(method, path, params = {}, headers = {})
  raise Apis::Adapter::Abstract::NotImplemented
end