class ThreeScale::Client::HTTPClient

Constants

USER_CLIENT_HEADER

Attributes

persistent_backend[RW]

Public Class Methods

new(options) click to toggle source
# File lib/3scale/client/http_client.rb, line 17
def initialize(options)
  @secure = !!options[:secure]
  @host = options.fetch(:host)
  @persistent = options[:persistent]
  @port = options[:port] || (@secure ? 443 : 80)

  backend_class = @persistent ? self.class.persistent_backend : NetHttp or raise PersistenceNotAvailable
  backend_class.prepare

  @http = backend_class.new(@host, @port)
  @http.ssl! if @secure
end