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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85cdb400a2a96b3ec48a7c3595dc11cd6c98bab1c22057b603697482981496d8
4
- data.tar.gz: a6f283e3c3670a6d190846c3b0951d8ef5847e5f5e17ca39789c1d2b65cf06eb
3
+ metadata.gz: bfd319426fec6999bddb4965e9b902936e46b6264417a18b3aa438234230d121
4
+ data.tar.gz: 726c9ce636119da30b8ad236d60438d0324224a53ba81f6277b80100fecf7fd8
5
5
  SHA512:
6
- metadata.gz: 542f97bacef6a7cab57a646d9b919bc09b025eb893e6063095d644641469610436d82f6e6176b33fcb8808c65a6a19206f5dfe94ca00b9c6030622859d26e1bd
7
- data.tar.gz: 416d6c22f105c24ea3e943fdef89495342fc2f654ba719bed64d2612480a4b9fcff9ed53ab6c96554886578a667a6eb5992d550a7bca7cfabb925ae4786cc387
6
+ metadata.gz: 8bcdc6e0c12a6a254fa8e9b92c10b6f121c90639f813dbd09e01fd7e574afe51621bdfc90380166ca2e04de01bfb3ffa33420be4a33881fdd0182e150f97dce0
7
+ data.tar.gz: 84ab5573f0a7b92cc787a2dcc8409e3e42d312ecd7376b3079c7ac8c66a857fc34fb0f477f42b90ada603ed398f5a01570225c6ce4b65886500831dfc1bc3ebc
@@ -91,7 +91,7 @@ class ItemBuilder
91
91
  end
92
92
 
93
93
  def wh_space
94
- @wh_space ||= WarehouseSpace.where(item_variant_id: variant_ids)
94
+ @wh_space ||= WarehouseSpace.where(item_variant_id: variant_ids).where.not(warehouse_id: nil)
95
95
  end
96
96
 
97
97
  def variant_ids
@@ -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.50'
4
+ VERSION = '0.1.54'
5
5
  end
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('ADDTIME(end_at, "07:00") >= NOW()')
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 ||= 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.50
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: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler