Class: Spree::Promotion::Actions::CreateQuantityAdjustments::PartialLineItem
- Inherits:
-
Object
- Object
- Spree::Promotion::Actions::CreateQuantityAdjustments::PartialLineItem
- Defined in:
- app/models/spree/promotion/actions/create_quantity_adjustments.rb
Overview
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
- #amount ⇒ Object
- #currency ⇒ Object
-
#initialize(line_item) ⇒ PartialLineItem
constructor
A new instance of PartialLineItem.
- #order ⇒ Object
Constructor Details
#initialize(line_item) ⇒ PartialLineItem
Returns a new instance of PartialLineItem.
123 124 125 |
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 123 def initialize(line_item) @line_item = line_item end |
Instance Method Details
#amount ⇒ Object
127 128 129 |
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 127 def amount @line_item.price end |
#currency ⇒ Object
135 136 137 |
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 135 def currency @line_item.currency end |
#order ⇒ Object
131 132 133 |
# File 'app/models/spree/promotion/actions/create_quantity_adjustments.rb', line 131 def order @line_item.order end |