Class: ItemBuilder::Modes::ActiveService

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

Instance Attribute Summary

Attributes included from ItemBuilder::Modes

#bundles, #existing_alloc_stocks, #item_bundle_variants, #listing, #reserved_stocks, #stock_allocs, #variant_listings, #variants, #wh_spaces

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

#active_variantObject



20
21
22
23
24
# File 'lib/item_builder/modes/active_service.rb', line 20

def active_variant
  VariantListing
    .where(local_item_id: listing.local_item_id,
           active: 1)
end

#performObject



9
10
11
# File 'lib/item_builder/modes/active_service.rb', line 9

def perform
  to_h.merge(base)
end

#to_hObject



13
14
15
16
17
18
# File 'lib/item_builder/modes/active_service.rb', line 13

def to_h
  {
    active: listing.active,
    active_variant: active_variant.count
  }
end