Class: Restfully::HTTP::Adapters::AbstractAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/restfully/http/adapters/abstract_adapter.rb

Direct Known Subclasses

PatronAdapter, RestClientAdapter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_uri, options = {}) ⇒ AbstractAdapter

Returns a new instance of AbstractAdapter.



7
8
9
10
11
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 7

def initialize(base_uri, options = {})
  @options = options.symbolize_keys
  @logger = @options.delete(:logger) || Restfully::NullLogger.new
  @base_uri = base_uri
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



6
7
8
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 6

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 6

def options
  @options
end

Instance Method Details

#delete(request) ⇒ Object

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 22

def delete(request)
  raise NotImplementedError, "DELETE is not supported by your adapter."
end

#get(request) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 13

def get(request)
  raise NotImplementedError, "GET is not supported by your adapter."
end

#post(request) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 16

def post(request)
  raise NotImplementedError, "POST is not supported by your adapter."
end

#put(request) ⇒ Object

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/restfully/http/adapters/abstract_adapter.rb', line 19

def put(request)
  raise NotImplementedError, "PUT is not supported by your adapter."
end