Class: Rester::Client::Adapters::LocalAdapter
- Inherits:
-
Adapter
- Object
- Adapter
- Rester::Client::Adapters::LocalAdapter
show all
- Defined in:
- lib/rester/client/adapters/local_adapter.rb
Overview
An adapter for “connecting” to a service internally, without needing to interface over a HTTP connection.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Adapter
#headers, #initialize, #request
Instance Attribute Details
#service ⇒ Object
Returns the value of attribute service.
10
11
12
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 10
def service
@service
end
|
Class Method Details
.can_connect_to?(service) ⇒ Boolean
13
14
15
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 13
def can_connect_to?(service)
service.is_a?(Class) && service < Service
end
|
Instance Method Details
#connect(service, opts = {}) ⇒ Object
18
19
20
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 18
def connect(service, opts={})
nil.tap { @service = service }
end
|
#connected? ⇒ Boolean
22
23
24
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 22
def connected?
!!service
end
|
#delete!(path, params = {}) ⇒ Object
30
31
32
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 30
def delete!(path, params={})
_request(:delete, path, headers: , query: params)
end
|
#get!(path, params = {}) ⇒ Object
26
27
28
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 26
def get!(path, params={})
_request(:get, path, headers: , query: params)
end
|
#post!(path, params = {}) ⇒ Object
38
39
40
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 38
def post!(path, params={})
_request(:post, path, headers: , data: params)
end
|
#put!(path, params = {}) ⇒ Object
34
35
36
|
# File 'lib/rester/client/adapters/local_adapter.rb', line 34
def put!(path, params={})
_request(:put, path, headers: , data: params)
end
|