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) ⇒ NetHttp

Returns a new instance of NetHttp.



98
99
100
101
# File 'lib/3scale/client/http_client.rb', line 98

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

Instance Method Details

#get(path) ⇒ Object



108
109
110
# File 'lib/3scale/client/http_client.rb', line 108

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

#post(path, payload) ⇒ Object



112
113
114
# File 'lib/3scale/client/http_client.rb', line 112

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

#ssl!Object



103
104
105
106
# File 'lib/3scale/client/http_client.rb', line 103

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