Class: Spree::Stock::Adjuster
- Inherits:
-
Object
- Object
- Spree::Stock::Adjuster
- Defined in:
- app/models/spree/stock/adjuster.rb
Instance Attribute Summary collapse
-
#fulfilled ⇒ Object
Returns the value of attribute fulfilled.
-
#inventory_unit ⇒ Object
Returns the value of attribute inventory_unit.
-
#package ⇒ Object
Returns the value of attribute package.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #adjust(package) ⇒ Object
- #fulfilled? ⇒ Boolean
-
#initialize(inventory_unit, status, package = nil) ⇒ Adjuster
constructor
A new instance of Adjuster.
- #reassign(status, package) ⇒ Object
Constructor Details
#initialize(inventory_unit, status, package = nil) ⇒ Adjuster
Returns a new instance of Adjuster.
8 9 10 11 12 13 |
# File 'app/models/spree/stock/adjuster.rb', line 8 def initialize(inventory_unit, status, package=nil) @inventory_unit = inventory_unit @status = status @package = package @fulfilled = false end |
Instance Attribute Details
#fulfilled ⇒ Object
Returns the value of attribute fulfilled.
6 7 8 |
# File 'app/models/spree/stock/adjuster.rb', line 6 def fulfilled @fulfilled end |
#inventory_unit ⇒ Object
Returns the value of attribute inventory_unit.
6 7 8 |
# File 'app/models/spree/stock/adjuster.rb', line 6 def inventory_unit @inventory_unit end |
#package ⇒ Object
Returns the value of attribute package.
6 7 8 |
# File 'app/models/spree/stock/adjuster.rb', line 6 def package @package end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'app/models/spree/stock/adjuster.rb', line 6 def status @status end |
Instance Method Details
#adjust(package) ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/models/spree/stock/adjuster.rb', line 15 def adjust(package) if fulfilled? package.remove(inventory_unit) else self.fulfilled = true end end |
#fulfilled? ⇒ Boolean
29 30 31 |
# File 'app/models/spree/stock/adjuster.rb', line 29 def fulfilled? fulfilled end |
#reassign(status, package) ⇒ Object
23 24 25 26 27 |
# File 'app/models/spree/stock/adjuster.rb', line 23 def reassign(status, package) @fulfilled = false @status = status @package = package end |