Class: Exponea::Customers

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/exponea/customers.rb

Constant Summary

Constants inherited from BaseApi

BaseApi::EXPONEA_URL

Class Method Summary collapse

Methods inherited from BaseApi

batch_commands, delete, get, post, put, request

Class Method Details

.update_properties(customer_id, properties, batch = false) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/exponea/customers.rb', line 3

def self.update_properties(customer_id, properties, batch = false)
  customer_ids = customer_id.is_a?(Hash) ? customer_id : { registered: customer_id }
  payload = { customer_ids: customer_ids, properties: properties }
  return { name: 'customers', data: payload } if batch

  path = "/track/v2/projects/#{Exponea.config.project}/customers"
  post(path, payload)
end