Class: ConnectClient::Http::Sync
- Inherits:
-
Object
- Object
- ConnectClient::Http::Sync
- Defined in:
- lib/connect_client/http/event_endpoint.rb
Instance Method Summary collapse
-
#initialize(base_url, headers) ⇒ Sync
constructor
A new instance of Sync.
- #send(path, body, events) ⇒ Object
Constructor Details
#initialize(base_url, headers) ⇒ Sync
Returns a new instance of Sync.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/connect_client/http/event_endpoint.rb', line 40 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
#send(path, body, events) ⇒ Object
51 52 53 54 |
# File 'lib/connect_client/http/event_endpoint.rb', line 51 def send(path, body, events) response = @http.post(path, body, @headers) ConnectClient::EventPushResponse.new response.code, response['Content-Type'], response.body, events end |