Class: SpreeCmCommissioner::Integrations::Polling

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree_cm_commissioner/integrations/polling.rb

Instance Method Summary collapse

Instance Method Details

#call(integration:, sync_type:, event_type: nil, event_data: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/spree_cm_commissioner/integrations/polling.rb', line 4

def call(integration:, sync_type:, event_type: nil, event_data: nil)
  sync_manager = integration.sync_manager

  case sync_type.to_sym
  when :full
    perform_full_sync!(sync_manager, integration)
  when :incremental
    perform_incremental_sync!(sync_manager, integration)
  when :webhook_triggered
    perform_webhook_sync!(sync_manager, integration, event_type, event_data)
  else
    raise ArgumentError, "Unknown sync type: #{sync_type}"
  end
end