Class: Spree::Adjustable::AdjustmentsUpdater

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/adjustable/adjustments_updater.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adjustable) ⇒ AdjustmentsUpdater

Returns a new instance of AdjustmentsUpdater.



8
9
10
11
# File 'app/models/spree/adjustable/adjustments_updater.rb', line 8

def initialize(adjustable)
  @adjustable = adjustable
  adjustable.reload if shipment? && persisted?
end

Class Method Details

.update(adjustable) ⇒ Object



4
5
6
# File 'app/models/spree/adjustable/adjustments_updater.rb', line 4

def self.update(adjustable)
  new(adjustable).update
end

Instance Method Details

#updateObject



13
14
15
16
17
18
# File 'app/models/spree/adjustable/adjustments_updater.rb', line 13

def update
  return unless persisted?
  update_promo_adjustments
  update_tax_adjustments
  persist_totals
end