Module: SpreeTemando::VariantShippingDecorator

Defined in:
app/models/spree_temando/variant_shipping_decorator.rb

Instance Method Summary collapse

Instance Method Details

#temando_quotable?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
# File 'app/models/spree_temando/variant_shipping_decorator.rb', line 3

def temando_quotable?
  self.height.present? &&
  self.depth.present? &&
  self.width.present? &&
  self.weight.present?
end

#to_temando_itemObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/spree_temando/variant_shipping_decorator.rb', line 10

def to_temando_item
  return nil unless self.temando_quotable?
  item = Temando::Item::GeneralGoods.new
  item.packaging_optimization = self.packaging_optimization
  # NOTE: All the distances in Temando are in metres
  item.height = (self.height / 100.0)
  item.length = (self.depth / 100.0)
  item.width  = (self.width / 100.0)
  item.weight = self.weight
  item.quantity = 1
  item.description = self.name
  item
end