spree_temando 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -48,6 +48,10 @@ In the calculations, the extension always attempts to find the cheapest
48
48
  quote, but when `Express` is selected, only the quotes with the smallest
49
49
  `maximum_eta` are considered.
50
50
 
51
+ It's important to note that all products in the cart must have their
52
+ dimensions filled out (height, length, depth, weight), otherwise Temando
53
+ will not be able to quote.
54
+
51
55
  ## Notes
52
56
 
53
57
  The extension only makes requests to the Temando API when the order
@@ -12,8 +12,8 @@ module Spree
12
12
  I18n.t(:temando)
13
13
  end
14
14
 
15
- def self.available?(object)
16
- true
15
+ def available?(object)
16
+ object.line_items.all? { |li| li.variant.temando_quotable? }
17
17
  end
18
18
 
19
19
  def cheapest(destination, line_items)
@@ -1,6 +1,14 @@
1
1
  module SpreeTemando
2
2
  module VariantShippingDecorator
3
+ def temando_quotable?
4
+ self.height.present? &&
5
+ self.depth.present? &&
6
+ self.width.present? &&
7
+ self.weight.present?
8
+ end
9
+
3
10
  def to_temando_item
11
+ return nil unless self.temando_quotable?
4
12
  item = Temando::Item::GeneralGoods.new
5
13
  # NOTE: All the distances in Temando are in metres
6
14
  item.height = (self.height / 100.0)
@@ -1,3 +1,3 @@
1
1
  module SpreeTemando
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_temando
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: