Class: Gemgento::Inventory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Gemgento::Inventory
- Includes:
- ProductTouches
- Defined in:
- app/models/gemgento/inventory.rb
Overview
Instance Attribute Summary collapse
-
#use_config_manage_stock ⇒ Object
Returns the value of attribute use_config_manage_stock.
Instance Method Summary collapse
-
#in_stock?(quantity = 1) ⇒ Boolean
Determine if the specified quantity is in stock.
-
#push ⇒ Boolean
Push the inventory data to Magento.
Instance Attribute Details
#use_config_manage_stock ⇒ Object
Returns the value of attribute use_config_manage_stock.
19 20 21 |
# File 'app/models/gemgento/inventory.rb', line 19 def use_config_manage_stock @use_config_manage_stock end |
Instance Method Details
#in_stock?(quantity = 1) ⇒ Boolean
Determine if the specified quantity is in stock.
32 33 34 35 36 37 38 39 40 |
# File 'app/models/gemgento/inventory.rb', line 32 def in_stock?(quantity = 1) if !self.manage_stock? return true elsif self.is_in_stock && ((quantity.to_f <= self.quantity.to_f || quantity.to_f == 0) || self.backorders > 0) return true else return false end end |
#push ⇒ Boolean
Push the inventory data to Magento.
24 25 26 |
# File 'app/models/gemgento/inventory.rb', line 24 def push API::SOAP::CatalogInventory::StockItem.update(self.product); end |