Class: Xsys::Model::ProductPackage
- Inherits:
-
Object
- Object
- Xsys::Model::ProductPackage
- Defined in:
- lib/xsys/model/product_package.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ProductPackage
constructor
A new instance of ProductPackage.
- #volume ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ ProductPackage
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/xsys/model/product_package.rb', line 10 def initialize(attributes={}) attributes.each do |k, v| decimal_fields = ['length', 'width', 'height', 'weight'] if decimal_fields.include?(k.to_s) self.send("#{k}=", BigDecimal.new(v)) unless v.nil? else self.send("#{k}=", v) if self.respond_to?(k) end end end |
Class Method Details
.attr_list ⇒ Object
4 5 6 |
# File 'lib/xsys/model/product_package.rb', line 4 def self.attr_list [:length, :width, :height, :weight, :ean] end |
Instance Method Details
#volume ⇒ Object
22 23 24 |
# File 'lib/xsys/model/product_package.rb', line 22 def volume length * width * height end |