Class: Vendors::Bistrochat::RestaurantInventorySyncWorker

Inherits:
ApplicationWorker
  • Object
show all
Defined in:
app/workers/vendors/bistrochat/restaurant_inventory_sync_worker.rb

Overview

Sidekiq worker for syncing bistrochat restaurant inventory.

This worker delegates all business logic to VendorsService::InventorySync::RestaurantService, passing the supplier as 'bistrochat'. It sets business context for logging and triggers the service.

All inventory sync logic, error handling, and instrumentation are handled in the service.

Examples:

Input

perform(123, "2025-01-15", "2025-01-20")
perform(456, "2025-01-15") # end_date defaults to start_date

Output

Returns result from VendorsService::InventorySync::RestaurantService#call
true on success, raises exception on failure

See Also:

Instance Method Summary collapse

Instance Method Details

#perform(restaurant_id, start_date, end_date = start_date) ⇒ Boolean

Performs inventory sync for a Bistrochat restaurant

Parameters:

  • restaurant_id (Integer)

    The restaurant ID to sync

  • start_date (String)

    Start date in YYYY-MM-DD format

  • end_date (String) (defaults to: start_date)

    End date in YYYY-MM-DD format (defaults to start_date)

Returns:

  • (Boolean)

    true on success

Raises:

  • (StandardError)

    if sync fails



30
31
32
33
34
35
36
37
# File 'app/workers/vendors/bistrochat/restaurant_inventory_sync_worker.rb', line 30

def perform(restaurant_id, start_date, end_date = start_date)
  VendorsService::InventorySync::RestaurantService.new(
    restaurant_id: restaurant_id,
    start_date: start_date,
    end_date: end_date,
    supplier: :bistrochat,
  ).call
end