Class: SpreeCmCommissioner::Integrations::Larryta::SyncStrategies::FullSyncStrategy

Inherits:
Object
  • Object
show all
Defined in:
app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/full_sync_strategy.rb

Overview

Full sync strategy for Larryta integration

This strategy performs a complete synchronization of all data from Larryta:

  1. Sync all directions (routes)

  2. Sync all schedules for each direction

  3. Sync seat availability for each schedule

This is typically run once when setting up the integration or when performing a full refresh of all data.

Instance Method Summary collapse

Constructor Details

#initialize(integration:, routes: nil) ⇒ FullSyncStrategy

Returns a new instance of FullSyncStrategy.



12
13
14
15
16
# File 'app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/full_sync_strategy.rb', line 12

def initialize(integration:, routes: nil)
  @integration = integration
  @custom_routes = routes
  @sync_result = ::SpreeCmCommissioner::Integrations::Base::SyncResult.new
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
# File 'app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/full_sync_strategy.rb', line 18

def call
  sync_routes!
  sync_all_trips!

  @sync_result
rescue StandardError => e
  @sync_result.record_error(e)
  @sync_result
end