Class: SpreeKlaviyo::LineItemPresenter
- Inherits:
-
ProductPresenter
- Object
- ProductPresenter
- SpreeKlaviyo::LineItemPresenter
- Includes:
- Spree::BaseHelper, Spree::ProductsHelper
- Defined in:
- app/presenters/spree_klaviyo/line_item_presenter.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(resource:, quantity:, total_price:, currency:, store:, position: nil) ⇒ LineItemPresenter
constructor
A new instance of LineItemPresenter.
Constructor Details
#initialize(resource:, quantity:, total_price:, currency:, store:, position: nil) ⇒ LineItemPresenter
Returns a new instance of LineItemPresenter.
6 7 8 9 10 11 12 |
# File 'app/presenters/spree_klaviyo/line_item_presenter.rb', line 6 def initialize(resource:, quantity:, total_price:, currency:, store:, position: nil) @resource = resource @position = position @quantity = quantity @total_price = total_price super(product: resource&.product, store: store) end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/presenters/spree_klaviyo/line_item_presenter.rb', line 14 def call return {} if @resource.nil? super.merge({ quantity: @quantity, item_price: @resource.price, row_total: @total_price }) end |