tiny_builder 0.1.6 → 0.1.7

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: 3977c3ed1c2cd0396bc07760080044ed2a79167511bd63b2a4e9f4bc825beb5c
4
- data.tar.gz: 9e48aa4f5e50f7cde772ad7f266edb4126e2e5687eeb28e791cab6d2673cd134
3
+ metadata.gz: e20c10255db94b0cf6230a515694e43f4610ac3831fc74156fe35569cc08eeec
4
+ data.tar.gz: 4488169a21ca18332eb190ff34bf359a2b1fd1790567574235133d8bda486262
5
5
  SHA512:
6
- metadata.gz: ae5fd181df5161ecc3b89c911cfcf25cfc9bd6ee17ded1d3645db0fedb8a94f022f3293ecca174d39de9044bcc987b024247c220ce65bfefc26ae85baf77fde0
7
- data.tar.gz: 884060fc2e0aefe72572a27327cba1685846a59acfe1a16e4f78ea79016e8d88e3126c4f507572bb868d2533bfff1a5d6ebba9188e7122f368f733f3a198b77b
6
+ metadata.gz: e96b6ee2cf58f9a104298d30ab1d96881a8d559029daff97a766cf7e91268848759f32b8274a28a42f62624b772b998a0148e66950dbccdff8b05d5ffca6c270
7
+ data.tar.gz: 3311798b4728533192c05f00670f8d02eefae4c4b380370a9002a4e969663496e6fea0a323c8939bda8922ac6e682ee0286ec447abfbf62ca76f828bb2a88631
@@ -7,7 +7,7 @@ class MongoVariantListing
7
7
  store_in collection: 'variant_listings'
8
8
 
9
9
  def local_item_id
10
- item_listing&.local_id
10
+ item_listing&.local_id rescue local_id
11
11
  end
12
12
 
13
13
  def item_listing
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Allocation
4
+ include Mongoid::Document
5
+ include Mongoid::Attributes::Dynamic
6
+
7
+ store_in collection: 'warehouse_space_allocations', client: 'inventory'
8
+
9
+ belongs_to :warehouse_space, class_name: 'MongoWarehouseSpace'
10
+ end
@@ -45,7 +45,7 @@ class TinyBuilder
45
45
 
46
46
  def collect_associated_listings
47
47
  data = []
48
- MongoVariantListing.in(master_variant_id: variant_ids).each do |listing|
48
+ MongoVariantListing.in(master_variant_id: variant_ids).where(:local_id.exists => true).each do |listing|
49
49
  begin
50
50
  listing.icava_id
51
51
  data << listing
@@ -83,7 +83,7 @@ class TinyBuilder
83
83
  ]
84
84
  end.to_h
85
85
  end
86
-
86
+
87
87
  def get_mongo_wh_spaces
88
88
  spaces = []
89
89
  MongoWarehouseSpace.in(item_variant_id: variant_ids).where(:warehouse_id.exists => true).each do |ws|
@@ -22,11 +22,12 @@ class TinyBuilder
22
22
  end
23
23
 
24
24
  def warehouse_prices(listing)
25
- [
25
+ multi_warehouse_spaces(listing).map do |wh_space|
26
26
  {
27
- warehouse_id: 'no-wh-for-price'
27
+ id: wh_space&.warehouse_id,
28
+ warehouse_id: mapped_wh_mappings[wh_space.warehouse_id]
28
29
  }.merge(price_hash(listing))
29
- ]
30
+ end
30
31
  end
31
32
 
32
33
  def sale_price(listing)
@@ -19,6 +19,8 @@ class TinyBuilder
19
19
  end
20
20
 
21
21
  def perform
22
+ return 0 unless listing.active
23
+
22
24
  warehouse_stock
23
25
  end
24
26
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TinyBuilder
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - hayakaza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,6 +137,7 @@ files:
137
137
  - lib/tiny_builder.rb
138
138
  - lib/tiny_builder/active_builder.rb
139
139
  - lib/tiny_builder/allocated_stock.rb
140
+ - lib/tiny_builder/allocation.rb
140
141
  - lib/tiny_builder/apigateway_helper.rb
141
142
  - lib/tiny_builder/base_builder.rb
142
143
  - lib/tiny_builder/data_loader.rb