Module: ItemBuilderMwh

Defined in:
lib/item_builder_mwh.rb,
lib/item_builder_mwh/modes.rb,
lib/item_builder_mwh/version.rb,
lib/item_builder_mwh/modes/base_service.rb,
lib/item_builder_mwh/modes/price_service.rb,
lib/item_builder_mwh/modes/active_service.rb,
lib/item_builder_mwh/modes/simple_service.rb,
lib/item_builder_mwh/modes/quantity_service.rb

Defined Under Namespace

Modules: Modes

Constant Summary collapse

VERSION =
'0.1.4'

Class Method Summary collapse

Class Method Details

.build(listing_ids, mode) ⇒ Object



13
14
15
16
17
18
# File 'lib/item_builder_mwh.rb', line 13

def build(listing_ids, mode)
  @mode = mode
  VariantListing.where(id: listing_ids).map do |listing|
    modes[mode].new(listing: listing).perform
  end
end

.modesObject



20
21
22
23
24
25
26
27
# File 'lib/item_builder_mwh.rb', line 20

def modes
  {
    price: ItemBuilderMwh::Modes::PriceService,
    quantity: ItemBuilderMwh::Modes::QuantityService,
    simple: ItemBuilderMwh::Modes::SimpleService,
    active: ItemBuilderMwh::Modes::ActiveService
  }
end