class PersistentConnectionAdapter

Public Class Methods

call(uri, options) click to toggle source
# File lib/resthome/httparty/persistent_connection_adapter.rb, line 55
def self.call(uri, options)
  self.start uri, options
end
close() click to toggle source
# 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() click to toggle source
# File lib/resthome/httparty/persistent_connection_adapter.rb, line 51
def self.conn
  @conn
end
start(uri, options) click to toggle source
# File lib/resthome/httparty/persistent_connection_adapter.rb, line 40
def self.start(uri, options)
  @conn ||= new(uri, options).connection.tap { |c| c.start }
end

Public Instance Methods

connection() click to toggle source

copied from HTTParty::ConnectionAdapter

# File lib/resthome/httparty/persistent_connection_adapter.rb, line 19
def connection
  PersistentHTTP.new(clean_host(uri.host), uri.port, options[:http_proxyaddr], options[:http_proxyport], options[:http_proxyuser], options[:http_proxypass]).tap do |http|
    http.use_ssl = ssl_implied?(uri)

    attach_ssl_certificates(http, options)

    if options[:timeout] && (options[:timeout].is_a?(Integer) || options[:timeout].is_a?(Float))
      http.open_timeout = options[:timeout]
      http.read_timeout = options[:timeout]
    end

    if options[:debug_output]
      http.set_debug_output(options[:debug_output])
    end

    if options[:ciphers]
      http.ciphers = options[:ciphers]
    end
  end
end