class EventHubClient::EventHubClient

Attributes

host[R]
port[R]
worker[R]

Public Class Methods

new(host, port, worker) click to toggle source
# File lib/event_hub_client.rb, line 47
def initialize(host, port, worker)
  @host = host
  @port = port
  @worker = worker
end

Public Instance Methods

alias(from_id, to_id) click to toggle source
# File lib/event_hub_client.rb, line 64
def alias(from_id, to_id)
  path = "users/alias"
  params = {
    "from_external_user_id" => from_id,
    "to_external_user_id" => to_id
  }

  send_request(path, params)
end
send_request(path, body) click to toggle source
# File lib/event_hub_client.rb, line 74
def send_request(path, body)
  worker.perform("http://#{@host}:#{@port}/#{path}", body)
end
track(event_type, user_id, event_properties) click to toggle source
# File lib/event_hub_client.rb, line 53
def track(event_type, user_id, event_properties)
  path = "events/track"

  params = {}.merge(event_properties).merge({
    "event_type" => event_type,
    "external_user_id" => user_id,
  })

  send_request(path, params)
end