Class: Iterable::Commerce
- Inherits:
-
ApiResource
- Object
- ApiResource
- Iterable::Commerce
- Defined in:
- lib/iterable/commerce.rb
Overview
Interact with /commerce API endpoints
Instance Attribute Summary
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#track_purchase(total, items = [], user = {}, attrs = {}) ⇒ Iterable::Response
Track a purchase.
-
#update_cart(user = {}, items = []) ⇒ Iterable::Response
Updates the ‘shoppingCartItems’ field on the user profile with shopping cart items.
Methods inherited from ApiResource
#default_config, default_config, #initialize
Constructor Details
This class inherits a constructor from Iterable::ApiResource
Instance Method Details
#track_purchase(total, items = [], user = {}, attrs = {}) ⇒ Iterable::Response
Track a purchase. ‘shoppingCartItems’ field on the user profile is cleared. User profile is also updated (created otherwise) using the user request field
26 27 28 29 30 31 32 33 34 |
# File 'lib/iterable/commerce.rb', line 26 def track_purchase(total, items = [], user = {}, attrs = {}) data = { total: total, items: items, user: user } data.merge!(attrs) Iterable.request(conf, '/commerce/trackPurchase').post(data) end |
#update_cart(user = {}, items = []) ⇒ Iterable::Response
Updates the ‘shoppingCartItems’ field on the user profile with shopping cart items. User profile is updated (created otherwise) via the user field.
45 46 47 48 49 50 51 |
# File 'lib/iterable/commerce.rb', line 45 def update_cart(user = {}, items = []) data = { items: items, user: user } Iterable.request(conf, '/commerce/updateCart').post(data) end |