Module: HTTPI::Adapter
- Defined in:
- lib/httpi/adapter.rb,
lib/httpi/adapter/curb.rb,
lib/httpi/adapter/net_http.rb,
lib/httpi/adapter/httpclient.rb
Overview
HTTPI::Adapter
Manages the adapter classes. Currently supports:
Defined Under Namespace
Classes: Curb, HTTPClient, NetHTTP
Constant Summary
collapse
- ADAPTERS =
{
:httpclient => HTTPClient,
:curb => Curb,
:net_http => NetHTTP
}
- DEPENDENCIES =
[
[:httpclient, ["httpclient"]],
[:curb, ["curb"]],
[:net_http, ["net/https", "net/ntlm_http"]]
]
Class Method Summary
collapse
Class Method Details
.load(adapter = nil) ⇒ Object
38
39
40
41
|
# File 'lib/httpi/adapter.rb', line 38
def load(adapter = nil)
adapter = adapter ? validate_adapter!(adapter) : use
[adapter, ADAPTERS[adapter]]
end
|
.use ⇒ Object
34
35
36
|
# File 'lib/httpi/adapter.rb', line 34
def use
@adapter ||= default_adapter
end
|
.use=(adapter) ⇒ Object
30
31
32
|
# File 'lib/httpi/adapter.rb', line 30
def use=(adapter)
@adapter = adapter.nil? ? nil : validate_adapter!(adapter)
end
|