Class: BBMB::Model::Product

Inherits:
ProductInfo show all
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 inherited from Subject

#migrate_to_subject, multilingual

Constructor Details

This class inherits a constructor from BBMB::Model::ProductInfo

Instance Method Details

#backorder=(value) ⇒ Object



109
110
111
112
113
114
115
116
# File 'lib/bbmb/model/product.rb', line 109

def backorder=(value)
  case value
  when true, 1, /^(ja?|y(es)?|1)$/i
    @backorder = true
  else
    @backorder = false
  end
end

#current_promo ⇒ Object



117
118
119
# File 'lib/bbmb/model/product.rb', line 117

def current_promo
  [@sale, @promotion].find { |promo| promo && promo.current? }
end

#to_info ⇒ Object



125
126
127
# File 'lib/bbmb/model/product.rb', line 125

def to_info
  convert_to(ProductInfo)
end

#to_product ⇒ Object



121
122
123
# File 'lib/bbmb/model/product.rb', line 121

def to_product
  self
end