Class: ItemBuilder::Modes::ActiveService
- Inherits:
-
Object
- Object
- ItemBuilder::Modes::ActiveService
show all
- Includes:
- ItemBuilder::Modes
- Defined in:
- lib/item_builder/modes/active_service.rb
Instance Attribute Summary
#bundles, #existing_alloc_stocks, #item_bundle_variants, #listing, #reserved_stocks, #stock_allocs, #variant_listings, #variants, #wh_spaces, #zalora_reserved_stock, #zilingo_delta_quantity
Instance Method Summary
collapse
#base, #bundle, #bundle_variants, #existing_allocated_stock, #initialize, #listings, #stock_alloc, #variant, #warehouse
Instance Method Details
#active_variant ⇒ Object
37
38
39
40
41
|
# File 'lib/item_builder/modes/active_service.rb', line 37
def active_variant
VariantListing
.where(local_item_id: listing.local_item_id,
active: 1)
end
|
10
11
12
13
14
15
16
|
# File 'lib/item_builder/modes/active_service.rb', line 10
def perform
if listing.channel_id == 2
to_h.merge(base).merge(quantity)
else
to_h.merge(base)
end
end
|
#quantity ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/item_builder/modes/active_service.rb', line 25
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,
reserved_stocks: reserved_stocks,
zilingo_delta_quantity: zilingo_delta_quantity,
zalora_reserved_stock: zalora_reserved_stock
).to_h
end
|
#to_h ⇒ Object
18
19
20
21
22
23
|
# File 'lib/item_builder/modes/active_service.rb', line 18
def to_h
{
active: listing.active,
active_variant: active_variant.count
}
end
|