item_builder 0.1.48 → 0.1.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/item_builder/modes/active_service.rb +0 -1
- data/lib/item_builder/modes/quantity/lazada_service.rb +1 -1
- data/lib/item_builder/modes/simple_service.rb +0 -1
- data/lib/item_builder/modes.rb +0 -2
- data/lib/item_builder/version.rb +1 -1
- data/lib/item_builder.rb +22 -43
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06f0ac99623b592c04907d6109f8bc31f760dbda87384366c8c41cb0d3819ab0
|
4
|
+
data.tar.gz: e8705bd03dabd76ced2ee13ca0626f631e8015c2a31fffc8bdaa9e214a6f2cea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 952521e982b28396d459ca0302edcf3bfa7c5ffe63fe1458ab7d33a0d37be5876154a5f1c12496aa4ef000d0e331f4d85ac47ebd25e8aa6b4a88f444509b1dff
|
7
|
+
data.tar.gz: ac13a66b436d5a307c29adc0c1a26de4c218de3bf2caf84c3eeb24080027867424c5cea159bb33e0eade84ec7c617e518dda935ab9a17f7c1a45f2b5453318fc
|
@@ -28,7 +28,6 @@ class ItemBuilder
|
|
28
28
|
stock_allocs: stock_allocs, variant_listings: variant_listings,
|
29
29
|
bundles: bundles, item_bundle_variants: item_bundle_variants,
|
30
30
|
existing_alloc_stocks: existing_alloc_stocks,
|
31
|
-
reserved_stocks: reserved_stocks,
|
32
31
|
zilingo_quantity: zilingo_quantity,
|
33
32
|
zalora_reserved_stock: zalora_reserved_stock
|
34
33
|
).to_h
|
@@ -22,7 +22,6 @@ class ItemBuilder
|
|
22
22
|
stock_allocs: stock_allocs, variant_listings: variant_listings,
|
23
23
|
bundles: bundles, item_bundle_variants: item_bundle_variants,
|
24
24
|
existing_alloc_stocks: existing_alloc_stocks,
|
25
|
-
reserved_stocks: reserved_stocks,
|
26
25
|
zilingo_quantity: zilingo_quantity
|
27
26
|
).to_h
|
28
27
|
end
|
data/lib/item_builder/modes.rb
CHANGED
@@ -16,7 +16,6 @@ class ItemBuilder
|
|
16
16
|
attr_reader :item_bundle_variants
|
17
17
|
attr_reader :existing_alloc_stocks
|
18
18
|
attr_reader :variant_listings
|
19
|
-
attr_reader :reserved_stocks
|
20
19
|
attr_reader :zilingo_quantity
|
21
20
|
attr_reader :lazada_quantity
|
22
21
|
attr_reader :zalora_reserved_stock
|
@@ -31,7 +30,6 @@ class ItemBuilder
|
|
31
30
|
@item_bundle_variants = args.fetch(:item_bundle_variants, [])
|
32
31
|
@existing_alloc_stocks = args.fetch(:existing_alloc_stocks, [])
|
33
32
|
@variant_listings = args.fetch(:variant_listings, [])
|
34
|
-
@reserved_stocks = args.fetch(:reserved_stocks, [])
|
35
33
|
@zilingo_quantity = args.fetch(:zilingo_quantity, [])
|
36
34
|
@lazada_quantity = args.fetch(:lazada_quantity, [])
|
37
35
|
@zalora_reserved_stock = args.fetch(:zalora_reserved_stock, [])
|
data/lib/item_builder/version.rb
CHANGED
data/lib/item_builder.rb
CHANGED
@@ -23,6 +23,8 @@ class ItemBuilder
|
|
23
23
|
attr_reader :wh_spaces
|
24
24
|
attr_reader :variants
|
25
25
|
attr_reader :variant_ids
|
26
|
+
attr_reader :wh_mapping
|
27
|
+
attr_reader :wh_id
|
26
28
|
|
27
29
|
def initialize(listing_ids, mode)
|
28
30
|
@listing_ids = listing_ids
|
@@ -41,29 +43,23 @@ class ItemBuilder
|
|
41
43
|
listings.map do |listing|
|
42
44
|
next unless listing.local_id.present?
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
.merge({lazada_quantity: lazada_quantity})
|
62
|
-
|
63
|
-
modes[mode].new(new_param).perform
|
64
|
-
else
|
65
|
-
modes[mode].new(qty_simple_params(listing)).perform
|
66
|
-
end
|
46
|
+
param =
|
47
|
+
if listing.channel_id == 18
|
48
|
+
qty_simple_params(listing)
|
49
|
+
.merge(zilingo_quantity: zilingo_quantity)
|
50
|
+
elsif listing.channel_id == 13
|
51
|
+
qty_simple_params(listing)
|
52
|
+
.merge(zalora_reserved_stock: zalora_reserved_stock)
|
53
|
+
elsif listing.channel_id == 2
|
54
|
+
qty_simple_params(listing)
|
55
|
+
.merge({shopify_inventory_location: shopify_inventory_location})
|
56
|
+
elsif listing.channel_id == 3
|
57
|
+
qty_simple_params(listing)
|
58
|
+
.merge({lazada_quantity: lazada_quantity})
|
59
|
+
else
|
60
|
+
qty_simple_params(listing)
|
61
|
+
end
|
62
|
+
modes[mode].new(param).perform
|
67
63
|
end.compact
|
68
64
|
end
|
69
65
|
|
@@ -72,8 +68,7 @@ class ItemBuilder
|
|
72
68
|
listing: listing, wh_spaces: wh_spaces, variants: variants,
|
73
69
|
stock_allocs: stock_allocs, variant_listings: variant_listings,
|
74
70
|
bundles: bundles, item_bundle_variants: item_bundle_variants,
|
75
|
-
existing_alloc_stocks: existing_alloc_stocks,
|
76
|
-
reserved_stocks: reserved_stocks, wh_id: wh_id
|
71
|
+
existing_alloc_stocks: existing_alloc_stocks, wh_id: wh_id
|
77
72
|
}
|
78
73
|
end
|
79
74
|
|
@@ -85,7 +80,7 @@ class ItemBuilder
|
|
85
80
|
modes[mode].new(qty_simple_params(listing)).perform
|
86
81
|
elsif listing.channel_id == 18 && mode == :active
|
87
82
|
modes[mode].new(qty_simple_params(listing)
|
88
|
-
.merge(zilingo_quantity: zilingo_quantity)
|
83
|
+
.merge(zilingo_quantity: @zilingo_quantity)
|
89
84
|
).perform
|
90
85
|
else
|
91
86
|
modes[mode].new(listing: listing).perform
|
@@ -181,24 +176,8 @@ class ItemBuilder
|
|
181
176
|
}
|
182
177
|
end
|
183
178
|
|
184
|
-
def order_host
|
185
|
-
url = ENV['ORDERS_URL'] || 'orders.forstok.com'
|
186
|
-
url + '/api/v3/item_line/reserved_stock'
|
187
|
-
end
|
188
|
-
|
189
|
-
def reserved_params
|
190
|
-
"account_id=#{account_id}
|
191
|
-
&item_variant_ids=#{variant_ids.join(',')}"
|
192
|
-
end
|
193
|
-
|
194
|
-
def reserved_stocks
|
195
|
-
@reserved_stocks ||= JSON.parse(RestClient.get(
|
196
|
-
"#{order_host}?#{reserved_params}"
|
197
|
-
).body) if [3].include?(listings[0].channel_id)
|
198
|
-
end
|
199
|
-
|
200
179
|
def wh_mapping
|
201
|
-
wh_mapping ||= WarehouseMapping.where(
|
180
|
+
@wh_mapping ||= WarehouseMapping.where(
|
202
181
|
profile_channel_association_id: account_id
|
203
182
|
).first
|
204
183
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: item_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okaaryanata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|