Class: ConnectClient::Http::NetHttp
- Inherits:
-
Object
- Object
- ConnectClient::Http::NetHttp
- Defined in:
- lib/connect_client/http/event_endpoint.rb
Instance Method Summary collapse
-
#initialize(base_url, headers) ⇒ NetHttp
constructor
A new instance of NetHttp.
- #push_events(path, body, events) ⇒ Object
Constructor Details
#initialize(base_url, headers) ⇒ NetHttp
Returns a new instance of NetHttp.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/connect_client/http/event_endpoint.rb', line 41 def initialize(base_url, headers) require 'uri' require 'net/http' require 'net/https' @headers = headers @connect_uri = URI.parse(base_url) @http = Net::HTTP.new(@connect_uri.host, @connect_uri.port) setup_ssl if @connect_uri.scheme == 'https' end |
Instance Method Details
#push_events(path, body, events) ⇒ Object
52 53 54 55 |
# File 'lib/connect_client/http/event_endpoint.rb', line 52 def push_events(path, body, events) response = @http.post(path, body, @headers) ConnectClient::EventPushResponse.new response.code, response['Content-Type'], response.body, events end |