item_builder_mwh 0.1.20 → 0.1.24

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: 433fd54a7f90b3889e4e1ca203c4fc6212e1613718b6220fb40b7c9ca8923760
4
+ data.tar.gz: e2832bdad60f6f48f6a4715f6014ec3790ee9d6adfeaa52d20f23a0cbd10db62
5
5
  SHA512:
6
- metadata.gz: f94fe24fe00eaa8a247ec41b5a4776529d2c3861c94a75c8933ef52bc61396b6018548ce08021c19599625f14c71d77c2eacf5df7da10e551f2c16fec617c024
7
- data.tar.gz: 2234c4b0137ec329818da33822f25740cbeac2fb18f1d4033bc8f9c2025a4faffd61c84e388f878f5460e0f1e93f6d51a8ced950d037a3c294a98872e3e68706
6
+ metadata.gz: 69f3d4575556e47967ec0dd47f0e82909c85c32abbb9a7e9fcb6082c0e514f9890d78cd9f0c806a3448d49119d1accb17b9c34e7e2f15242affdf3c7878c7d08
7
+ data.tar.gz: 3a90c1e89b7945d0f21e6c84bd879ab309689504b2301a70608878929183525101a4497226b1d832c733315197b43cfb287661098153e0f396d627b74749fb23
@@ -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]
@@ -129,9 +128,12 @@ class ItemBuilderMwh
129
128
  end
130
129
 
131
130
  def params(allocated_stock)
132
- "channel_id=#{listing.channel_id}&item_variant_id=#{listing.variant_id}
133
- &start_at=#{allocated_stock.start_at.to_date.beginning_of_day}
134
- &end_at=#{allocated_stock.end_at.to_date.end_of_day}"
131
+ {
132
+ channel_id: allocated_stock.variant_listing.channel_id,
133
+ item_variant_id: allocated_stock.variant_listing.variant_id,
134
+ start_at: allocated_stock.start_at.to_date.beginning_of_day,
135
+ end_at: allocated_stock.end_at.to_date.end_of_day
136
+ }.to_query
135
137
  end
136
138
 
137
139
  # one_alloc_rsvd_stock fungsi untuk mendapatkan satu
@@ -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
 
@@ -14,7 +14,6 @@ class ItemBuilderMwh
14
14
  include Modes
15
15
 
16
16
  QUANTITY_CHANNEL = {}.tap do |hash|
17
- hash[3] = :Lazada
18
17
  hash[2] = :Shopify
19
18
  hash[13] = :Zalora
20
19
  hash[18] = :Zilingo
@@ -31,12 +30,21 @@ class ItemBuilderMwh
31
30
  end
32
31
 
33
32
  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
- }
33
+ if channel_name == "Zilingo"
34
+ {
35
+ quantity: qty(warehouse_space.quantity),
36
+ warehouse_id: wh_mapping(
37
+ warehouse_space.warehouse_id
38
+ )
39
+ }
40
+ else
41
+ {
42
+ quantity: [qty(warehouse_space.quantity), 0].sort[1],
43
+ warehouse_id: wh_mapping(
44
+ warehouse_space.warehouse_id
45
+ )
46
+ }
47
+ end
40
48
  end
41
49
 
42
50
  def qty(qty)
@@ -77,12 +85,6 @@ class ItemBuilderMwh
77
85
  nil
78
86
  end
79
87
 
80
- def multiwarehouse
81
- return credential['multiwarehouse'] if credential.present?
82
-
83
- false
84
- end
85
-
86
88
  def wh_routing
87
89
  return credential['warehouse_routing'] if credential.present? && credential['warehouse_routing'].present?
88
90
 
@@ -94,8 +96,7 @@ class ItemBuilderMwh
94
96
  listing: listing, stock_alloc: stock_alloc,
95
97
  variant: variant, bundle_variants: bundle_variants,
96
98
  existing_allocated_stock: existing_allocated_stock,
97
- listing_wh_sp_quantity: qty, multiwarehouse: multiwarehouse,
98
- wh_routing: wh_routing
99
+ listing_wh_sp_quantity: qty, wh_routing: wh_routing
99
100
  ).perform
100
101
  end
101
102
  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.24'
5
5
  end
@@ -47,6 +47,8 @@ class ItemBuilderMwh
47
47
  raise "Response Code is #{resp.dig("response_code")}"
48
48
  elsif resp.dig('ErrorResponse', 'Head', 'ErrorMessage') == 'E009: Access Denied'
49
49
  return nil
50
+ elsif resp.dig('ErrorResponse').present?
51
+ return nil
50
52
  end
51
53
  success_handle(resp)
52
54
  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.24
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-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler