Class: ItemBuilderMwh::Modes::PreconditionCreateService
- Inherits:
-
Object
- Object
- ItemBuilderMwh::Modes::PreconditionCreateService
show all
- Includes:
- ItemBuilderMwh::Modes
- Defined in:
- lib/item_builder_mwh/modes/precondition_create_service.rb
Constant Summary
collapse
- MAP_PRECONDITION_CREATE_CHANNEL =
{}.tap do |hash|
hash[12] = :Shopee
end.freeze
Instance Attribute Summary
#bundles, #existing_alloc_stocks, #item_bundle_variants, #lazada_quantity, #listing, #reserved_stocks, #shipping_providers, #shopify_inventory_location, #stock_allocs, #variant_listings, #variants, #wh_spaces, #zalora_reserved_stock, #zilingo_quantity
Instance Method Summary
collapse
#base, #bundle, #bundle_variants, #credential, #existing_allocated_stock, #initialize, #listings, #multiwarehouse, #pca, #stock_alloc, #variant, #variant_id, #warehouse, #warehouse_list, #warehouse_mapping, #warehouse_spaces, #warehouses, #wh_mapping, #wh_routing
Instance Method Details
#channel_name ⇒ Object
33
34
35
|
# File 'lib/item_builder_mwh/modes/precondition_create_service.rb', line 33
def channel_name
MAP_PRECONDITION_CREATE_CHANNEL[listing.channel_id].to_s
end
|
#map_precondition_create ⇒ Object
27
28
29
30
31
|
# File 'lib/item_builder_mwh/modes/precondition_create_service.rb', line 27
def map_precondition_create
class_name = "ItemBuilderMwh::Modes::PreconditionCreate::#{channel_name}Service"
create_channel_service = class_name.constantize
create_channel_service.new(listing).perform
end
|
15
16
17
|
# File 'lib/item_builder_mwh/modes/precondition_create_service.rb', line 15
def perform
base.merge!(warehouse: warehouses).merge(map_precondition_create)
end
|
#to_h(warehouse_space) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/item_builder_mwh/modes/precondition_create_service.rb', line 19
def to_h(warehouse_space)
{
warehouse_id: warehouse_space.present? ? wh_mapping(
warehouse_space.warehouse_id
) : ''
}
end
|