Class: BBMB::Model::Product
- Inherits:
-
ProductInfo
- Object
- Subject
- ProductInfo
- BBMB::Model::Product
- Includes:
- ODBA::Persistable
- Defined in:
- lib/bbmb/model/product.rb,
lib/bbmb/persistence/odba/model/product.rb
Instance Attribute Summary
Attributes inherited from ProductInfo
#article_number, #backorder, #backorder_date, #commit_date, #ean13, #expiry_date, #partner_index, #pcode, #promotion, #sale, #status
Instance Method Summary collapse
Methods inherited from ProductInfo
#==, #freebies, #initialize, #migrate_to_subject, #price, #price_base, #price_effective, #price_qty, #qty_level
Methods included from Util::Numbers
Methods inherited from Subject
#migrate_to_subject, multilingual
Constructor Details
This class inherits a constructor from BBMB::Model::ProductInfo
Instance Method Details
#backorder=(value) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/bbmb/model/product.rb', line 73 def backorder=(value) case value when true, 1, /^(ja?|y(es)?|1)$/i @backorder = true else @backorder = false end end |
#current_promo ⇒ Object
81 82 83 |
# File 'lib/bbmb/model/product.rb', line 81 def current_promo [@sale, @promotion].find { |promo| promo && promo.current? } end |
#to_info ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/bbmb/model/product.rb', line 84 def to_info info = ProductInfo.new(@article_number) [ :backorder_date, :catalogue1, :catalogue2, :catalogue3, :description, :ean13, :expiry_date, :partner_index, :pcode, :status, :l1_qty, :l2_qty, :l3_qty, :l4_qty, :l5_qty, :l6_qty, :vat, :price, :l1_price, :l2_price, :l3_price, :l4_price, :l5_price, :l6_price ].each { |key| info.send("#{key}=", self.send(key)) } info.promotion = @promotion.dup if(@promotion && @promotion.current?) info.sale = @sale.dup if(@sale && @sale.current?) info end |