Class: ItemBuilder::Modes::UpdateService
- Inherits:
-
Object
- Object
- ItemBuilder::Modes::UpdateService
show all
- Includes:
- ItemBuilder::Modes
- Defined in:
- lib/item_builder/modes/update_service.rb
Constant Summary
collapse
- UPDATE_CHANNEL =
{}.tap do |hash|
hash[2] = :Shopify
hash[3] = :Lazada
hash[4] = :Bhinneka
hash[5] = :Blanja
hash[9] = :Blibli
hash[11] = :Bukalapak
hash[12] = :Shopee
hash[13] = :Zalora
hash[15] = :Tokopedia
hash[16] = :Jd
end.freeze
Instance Attribute Summary
#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
#base, #bundle, #bundle_variants, #existing_allocated_stock, #initialize, #listings, #stock_alloc, #variant, #warehouse
Instance Method Details
#channel_name ⇒ Object
43
44
45
|
# File 'lib/item_builder/modes/update_service.rb', line 43
def channel_name
UPDATE_CHANNEL[listing.channel_id].to_s
end
|
#item_listing ⇒ Object
51
52
53
|
# File 'lib/item_builder/modes/update_service.rb', line 51
def item_listing
@item_listing ||= ItemListing.find(listing.channel_association_id)
end
|
29
30
31
|
# File 'lib/item_builder/modes/update_service.rb', line 29
def perform
to_h.merge(base)
end
|
#simple ⇒ Object
47
48
49
|
# File 'lib/item_builder/modes/update_service.rb', line 47
def simple
SimpleService.new(listing: listing).to_h
end
|
#to_h ⇒ Object
33
34
35
|
# File 'lib/item_builder/modes/update_service.rb', line 33
def to_h
simple.merge(update)
end
|
#update ⇒ Object
37
38
39
40
41
|
# File 'lib/item_builder/modes/update_service.rb', line 37
def update
class_name = "ItemBuilder::Modes::Update::#{channel_name}Service"
update_channel_service = class_name.constantize
update_channel_service.new(listing, item_listing).perform
end
|