Class: ItemBuilder::Modes::UpdateService
- Inherits:
-
Object
- Object
- ItemBuilder::Modes::UpdateService
- 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
Attributes included from ItemBuilder::Modes
Instance Method Summary collapse
- #channel_name ⇒ Object
- #item_listing ⇒ Object
- #perform ⇒ Object
- #simple ⇒ Object
- #to_h ⇒ Object
- #update ⇒ Object
Methods included from ItemBuilder::Modes
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 |
#perform ⇒ Object
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 |