Class: ItemBuilder::Modes::SimpleService

Inherits:
Object
  • Object
show all
Includes:
ItemBuilder::Modes
Defined in:
lib/item_builder/modes/simple_service.rb

Instance Attribute Summary

Attributes included from ItemBuilder::Modes

#bundles, #existing_alloc_stocks, #item_bundle_variants, #lazada_quantity, #listing, #shipping_providers, #shopify_inventory_location, #stock_allocs, #variant_listings, #variants, #wh_id, #wh_spaces, #zalora_reserved_stock, #zilingo_quantity

Instance Method Summary collapse

Methods included from ItemBuilder::Modes

#base, #bundle, #bundle_variants, #existing_allocated_stock, #initialize, #listings, #stock_alloc, #variant, #warehouse

Instance Method Details

#performObject



11
12
13
# File 'lib/item_builder/modes/simple_service.rb', line 11

def perform
  to_h.merge(base)
end

#priceObject



29
30
31
# File 'lib/item_builder/modes/simple_service.rb', line 29

def price
  PriceService.new(listing: listing).to_h
end

#quantityObject



19
20
21
22
23
24
25
26
27
# File 'lib/item_builder/modes/simple_service.rb', line 19

def quantity
  QuantityService.new(
    listing: listing, wh_spaces: wh_spaces, variants: variants,
    stock_allocs: stock_allocs, variant_listings: variant_listings,
    bundles: bundles, item_bundle_variants: item_bundle_variants,
    existing_alloc_stocks: existing_alloc_stocks,
    zilingo_quantity: zilingo_quantity
  ).to_h
end

#to_hObject



15
16
17
# File 'lib/item_builder/modes/simple_service.rb', line 15

def to_h
  quantity.merge(price)
end