class ThreeScale::Client::HTTPClient::NetHttpPersistent
Public Class Methods
available?()
click to toggle source
# File lib/3scale/client/http_client.rb, line 71 def self.available? prepare true rescue LoadError false end
new(host, port)
click to toggle source
Calls superclass method
ThreeScale::Client::HTTPClient::BaseClient::new
# File lib/3scale/client/http_client.rb, line 82 def initialize(host, port) super @http = ::Net::HTTP::Persistent.new @protocol = 'http' end
prepare()
click to toggle source
# File lib/3scale/client/http_client.rb, line 78 def self.prepare require 'net/http/persistent' end
Public Instance Methods
full_uri(path)
click to toggle source
# File lib/3scale/client/http_client.rb, line 103 def full_uri(path) URI.join "#{@protocol}://#{@host}:#{@port}", path end
get(path, headers: nil)
click to toggle source
# File lib/3scale/client/http_client.rb, line 92 def get(path, headers: nil) uri = full_uri(path) @http.request(uri, get_request(path, headers: headers)) end
post(path, payload, headers: nil)
click to toggle source
# File lib/3scale/client/http_client.rb, line 98 def post(path, payload, headers: nil) uri = full_uri(path) @http.request(uri, post_request(path, payload, headers: headers)) end
ssl!()
click to toggle source
# File lib/3scale/client/http_client.rb, line 88 def ssl! @protocol = 'https' end