Class: ThreeScale::Client::HTTPClient::NetHttp

Inherits:
BaseClient
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/3scale/client/http_client.rb

Direct Known Subclasses

NetHttpKeepAlive

Instance Method Summary collapse

Methods inherited from BaseClient

available?, #get_request, #post_request, prepare

Constructor Details

#initialize(host, port) ⇒ NetHttp

Returns a new instance of NetHttp.



100
101
102
103
# File 'lib/3scale/client/http_client.rb', line 100

def initialize(host, port)
  super
  @http = Net::HTTP.new(@host, port)
end

Instance Method Details

#get(path) ⇒ Object



110
111
112
# File 'lib/3scale/client/http_client.rb', line 110

def get(path)
  @http.request get_request(path)
end

#post(path, payload) ⇒ Object



114
115
116
# File 'lib/3scale/client/http_client.rb', line 114

def post(path, payload)
  @http.request post_request(path, payload)
end

#ssl!Object



105
106
107
108
# File 'lib/3scale/client/http_client.rb', line 105

def ssl!
  @http = Net::HTTP.new(@host, @port)
  @http.use_ssl = true
end