item_builder_mwh 0.1.25 → 0.1.26
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e01aa6ef954cf51bc3dcb92ca26f17d430c4ea1fc51d4ef8c90fecfc990f0fd
|
|
4
|
+
data.tar.gz: f11f2141638776fa7aa54fed48488b4b5435288dcd9367290d51443963d2434b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fff1385a38d7539f9ecf9776fb3fd2d6bc06047035cae7f529b9e5f11bb4de9107a21b1dca457a579d3fb6b59bcec691b0b5799b37ef5e98a40d45cb96e4982
|
|
7
|
+
data.tar.gz: 5e8dea305c73d37530197d3506d5f9a697c35e4690281d96465e93b0f65d59ad73f8ca20897fae1bdcc4ccee0b10f600d419968a7f596aeb977cafa06d305f03
|
|
@@ -21,7 +21,9 @@ class ItemBuilderMwh
|
|
|
21
21
|
|
|
22
22
|
def perform
|
|
23
23
|
if channel_name == "Shopify"
|
|
24
|
-
|
|
24
|
+
dataSIL = shopify_inventory_location[listing.local_id]
|
|
25
|
+
|
|
26
|
+
base.merge!(dataSIL, warehouse: warehouses ) if dataSIL.present?
|
|
25
27
|
else
|
|
26
28
|
base.merge!(
|
|
27
29
|
warehouse: warehouses
|
|
@@ -31,7 +33,7 @@ class ItemBuilderMwh
|
|
|
31
33
|
|
|
32
34
|
def to_h(warehouse_space)
|
|
33
35
|
if channel_name == "Zilingo"
|
|
34
|
-
{
|
|
36
|
+
{
|
|
35
37
|
quantity: qty(warehouse_space.quantity),
|
|
36
38
|
warehouse_id: wh_mapping(
|
|
37
39
|
warehouse_space.warehouse_id
|
|
@@ -14,9 +14,14 @@ class ItemBuilderMwh
|
|
|
14
14
|
def perform
|
|
15
15
|
datas = {}
|
|
16
16
|
@listings.each do |listing|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
if listing.local_id.present?
|
|
18
|
+
@listing = listing
|
|
19
|
+
@sku = listing.local_id
|
|
20
|
+
resp = response_process
|
|
21
|
+
next if resp[:inventory_item_id].nil? || resp[:inventory_item_id] == 0
|
|
22
|
+
|
|
23
|
+
datas[@sku] = resp
|
|
24
|
+
end
|
|
20
25
|
end
|
|
21
26
|
|
|
22
27
|
# update variant real_local_id database icava
|
|
@@ -100,8 +105,12 @@ class ItemBuilderMwh
|
|
|
100
105
|
def response_process
|
|
101
106
|
hash = Hash.new
|
|
102
107
|
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
begin
|
|
109
|
+
hash[:inventory_item_id] = inventory_item_id.to_i
|
|
110
|
+
hash[:location_id] = location_id.to_i
|
|
111
|
+
rescue
|
|
112
|
+
hash
|
|
113
|
+
end
|
|
105
114
|
|
|
106
115
|
hash
|
|
107
116
|
end
|
|
@@ -109,8 +118,9 @@ class ItemBuilderMwh
|
|
|
109
118
|
def rest_client(params, rescued_codes = 200)
|
|
110
119
|
RestClient::Request.execute(params.merge(timeout: 3)) do |response|
|
|
111
120
|
code = response.code
|
|
121
|
+
resp = response.body.to_str
|
|
112
122
|
unless Array.wrap(rescued_codes).include?(code)
|
|
113
|
-
raise "Response Code is #{code}"
|
|
123
|
+
raise "Response Code is #{code}" unless resp.include?('Response code = 404')
|
|
114
124
|
end
|
|
115
125
|
|
|
116
126
|
response
|
data/lib/item_builder_mwh.rb
CHANGED
|
@@ -37,6 +37,8 @@ class ItemBuilderMwh
|
|
|
37
37
|
|
|
38
38
|
def quantity_simple_mode
|
|
39
39
|
listings.map do |listing|
|
|
40
|
+
next unless listing.local_id.present?
|
|
41
|
+
|
|
40
42
|
if listing.channel_id == 18
|
|
41
43
|
new_param = qty_simple_params(listing)
|
|
42
44
|
.merge({zilingo_quantity: zilingo_quantity})
|
|
@@ -55,19 +57,21 @@ class ItemBuilderMwh
|
|
|
55
57
|
else
|
|
56
58
|
modes[mode].new(qty_simple_params(listing)).perform
|
|
57
59
|
end
|
|
58
|
-
end
|
|
60
|
+
end.compact
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
def default
|
|
62
64
|
listings.map do |listing|
|
|
63
|
-
if listing.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
if listing.local_id.present?
|
|
66
|
+
if listing.channel_id == 2 && mode == :active
|
|
67
|
+
modes[mode].new(qty_simple_params(listing)).perform
|
|
68
|
+
elsif listing.channel_id == 18 && mode == :active
|
|
69
|
+
modes[mode].new(qty_simple_params(listing)
|
|
70
|
+
.merge(zilingo_quantity: zilingo_quantity)
|
|
71
|
+
).perform
|
|
72
|
+
else
|
|
73
|
+
modes[mode].new(listing: listing).perform
|
|
74
|
+
end
|
|
71
75
|
end
|
|
72
76
|
end
|
|
73
77
|
end
|
|
@@ -176,6 +180,6 @@ class ItemBuilderMwh
|
|
|
176
180
|
end
|
|
177
181
|
|
|
178
182
|
def listings
|
|
179
|
-
@listings ||= VariantListing.where(id: listing_ids)
|
|
183
|
+
@listings ||= VariantListing.joins(:variant).where(id: listing_ids)
|
|
180
184
|
end
|
|
181
185
|
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.
|
|
4
|
+
version: 0.1.26
|
|
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-
|
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
167
|
requirements: []
|
|
168
|
-
rubygems_version: 3.
|
|
168
|
+
rubygems_version: 3.2.3
|
|
169
169
|
signing_key:
|
|
170
170
|
specification_version: 4
|
|
171
171
|
summary: Item Builder Multiwarehouse
|