valken-shipping 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e947a87def474d5ba702c0963f98e69ce19088a95e642cfe28ed987673205a3d
4
- data.tar.gz: 6c2f25080c9630ef02070925eb8187c7000449b92fdede1ddab22031e0510341
3
+ metadata.gz: e6737dc3d986324920e209163dbbd483d3c71326f1e648fb1aabce037532951e
4
+ data.tar.gz: 61ee46bf6044bc76d3151c4ed82881bc52c239a5852482970057838ef2efef91
5
5
  SHA512:
6
- metadata.gz: 101c999bba01649e3fd520d0c342970790e3861e27d924d856c3b50756d29ded84dba3178214b0a295da5bfb8375e5fb2ada8ed7d94671bcbb1f253a70ef5960
7
- data.tar.gz: 6db8d96eef213778ca5db2cea6baa70f729c2e8e68d186bc256e3e32f9279fd393b15866f4a53078c7db7b4c0e17cffcb931b0b6bad7a93db6082b1d40983190
6
+ metadata.gz: '05008742de8bd382a1f74d139941db9e2e865f7f7aee9f3b106e80f51c83f672a61d788cbe95d6239be6e49d9ee87534f7e138ebaf30138e79abd25909a14882'
7
+ data.tar.gz: 77a5fd5041ba0f282bf5a45897eb410fd5b56cbcc6b813495fb0e965c2413d6972687774d98bbbfe32ed0bab62ec10de3ac2d3b37ba83097bd4ffcdda80e8f03
@@ -10,7 +10,21 @@ module Workarea
10
10
  def find_sku_weight(sku)
11
11
  sku_data = Catalog::Product.find_by_sku(sku).variants
12
12
  sku = sku_data.detect {|variant| variant.sku == sku }
13
- sku.weight || 0
13
+ if is_pounds(sku)
14
+ convert_to_lb(sku.weight)
15
+ else
16
+ sku.weight || 0
17
+ end
18
+ end
19
+
20
+ def convert_to_lb(weight)
21
+ unit = Measured::Weight.new(weight, :lb)
22
+ unit.convert_to(:oz)
23
+ unit.value
24
+ end
25
+
26
+ def is_pounds(sku)
27
+ sku.weight_unit == "lb"
14
28
  end
15
29
  end
16
30
  end
@@ -1,5 +1,5 @@
1
1
  module Valken
2
2
  module Shipping
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valken-shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sushmitha02
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails