Class: ThreeScale::Client::HTTPClient
- Inherits:
-
Object
- Object
- ThreeScale::Client::HTTPClient
- Extended by:
- Forwardable
- Defined in:
- lib/3scale/client/http_client.rb
Defined Under Namespace
Classes: BaseClient, NetHttp, NetHttpKeepAlive, NetHttpPersistent, PersistenceNotAvailable
Constant Summary collapse
- USER_CLIENT_HEADER =
['X-3scale-User-Agent', "plugin-ruby-v#{VERSION}"]
Class Attribute Summary collapse
-
.persistent_backend ⇒ Object
Returns the value of attribute persistent_backend.
Instance Method Summary collapse
-
#initialize(options) ⇒ HTTPClient
constructor
A new instance of HTTPClient.
Constructor Details
#initialize(options) ⇒ HTTPClient
Returns a new instance of HTTPClient.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/3scale/client/http_client.rb', line 17 def initialize() @secure = !![:secure] @host = .fetch(:host) @persistent = [:persistent] @port = [: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 |
Class Attribute Details
.persistent_backend ⇒ Object
Returns the value of attribute persistent_backend.
155 156 157 |
# File 'lib/3scale/client/http_client.rb', line 155 def persistent_backend @persistent_backend end |