item_builder_mwh 0.1.20 → 0.1.21

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: 2066320137fbc2c20d44ab35a5732415b32c454792cef09dc13ec5feac54c273
4
- data.tar.gz: 76e567dedbd037d03f39afe5bbc2e0161eba44a8a8884818d2ef418fdabe4310
3
+ metadata.gz: d27673689edf403c7602e972c9b68dea4a3f22c0122c0a9badcb2deafe18b6df
4
+ data.tar.gz: d93a48b95ca90754696afe36673bb8932e1d61d92d9bae41994cebeb15b67b56
5
5
  SHA512:
6
- metadata.gz: f94fe24fe00eaa8a247ec41b5a4776529d2c3861c94a75c8933ef52bc61396b6018548ce08021c19599625f14c71d77c2eacf5df7da10e551f2c16fec617c024
7
- data.tar.gz: 2234c4b0137ec329818da33822f25740cbeac2fb18f1d4033bc8f9c2025a4faffd61c84e388f878f5460e0f1e93f6d51a8ced950d037a3c294a98872e3e68706
6
+ metadata.gz: 87ca59a67d0cf7351aeb460d53e29e31c79f5c026ef84e866bdff0f3f73719a57ee32690c8886f20dc2cbf8a7cfed53e2eb3da57b147b24c049cf38eadd24b95
7
+ data.tar.gz: 4db562d9bad83182d25e4fcbf3b7caaf64683841a3053a6f3576fc512380658a3398cc2afa8a9843da9bc0aef5fc882fd42145b297c7edc52e4c29a633eb5e04
@@ -12,8 +12,7 @@ class ItemBuilderMwh
12
12
  @bundle_variants = args.fetch(:bundle_variants)
13
13
  @existing_allocated_stock = args.fetch(:existing_allocated_stock)
14
14
  @listing_wh_sp_quantity = args.fetch(:listing_wh_sp_quantity)
15
- @multiwarehouse = args.fetch(:multiwarehouse)
16
- @wh_routing = args.fetch(:wh_routing)
15
+ @wh_routing = args.fetch(:wh_routing, 0)
17
16
  end
18
17
 
19
18
  def perform
@@ -72,7 +71,7 @@ class ItemBuilderMwh
72
71
 
73
72
  def qty_default
74
73
  # set lower limit for quantity
75
- if @multiwarehouse && @wh_routing == 1
74
+ if @wh_routing == 1
76
75
  [listing_warehouse_routing_quantity, 0].sort[1]
77
76
  else
78
77
  [@listing_wh_sp_quantity, 0].sort[1]
@@ -31,7 +31,7 @@ class ItemBuilderMwh
31
31
  @reserved_stocks = args.fetch(:reserved_stocks, [])
32
32
  @zilingo_quantity = args.fetch(:zilingo_quantity, [])
33
33
  @zalora_reserved_stock = args.fetch(:zalora_reserved_stock, [])
34
- @shopify_inventory_location = args.fetch(:shopify_inventory_location, [])
34
+ @shopify_inventory_location = args.fetch(:shopify_inventory_location, {})
35
35
  warehouse
36
36
  end
37
37
 
@@ -31,12 +31,21 @@ class ItemBuilderMwh
31
31
  end
32
32
 
33
33
  def to_h(warehouse_space)
34
- {
35
- quantity: [qty(warehouse_space.quantity), 0].sort[1],
36
- warehouse_id: wh_mapping(
37
- warehouse_space.warehouse_id
38
- )
39
- }
34
+ if channel_name == "Zilingo"
35
+ {
36
+ quantity: qty(warehouse_space.quantity),
37
+ warehouse_id: wh_mapping(
38
+ warehouse_space.warehouse_id
39
+ )
40
+ }
41
+ else
42
+ {
43
+ quantity: [qty(warehouse_space.quantity), 0].sort[1],
44
+ warehouse_id: wh_mapping(
45
+ warehouse_space.warehouse_id
46
+ )
47
+ }
48
+ end
40
49
  end
41
50
 
42
51
  def qty(qty)
@@ -77,12 +86,6 @@ class ItemBuilderMwh
77
86
  nil
78
87
  end
79
88
 
80
- def multiwarehouse
81
- return credential['multiwarehouse'] if credential.present?
82
-
83
- false
84
- end
85
-
86
89
  def wh_routing
87
90
  return credential['warehouse_routing'] if credential.present? && credential['warehouse_routing'].present?
88
91
 
@@ -94,8 +97,7 @@ class ItemBuilderMwh
94
97
  listing: listing, stock_alloc: stock_alloc,
95
98
  variant: variant, bundle_variants: bundle_variants,
96
99
  existing_allocated_stock: existing_allocated_stock,
97
- listing_wh_sp_quantity: qty, multiwarehouse: multiwarehouse,
98
- wh_routing: wh_routing
100
+ listing_wh_sp_quantity: qty, wh_routing: wh_routing
99
101
  ).perform
100
102
  end
101
103
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ItemBuilderMwh
4
- VERSION = '0.1.20'
4
+ VERSION = '0.1.21'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_builder_mwh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ivander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler