Class: SpreeCmCommissioner::Integrations::VireakBuntham::SyncStrategies::FullSyncStrategy

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

Overview

Full sync strategy for the Vireak Buntham (VET) integration.

Performs a complete refresh:

  1. Sync all VET locations as Routes (one route per origin/destination pair).

  2. For each Route, sync trips for the next ‘integration.sync_days` days.

This is the initial-setup / daily-refresh path. Incremental sync is used in between to keep availability fresh.

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of FullSyncStrategy.



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

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

Instance Method Details

#callObject



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

def call
  sync_locations!
  sync_routes!
  sync_all_trips!

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