Class: Customers
- Inherits:
-
Object
- Object
- Customers
- Includes:
- HTTParty
- Defined in:
- lib/aboardly/events.rb,
lib/aboardly/customers.rb
Instance Method Summary collapse
- #create(customer_id, event_name, *properties) ⇒ Object
-
#initialize(auth, base_url) ⇒ Customers
constructor
A new instance of Customers.
- #upsert(customer_id, data = {}) ⇒ Object
Constructor Details
#initialize(auth, base_url) ⇒ Customers
Returns a new instance of Customers.
4 5 6 7 |
# File 'lib/aboardly/events.rb', line 4 def initialize(auth, base_url) @auth = auth @base_url = base_url end |
Instance Method Details
#create(customer_id, event_name, *properties) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/aboardly/events.rb', line 9 def create(customer_id, event_name, *properties) if (properties.empty?) properties = [{}] end = {basic_auth: @auth, body: properties[0].to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}} self.class.post("#{@base_url}/customers/#{customer_id}/events/#{event_name}", ) end |
#upsert(customer_id, data = {}) ⇒ Object
9 10 11 12 |
# File 'lib/aboardly/customers.rb', line 9 def upsert(customer_id, data = {}) = {body: data, basic_auth: @auth} self.class.put("#{@base_url}/customers/#{customer_id}", ) end |