Class: EventHubClient::EventHubClient
- Inherits:
-
Object
- Object
- EventHubClient::EventHubClient
- Defined in:
- lib/event_hub_client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Instance Method Summary collapse
- #alias(from_id, to_id) ⇒ Object
-
#initialize(host, port, worker) ⇒ EventHubClient
constructor
A new instance of EventHubClient.
- #send_request(path, body) ⇒ Object
- #track(event_type, user_id, event_properties) ⇒ Object
Constructor Details
#initialize(host, port, worker) ⇒ EventHubClient
Returns a new instance of EventHubClient.
47 48 49 50 51 |
# File 'lib/event_hub_client.rb', line 47 def initialize(host, port, worker) @host = host @port = port @worker = worker end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
45 46 47 |
# File 'lib/event_hub_client.rb', line 45 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
45 46 47 |
# File 'lib/event_hub_client.rb', line 45 def port @port end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
45 46 47 |
# File 'lib/event_hub_client.rb', line 45 def worker @worker end |
Instance Method Details
#alias(from_id, to_id) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# 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) ⇒ Object
74 75 76 |
# 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) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# 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 |