Class: TinyBuilder::BaseBuilder
- Inherits:
-
Object
- Object
- TinyBuilder::BaseBuilder
- Includes:
- DataLoader, QuantityHelper
- Defined in:
- lib/tiny_builder/base_builder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#channel_id ⇒ Object
readonly
Returns the value of attribute channel_id.
-
#inventory_v2 ⇒ Object
readonly
Returns the value of attribute inventory_v2.
-
#listings ⇒ Object
readonly
Returns the value of attribute listings.
-
#mwh ⇒ Object
readonly
Returns the value of attribute mwh.
Instance Method Summary collapse
-
#initialize(args) ⇒ BaseBuilder
constructor
A new instance of BaseBuilder.
- #perform ⇒ Object
Methods included from QuantityHelper
#bundle_warehouse_spaces, #counter_params, #multi_warehouse_spaces, #quantity, #quantity_hash, #single_warehouse_space, #warehouse_quantities, #wh_spaces
Methods included from DataLoader
#account_id, #associated_listings, #associated_stock_allocations, #associated_stock_allocs, #collect_associated_listings, #collect_variants_data, #get_mongo_wh_spaces, #get_warehouse_spaces, #listing_warehouse_spaces, #mapped_data, #mapped_wh_mappings, #stock_alloc, #stock_allocations, #variant_ids, #variants, #warehouse_mapping, #warehouse_mappings, #warehouse_spaces
Constructor Details
#initialize(args) ⇒ BaseBuilder
Returns a new instance of BaseBuilder.
17 18 19 20 21 22 |
# File 'lib/tiny_builder/base_builder.rb', line 17 def initialize(args) @listings = args[:listings] @mwh = args[:mwh] @channel_id = args[:channel_id] @inventory_v2 = args[:inventory_v2] end |
Instance Attribute Details
#channel_id ⇒ Object (readonly)
Returns the value of attribute channel_id.
14 15 16 |
# File 'lib/tiny_builder/base_builder.rb', line 14 def channel_id @channel_id end |
#inventory_v2 ⇒ Object (readonly)
Returns the value of attribute inventory_v2.
15 16 17 |
# File 'lib/tiny_builder/base_builder.rb', line 15 def inventory_v2 @inventory_v2 end |
#listings ⇒ Object (readonly)
Returns the value of attribute listings.
12 13 14 |
# File 'lib/tiny_builder/base_builder.rb', line 12 def listings @listings end |
#mwh ⇒ Object (readonly)
Returns the value of attribute mwh.
13 14 15 |
# File 'lib/tiny_builder/base_builder.rb', line 13 def mwh @mwh end |
Instance Method Details
#perform ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tiny_builder/base_builder.rb', line 24 def perform listings.map do |listing| { id: listing.icava_id, local_id: listing.local_id, local_item_id: listing.local_item_id, sku: listing[:sku], variant_id: listing.master_variant_id }.merge(to_h(listing)) end end |