item_builder 0.1.50 → 0.1.54
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.
- checksums.yaml +4 -4
- data/lib/item_builder/get_quantity_service.rb +1 -1
- 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 +4 -23
- 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: bfd319426fec6999bddb4965e9b902936e46b6264417a18b3aa438234230d121
|
|
4
|
+
data.tar.gz: 726c9ce636119da30b8ad236d60438d0324224a53ba81f6277b80100fecf7fd8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bcdc6e0c12a6a254fa8e9b92c10b6f121c90639f813dbd09e01fd7e574afe51621bdfc90380166ca2e04de01bfb3ffa33420be4a33881fdd0182e150f97dce0
|
|
7
|
+
data.tar.gz: 84ab5573f0a7b92cc787a2dcc8409e3e42d312ecd7376b3079c7ac8c66a857fc34fb0f477f42b90ada603ed398f5a01570225c6ce4b65886500831dfc1bc3ebc
|
|
@@ -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
|
@@ -68,8 +68,7 @@ class ItemBuilder
|
|
|
68
68
|
listing: listing, wh_spaces: wh_spaces, variants: variants,
|
|
69
69
|
stock_allocs: stock_allocs, variant_listings: variant_listings,
|
|
70
70
|
bundles: bundles, item_bundle_variants: item_bundle_variants,
|
|
71
|
-
existing_alloc_stocks: existing_alloc_stocks,
|
|
72
|
-
reserved_stocks: reserved_stocks, wh_id: @wh_id
|
|
71
|
+
existing_alloc_stocks: existing_alloc_stocks, wh_id: wh_id
|
|
73
72
|
}
|
|
74
73
|
end
|
|
75
74
|
|
|
@@ -92,7 +91,7 @@ class ItemBuilder
|
|
|
92
91
|
def existing_alloc_stocks
|
|
93
92
|
@existing_alloc_stocks ||= VariantListingStockAllocation.where(
|
|
94
93
|
variant_association_id: vl_ids
|
|
95
|
-
).where('
|
|
94
|
+
).where('end_at >= NOW()')
|
|
96
95
|
end
|
|
97
96
|
|
|
98
97
|
def vl_ids
|
|
@@ -124,7 +123,7 @@ class ItemBuilder
|
|
|
124
123
|
end
|
|
125
124
|
|
|
126
125
|
def wh_spaces
|
|
127
|
-
@wh_spaces ||= WarehouseSpace.where(item_variant_id: variant_ids)
|
|
126
|
+
@wh_spaces ||= WarehouseSpace.where(item_variant_id: variant_ids).where.not(warehouse_id: nil)
|
|
128
127
|
end
|
|
129
128
|
|
|
130
129
|
def variants
|
|
@@ -162,9 +161,7 @@ class ItemBuilder
|
|
|
162
161
|
end
|
|
163
162
|
|
|
164
163
|
def lazada_quantity
|
|
165
|
-
@lazada_quantity ||=
|
|
166
|
-
listings: listings, skus: skus
|
|
167
|
-
).perform
|
|
164
|
+
@lazada_quantity ||= nil
|
|
168
165
|
end
|
|
169
166
|
|
|
170
167
|
def modes
|
|
@@ -177,22 +174,6 @@ class ItemBuilder
|
|
|
177
174
|
}
|
|
178
175
|
end
|
|
179
176
|
|
|
180
|
-
def order_host
|
|
181
|
-
url = ENV['ORDERS_URL'] || 'orders.forstok.com'
|
|
182
|
-
url + '/api/v3/item_line/reserved_stock'
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
def reserved_params
|
|
186
|
-
"account_id=#{account_id}
|
|
187
|
-
&item_variant_ids=#{variant_ids.join(',')}"
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
def reserved_stocks
|
|
191
|
-
@reserved_stocks ||= JSON.parse(RestClient.get(
|
|
192
|
-
"#{order_host}?#{reserved_params}"
|
|
193
|
-
).body) if [3].include?(listings[0].channel_id)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
177
|
def wh_mapping
|
|
197
178
|
@wh_mapping ||= WarehouseMapping.where(
|
|
198
179
|
profile_channel_association_id: account_id
|
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.54
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- okaaryanata
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|