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:
-
httpclient
-
curb
-
net/http
Defined Under Namespace
Classes: Curb, HTTPClient, NetHTTP
Constant Summary collapse
- ADAPTERS =
{ :httpclient => { :class => HTTPClient, :dependencies => ["httpclient"] }, :curb => { :class => Curb, :dependencies => ["curb"] }, :net_http => { :class => NetHTTP, :dependencies => ["net/https", "net/ntlm_http"] } }
- LOAD_ORDER =
[:httpclient, :curb, :net_http]
Class Method Summary collapse
Class Method Details
.load(adapter) ⇒ Object
38 39 40 41 |
# File 'lib/httpi/adapter.rb', line 38 def load(adapter) adapter = adapter ? validate_adapter!(adapter) : use [adapter, ADAPTERS[adapter][:class]] end |
.use ⇒ Object
34 35 36 |
# File 'lib/httpi/adapter.rb', line 34 def use @adapter ||= default_adapter end |
.use=(adapter) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/httpi/adapter.rb', line 26 def use=(adapter) return @adapter = nil if adapter.nil? validate_adapter! adapter load_dependencies adapter @adapter = adapter end |