Class: PersistentConnectionAdapter
- Inherits:
-
HTTParty::ConnectionAdapter
- Object
- HTTParty::ConnectionAdapter
- PersistentConnectionAdapter
- Defined in:
- lib/resthome/httparty/persistent_connection_adapter.rb
Defined Under Namespace
Classes: PersistentHTTP
Class Method Summary collapse
Instance Method Summary collapse
-
#connection ⇒ Object
copied from HTTParty::ConnectionAdapter.
Class Method Details
.call(uri, options) ⇒ Object
55 56 57 |
# File 'lib/resthome/httparty/persistent_connection_adapter.rb', line 55 def self.call(uri, ) self.start uri, end |
.close ⇒ Object
44 45 46 47 48 49 |
# File 'lib/resthome/httparty/persistent_connection_adapter.rb', line 44 def self.close if @conn @conn.finish if @conn.started? @conn = nil end end |
.conn ⇒ Object
51 52 53 |
# File 'lib/resthome/httparty/persistent_connection_adapter.rb', line 51 def self.conn @conn end |
.start(uri, options) ⇒ Object
40 41 42 |
# File 'lib/resthome/httparty/persistent_connection_adapter.rb', line 40 def self.start(uri, ) @conn ||= new(uri, ).connection.tap { |c| c.start } end |
Instance Method Details
#connection ⇒ Object
copied from HTTParty::ConnectionAdapter
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/resthome/httparty/persistent_connection_adapter.rb', line 19 def connection PersistentHTTP.new(clean_host(uri.host), uri.port, [:http_proxyaddr], [:http_proxyport], [:http_proxyuser], [:http_proxypass]).tap do |http| http.use_ssl = ssl_implied?(uri) attach_ssl_certificates(http, ) if [:timeout] && ([:timeout].is_a?(Integer) || [:timeout].is_a?(Float)) http.open_timeout = [:timeout] http.read_timeout = [:timeout] end if [:debug_output] http.set_debug_output([:debug_output]) end if [:ciphers] http.ciphers = [:ciphers] end end end |