Class: Dugway::Drops::ProductOptionDrop
- Defined in:
- lib/dugway/liquid/drops/product_option_drop.rb
Instance Attribute Summary
Attributes inherited from BaseDrop
Instance Method Summary collapse
- #default ⇒ Object
- #has_custom_price ⇒ Object
- #inventory ⇒ Object
-
#quantity ⇒ Object
Make up inventory numbers since we obviously don’t want that from the API.
- #sold ⇒ Object
Methods inherited from BaseDrop
#before_method, #cart, #context=, #error, #errors, #initialize, #method_missing, #store, #theme
Constructor Details
This class inherits a constructor from Dugway::Drops::BaseDrop
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dugway::Drops::BaseDrop
Instance Method Details
#default ⇒ Object
4 5 6 |
# File 'lib/dugway/liquid/drops/product_option_drop.rb', line 4 def default position == 1 end |
#has_custom_price ⇒ Object
8 9 10 |
# File 'lib/dugway/liquid/drops/product_option_drop.rb', line 8 def has_custom_price price != product.default_price end |
#inventory ⇒ Object
22 23 24 |
# File 'lib/dugway/liquid/drops/product_option_drop.rb', line 22 def inventory ((quantity.to_f / (quantity + sold).to_f) * 100).round end |
#quantity ⇒ Object
Make up inventory numbers since we obviously don’t want that from the API
14 15 16 |
# File 'lib/dugway/liquid/drops/product_option_drop.rb', line 14 def quantity @quantity ||= sold_out ? 0 : rand(100) end |
#sold ⇒ Object
18 19 20 |
# File 'lib/dugway/liquid/drops/product_option_drop.rb', line 18 def sold @sold ||= rand(100) end |