Class: Workarea::Inventory::Policies::Standard
- Inherits:
-
Base
- Object
- Base
- Workarea::Inventory::Policies::Standard
show all
- Defined in:
- app/models/workarea/inventory/policies/standard.rb
Instance Attribute Summary
Attributes inherited from Base
#sku
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#available_to_sell ⇒ Object
9
10
11
12
13
|
# File 'app/models/workarea/inventory/policies/standard.rb', line 9
def available_to_sell
total_available = sku.available.to_i - sku.reserve.to_i
total_available = 0 if total_available < 0
total_available
end
|
#displayable? ⇒ Boolean
5
6
7
|
# File 'app/models/workarea/inventory/policies/standard.rb', line 5
def displayable?
sku.purchasable?
end
|
#purchase(quantity) ⇒ Object
15
16
17
18
19
|
# File 'app/models/workarea/inventory/policies/standard.rb', line 15
def purchase(quantity)
result = sku.capture(quantity)
result = sku.capture(quantity) until result[:success]
result
end
|