item_builder 0.1.46 → 0.1.47
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/modes.rb +7 -1
- data/lib/item_builder/version.rb +1 -1
- data/lib/item_builder.rb +16 -2
- 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: 98c440176871d006bbd1ab07292696d7e779cffa64bdf097afcdcbb7fc9cb986
|
4
|
+
data.tar.gz: 1f3a2607695baa0e5d8767c06c6a007554d02c9390de6a597267871789dafcf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ad9a187205d4b5b8dab861d4b6e90261fc2348c90eabb8eb058bb944ab18b62508873b381effcb969c6600bc3657742ac615070a39e85be0cb2b33f2be8271
|
7
|
+
data.tar.gz: 35c72c9bbe5b5636c5494b0d72ff7fa54337383206c5f8b9b870ec647737164bcfcb4609f17bbfa9ce4fd73f3b259288f2df91958900f0c6dc0ba5d05ed9dd30
|
data/lib/item_builder/modes.rb
CHANGED
@@ -21,6 +21,7 @@ class ItemBuilder
|
|
21
21
|
attr_reader :lazada_quantity
|
22
22
|
attr_reader :zalora_reserved_stock
|
23
23
|
attr_reader :shopify_inventory_location
|
24
|
+
attr_reader :wh_id
|
24
25
|
def initialize(args)
|
25
26
|
@listing = args.fetch(:listing)
|
26
27
|
@wh_spaces = args.fetch(:wh_spaces, [])
|
@@ -35,6 +36,7 @@ class ItemBuilder
|
|
35
36
|
@lazada_quantity = args.fetch(:lazada_quantity, [])
|
36
37
|
@zalora_reserved_stock = args.fetch(:zalora_reserved_stock, [])
|
37
38
|
@shopify_inventory_location = args.fetch(:shopify_inventory_location, [])
|
39
|
+
@wh_id = args.fetch(:wh_id, [])
|
38
40
|
end
|
39
41
|
|
40
42
|
def base
|
@@ -73,7 +75,11 @@ class ItemBuilder
|
|
73
75
|
end
|
74
76
|
|
75
77
|
def warehouse
|
76
|
-
|
78
|
+
if wh_id.present?
|
79
|
+
wh_spaces.where(warehouse_id: wh_id).first
|
80
|
+
else
|
81
|
+
wh_spaces.select { |ws| ws.item_variant_id == listing.variant_id }.first
|
82
|
+
end
|
77
83
|
end
|
78
84
|
|
79
85
|
def variant
|
data/lib/item_builder/version.rb
CHANGED
data/lib/item_builder.rb
CHANGED
@@ -73,7 +73,7 @@ class ItemBuilder
|
|
73
73
|
stock_allocs: stock_allocs, variant_listings: variant_listings,
|
74
74
|
bundles: bundles, item_bundle_variants: item_bundle_variants,
|
75
75
|
existing_alloc_stocks: existing_alloc_stocks,
|
76
|
-
reserved_stocks: reserved_stocks
|
76
|
+
reserved_stocks: reserved_stocks, wh_id: wh_id
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
@@ -187,7 +187,7 @@ class ItemBuilder
|
|
187
187
|
end
|
188
188
|
|
189
189
|
def reserved_params
|
190
|
-
"account_id=#{
|
190
|
+
"account_id=#{account_id}
|
191
191
|
&item_variant_ids=#{variant_ids.join(',')}"
|
192
192
|
end
|
193
193
|
|
@@ -196,4 +196,18 @@ class ItemBuilder
|
|
196
196
|
"#{order_host}?#{reserved_params}"
|
197
197
|
).body) if [3].include?(listings[0].channel_id)
|
198
198
|
end
|
199
|
+
|
200
|
+
def wh_mapping
|
201
|
+
wh_mapping ||= WarehouseMapping.where(
|
202
|
+
profile_channel_association_id: account_id
|
203
|
+
).first
|
204
|
+
end
|
205
|
+
|
206
|
+
def account_id
|
207
|
+
account_id ||= listings[0].profile_channel_association_id
|
208
|
+
end
|
209
|
+
|
210
|
+
def wh_id
|
211
|
+
@wh_id ||= wh_mapping&.warehouse_id
|
212
|
+
end
|
199
213
|
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.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okaaryanata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|