item_builder 0.1.43 → 0.1.44
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20043fbc1916ef6f98c6429d101469353b46a0d9f8106be6ea94193a685aeb84
|
4
|
+
data.tar.gz: d4a1aefc9f150740af16fad42a5734088e3f584ce6b896a2c4b6b645fe4d629d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 692cf4418adce24b9ff97045629804663b4043bf6bcf1305b87037f084d819b5d111a3674e79e1f4140e6aabe49d4107db13d94cebe2fe8fb4103ea785315f45
|
7
|
+
data.tar.gz: 1fc6d2ecb1425e180a7a069ca7f227fbb472664b50688be36176d5590e6ffa86d8ff4cc165eb3833df8d438fcf154f38bcab24e9a1bce199340feeaa8cb05ca9
|
@@ -20,7 +20,9 @@ class ItemBuilder
|
|
20
20
|
|
21
21
|
def perform
|
22
22
|
if channel_name == "Shopify"
|
23
|
-
|
23
|
+
dataSIL = shopify_inventory_location[listing.local_id]
|
24
|
+
|
25
|
+
base.merge(to_h, dataSIL) if dataSIL.present?
|
24
26
|
else
|
25
27
|
to_h.merge(base)
|
26
28
|
end
|
@@ -13,11 +13,15 @@ class ItemBuilder
|
|
13
13
|
|
14
14
|
def perform
|
15
15
|
datas = {}
|
16
|
-
|
17
16
|
@listings.each do |listing|
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
21
25
|
end
|
22
26
|
|
23
27
|
# update variant real_local_id database icava
|
@@ -98,8 +102,12 @@ class ItemBuilder
|
|
98
102
|
def response_process
|
99
103
|
hash = Hash.new
|
100
104
|
|
101
|
-
|
102
|
-
|
105
|
+
begin
|
106
|
+
hash[:inventory_item_id] = inventory_item_id.to_i
|
107
|
+
hash[:location_id] = location_id.to_i
|
108
|
+
rescue
|
109
|
+
hash
|
110
|
+
end
|
103
111
|
|
104
112
|
hash
|
105
113
|
end
|
@@ -107,8 +115,9 @@ class ItemBuilder
|
|
107
115
|
def rest_client(params, rescued_codes = 200)
|
108
116
|
RestClient::Request.execute(params.merge(timeout: 3)) do |response|
|
109
117
|
code = response.code
|
118
|
+
resp = response.body.to_str
|
110
119
|
unless Array.wrap(rescued_codes).include?(code)
|
111
|
-
raise "Response Code is #{code}"
|
120
|
+
raise "Response Code is #{code}" unless resp.include?('Response code = 404')
|
112
121
|
end
|
113
122
|
|
114
123
|
response
|
data/lib/item_builder/version.rb
CHANGED
data/lib/item_builder.rb
CHANGED
@@ -38,6 +38,8 @@ class ItemBuilder
|
|
38
38
|
|
39
39
|
def quantity_simple_mode
|
40
40
|
listings.map do |listing|
|
41
|
+
next unless listing.local_id.present?
|
42
|
+
|
41
43
|
if listing.channel_id == 18
|
42
44
|
new_param = qty_simple_params(listing)
|
43
45
|
.merge(zilingo_quantity: zilingo_quantity)
|
@@ -56,7 +58,7 @@ class ItemBuilder
|
|
56
58
|
else
|
57
59
|
modes[mode].new(qty_simple_params(listing)).perform
|
58
60
|
end
|
59
|
-
end
|
61
|
+
end.compact
|
60
62
|
end
|
61
63
|
|
62
64
|
def qty_simple_params(listing)
|
@@ -71,6 +73,8 @@ class ItemBuilder
|
|
71
73
|
|
72
74
|
def default
|
73
75
|
listings.map do |listing|
|
76
|
+
next unless listing.local_id.present?
|
77
|
+
|
74
78
|
if listing.channel_id == 2 && mode == :active
|
75
79
|
modes[mode].new(qty_simple_params(listing)).perform
|
76
80
|
elsif listing.channel_id == 18 && mode == :active
|
@@ -130,7 +134,7 @@ class ItemBuilder
|
|
130
134
|
end
|
131
135
|
|
132
136
|
def listings
|
133
|
-
@listings ||= VariantListing.where(id: listing_ids)
|
137
|
+
@listings ||= VariantListing.joins(:variant).where(id: listing_ids)
|
134
138
|
end
|
135
139
|
|
136
140
|
def skus
|
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.44
|
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-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
|