item_builder 0.1.48 → 0.1.49

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: a7466c11e90ea16a599fe729ade0dd42c06a237505f4f167cc6b1d067da23d79
4
- data.tar.gz: 0414a129507a7e55a1fa5ffab08f29b70e10292c856f5c48c4dcfadf4def70f4
3
+ metadata.gz: 1421dc54be5e9e7fb14a672880d344f1bcb43c21d89ab88053698e99c87517c6
4
+ data.tar.gz: c522e0c4f84d85bdf6e3a3b1a8c8b2806547de1493a66d3ea72d0c9e63fef4fd
5
5
  SHA512:
6
- metadata.gz: bc0f76ff7d8572691d6a65d5d1f3016af21f627cbfcd1beabab235e004c3cb53330eac0b7f93dc802ac19ef5cf215a231be240676fdef5545f774b5ba1989f8a
7
- data.tar.gz: 9cdaf496fa275f4a759163a4615e6fab983ffac7587129a38fe23bf9b23173f652c8e2ee0a845bae3824f4c844bbf29d874c6bface83134cd11eb536db37f351
6
+ metadata.gz: 4b19e2cbba75d2071214591d15617f24ac8c40cdf41029f4b0e4cce3d1b1ccb2a5f4354a1fc2d0308caf490a2d065b500c9d092380f0c3e616cdb25c154bb917
7
+ data.tar.gz: 61dfeadba2714e4f4322b7887d559d7cc12748e94cc6b8b31ed74e8aeda0e48f85c0297abb87821c252232839146c7a1ceeaf395c3783e629c90a8b60857a1e8
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ItemBuilder
4
- VERSION = '0.1.48'
4
+ VERSION = '0.1.49'
5
5
  end
data/lib/item_builder.rb CHANGED
@@ -23,6 +23,8 @@ class ItemBuilder
23
23
  attr_reader :wh_spaces
24
24
  attr_reader :variants
25
25
  attr_reader :variant_ids
26
+ attr_reader :wh_mapping
27
+ attr_reader :wh_id
26
28
 
27
29
  def initialize(listing_ids, mode)
28
30
  @listing_ids = listing_ids
@@ -41,29 +43,23 @@ class ItemBuilder
41
43
  listings.map do |listing|
42
44
  next unless listing.local_id.present?
43
45
 
44
- if listing.channel_id == 18
45
- new_param = qty_simple_params(listing)
46
- .merge(zilingo_quantity: zilingo_quantity)
47
-
48
- modes[mode].new(new_param).perform
49
- elsif listing.channel_id == 13
50
- new_param = qty_simple_params(listing)
51
- .merge(zalora_reserved_stock: zalora_reserved_stock)
52
-
53
- modes[mode].new(new_param).perform
54
- elsif listing.channel_id == 2
55
- new_param = qty_simple_params(listing)
56
- .merge({shopify_inventory_location: shopify_inventory_location})
57
-
58
- modes[mode].new(new_param).perform
59
- elsif listing.channel_id == 3
60
- new_param = qty_simple_params(listing)
61
- .merge({lazada_quantity: lazada_quantity})
62
-
63
- modes[mode].new(new_param).perform
64
- else
65
- modes[mode].new(qty_simple_params(listing)).perform
66
- end
46
+ param =
47
+ if listing.channel_id == 18
48
+ qty_simple_params(listing)
49
+ .merge(zilingo_quantity: @zilingo_quantity)
50
+ elsif listing.channel_id == 13
51
+ qty_simple_params(listing)
52
+ .merge(zalora_reserved_stock: @zalora_reserved_stock)
53
+ elsif listing.channel_id == 2
54
+ qty_simple_params(listing)
55
+ .merge({shopify_inventory_location: @shopify_inventory_location})
56
+ elsif listing.channel_id == 3
57
+ qty_simple_params(listing)
58
+ .merge({lazada_quantity: @lazada_quantity})
59
+ else
60
+ qty_simple_params(listing)
61
+ end
62
+ modes[mode].new(param).perform
67
63
  end.compact
68
64
  end
69
65
 
@@ -73,7 +69,7 @@ class ItemBuilder
73
69
  stock_allocs: stock_allocs, variant_listings: variant_listings,
74
70
  bundles: bundles, item_bundle_variants: item_bundle_variants,
75
71
  existing_alloc_stocks: existing_alloc_stocks,
76
- reserved_stocks: reserved_stocks, wh_id: wh_id
72
+ reserved_stocks: reserved_stocks, wh_id: @wh_id
77
73
  }
78
74
  end
79
75
 
@@ -85,7 +81,7 @@ class ItemBuilder
85
81
  modes[mode].new(qty_simple_params(listing)).perform
86
82
  elsif listing.channel_id == 18 && mode == :active
87
83
  modes[mode].new(qty_simple_params(listing)
88
- .merge(zilingo_quantity: zilingo_quantity)
84
+ .merge(zilingo_quantity: @zilingo_quantity)
89
85
  ).perform
90
86
  else
91
87
  modes[mode].new(listing: listing).perform
@@ -198,7 +194,7 @@ class ItemBuilder
198
194
  end
199
195
 
200
196
  def wh_mapping
201
- wh_mapping ||= WarehouseMapping.where(
197
+ @wh_mapping ||= WarehouseMapping.where(
202
198
  profile_channel_association_id: account_id
203
199
  ).first
204
200
  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.48
4
+ version: 0.1.49
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-20 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler