item_builder 0.1.49 → 0.1.53

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: 1421dc54be5e9e7fb14a672880d344f1bcb43c21d89ab88053698e99c87517c6
4
- data.tar.gz: c522e0c4f84d85bdf6e3a3b1a8c8b2806547de1493a66d3ea72d0c9e63fef4fd
3
+ metadata.gz: 8cd29261e6b25a7acbb5f94488ce85924fa3b4afce82806e2ea891332e6cf786
4
+ data.tar.gz: f37ddfdcf5ec23068b5255f86db1151635c60de52739bebea5fe175539775416
5
5
  SHA512:
6
- metadata.gz: 4b19e2cbba75d2071214591d15617f24ac8c40cdf41029f4b0e4cce3d1b1ccb2a5f4354a1fc2d0308caf490a2d065b500c9d092380f0c3e616cdb25c154bb917
7
- data.tar.gz: 61dfeadba2714e4f4322b7887d559d7cc12748e94cc6b8b31ed74e8aeda0e48f85c0297abb87821c252232839146c7a1ceeaf395c3783e629c90a8b60857a1e8
6
+ metadata.gz: 5cb2926ee7d40a8bf59802e4f7175de04952f20ab81c0e282f85f47e0a6764bba49c5ec34639ea9b80d882a1a4acc6764d318d9addb758401068bac0c3633c13
7
+ data.tar.gz: 8ee2e45e0f6a3dabe78f9e291e5da34d42c69825690075872ef4e58d7db9ab395564c7b8ec15737a300aa54193a1315a62569047e545422445554c7952992908
@@ -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
@@ -6,7 +6,7 @@ class ItemBuilder
6
6
  module Quantity
7
7
  class LazadaService < Base
8
8
  def perform
9
- available_quantity + local_qty
9
+ available_quantity
10
10
  end
11
11
  end
12
12
  end
@@ -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
@@ -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, [])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ItemBuilder
4
- VERSION = '0.1.49'
4
+ VERSION = '0.1.53'
5
5
  end
data/lib/item_builder.rb CHANGED
@@ -46,16 +46,16 @@ class ItemBuilder
46
46
  param =
47
47
  if listing.channel_id == 18
48
48
  qty_simple_params(listing)
49
- .merge(zilingo_quantity: @zilingo_quantity)
49
+ .merge(zilingo_quantity: zilingo_quantity)
50
50
  elsif listing.channel_id == 13
51
51
  qty_simple_params(listing)
52
- .merge(zalora_reserved_stock: @zalora_reserved_stock)
52
+ .merge(zalora_reserved_stock: zalora_reserved_stock)
53
53
  elsif listing.channel_id == 2
54
54
  qty_simple_params(listing)
55
- .merge({shopify_inventory_location: @shopify_inventory_location})
55
+ .merge({shopify_inventory_location: shopify_inventory_location})
56
56
  elsif listing.channel_id == 3
57
57
  qty_simple_params(listing)
58
- .merge({lazada_quantity: @lazada_quantity})
58
+ .merge({lazada_quantity: lazada_quantity})
59
59
  else
60
60
  qty_simple_params(listing)
61
61
  end
@@ -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('ADDTIME(end_at, "07:00") >= NOW()')
94
+ ).where('end_at >= NOW()')
96
95
  end
97
96
 
98
97
  def vl_ids
@@ -162,9 +161,7 @@ class ItemBuilder
162
161
  end
163
162
 
164
163
  def lazada_quantity
165
- @lazada_quantity ||= ItemBuilder::LazadaQuantityService.new(
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.49
4
+ version: 0.1.53
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-27 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler