Class: Exponea::Events
Constant Summary
Constants inherited from BaseApi
Class Method Summary collapse
Methods inherited from BaseApi
batch_commands, delete, get, post, put, request
Class Method Details
.add_event(customer_id, event_type, properties = nil, batch = false, timestamp = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/exponea/events.rb', line 3 def self.add_event(customer_id, event_type, properties = nil, batch = false, = nil) customer_ids = customer_id.is_a?(Hash) ? customer_id : { registered: customer_id } payload = { customer_ids: customer_ids, properties: properties, event_type: event_type } payload = payload.merge(timestamp: .to_i) if return { name: 'customers/events', data: payload } if batch path = "/track/v2/projects/#{Exponea.config.project}/customers/events" post(path, payload) end |