Class: Workarea::WishList::Item
- Inherits:
-
Object
- Object
- Workarea::WishList::Item
- Includes:
- ApplicationDocument
- Defined in:
- app/models/workarea/wish_list/item.rb
Instance Method Summary collapse
-
#adjust_pricing(options = {}) ⇒ self
Adds a price adjustment to the item.
- #details=(details) ⇒ Object
-
#on_sale? ⇒ Boolean
Whether this item is on sale (as of the last time the order was priced).
-
#reset_pricing! ⇒ Object
Clears out all pricing for this item.
-
#unit_price ⇒ Money
The base price per-unit for this item.
Instance Method Details
#adjust_pricing(options = {}) ⇒ self
Adds a price adjustment to the item. Does not persist.
48 49 50 |
# File 'app/models/workarea/wish_list/item.rb', line 48 def adjust_pricing( = {}) price_adjustments.build() end |
#details=(details) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/models/workarea/wish_list/item.rb', line 32 def details=(details) write_attributes( details.slice( :product_details, :sku_details, :product_attributes ) ) self end |
#on_sale? ⇒ Boolean
Whether this item is on sale (as of the last time the order was priced).
71 72 73 |
# File 'app/models/workarea/wish_list/item.rb', line 71 def on_sale? !!price_adjustments.first.data['on_sale'] end |
#reset_pricing! ⇒ Object
Clears out all pricing for this item.
54 55 56 |
# File 'app/models/workarea/wish_list/item.rb', line 54 def reset_pricing! price_adjustments.delete_all end |
#unit_price ⇒ Money
The base price per-unit for this item.
62 63 64 |
# File 'app/models/workarea/wish_list/item.rb', line 62 def unit_price price_adjustments.first.unit.to_m end |