Class: SolidusDrip::ShopperActivity::Order

Inherits:
Base
  • Object
show all
Defined in:
lib/solidus_drip/shopper_activity/order.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ Order

ShopperActivity::Order relies on order data to be useful. We call super to initialize the client and then we set the order attribute to be used in the API calls.

Parameters:

  • order (Spree::Order)

    the order to be recorded



15
16
17
18
# File 'lib/solidus_drip/shopper_activity/order.rb', line 15

def initialize(order)
  super
  @order = order
end

Instance Attribute Details

#orderObject

Returns the value of attribute order.



6
7
8
# File 'lib/solidus_drip/shopper_activity/order.rb', line 6

def order
  @order
end

Instance Method Details

#cart_activity(action) ⇒ Object

Cart Activity helps identify cart abandonment.

Parameters:

  • action (String)

    the cart action, ‘created` or `updated`

See Also:



26
27
28
29
30
31
# File 'lib/solidus_drip/shopper_activity/order.rb', line 26

def cart_activity(action)
  response = client.create_cart_activity_event(cart_data(action))
  handle_error_response(response) if !response.success?

  response.success?
end

#order_activity(action) ⇒ Object

Order Activity helps identify a user’s lifetime value by tracking the values

Parameters:

  • action (String)

    the cart action, ‘placed`, `updated`, `paid`, `fulfilled`, `refunded`, or `canceled`

See Also:



40
41
42
43
44
45
# File 'lib/solidus_drip/shopper_activity/order.rb', line 40

def order_activity(action)
  response = client.create_order_activity_event(order_data(action))
  handle_error_response(response) if !response.success?

  response.success?
end