Class: Apical::HttpAdapter
- Inherits:
-
Adapter
show all
- Includes:
- HTTParty
- Defined in:
- lib/apical/adapters/http_adapter.rb
Instance Method Summary
collapse
Methods inherited from Adapter
[], identifier
Constructor Details
#initialize(options = {}) ⇒ HttpAdapter
Returns a new instance of HttpAdapter.
9
10
11
12
|
# File 'lib/apical/adapters/http_adapter.rb', line 9
def initialize(options={})
self.class.base_uri options[:base_uri]
@headers = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/apical/adapters/http_adapter.rb', line 22
def method_missing(name, *args)
self.class.(@headers) unless @headers.empty?
response = self.class.send(name, *args)
return response
end
|
Instance Method Details
18
19
20
|
# File 'lib/apical/adapters/http_adapter.rb', line 18
def
@headers = {}
end
|
14
15
16
|
# File 'lib/apical/adapters/http_adapter.rb', line 14
def (name, value)
@headers[name] = value
end
|