Class: Spree::Promotion::Actions::CreateQuantityAdjustments::PartialLineItem Private

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/promotion/actions/create_quantity_adjustments.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Used specifically for PercentOnLineItem calculator. That calculator uses `line_item.amount`, however we might not necessarily want to discount the entire amount. This class allows us to determine the discount per quantity and then calculate the adjustment amount the way we normally do for flat rate adjustments.

Instance Method Summary collapse

Constructor Details

#initialize(line_item) ⇒ PartialLineItem

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PartialLineItem



119
120
121
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 119

def initialize(line_item)
  @line_item = line_item
end

Instance Method Details

#amountObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



123
124
125
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 123

def amount
  @line_item.price
end

#currencyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



131
132
133
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 131

def currency
  @line_item.currency
end

#orderObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



127
128
129
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 127

def order
  @line_item.order
end