Class: SpreeCmCommissioner::Integrations::Larryta::SyncStrategies::IncrementalSyncStrategy
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::Larryta::SyncStrategies::IncrementalSyncStrategy
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/incremental_sync_strategy.rb
Overview
Incremental sync strategy for Larryta integration
This strategy performs incremental synchronization to keep data fresh:
-
Find routes that haven’t been synced recently
-
Sync schedules for today and tomorrow
-
Update seat availability
This runs frequently (every few minutes) to keep availability data up-to-date without doing a full sync each time.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(integration:) ⇒ IncrementalSyncStrategy
constructor
A new instance of IncrementalSyncStrategy.
Constructor Details
#initialize(integration:) ⇒ IncrementalSyncStrategy
Returns a new instance of IncrementalSyncStrategy.
12 13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/incremental_sync_strategy.rb', line 12 def initialize(integration:) @integration = integration @sync_result = ::SpreeCmCommissioner::Integrations::Base::SyncResult.new end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/sync_strategies/incremental_sync_strategy.rb', line 17 def call route = find_route_to_sync return @sync_result unless route sync_trips_for_route!(route) @sync_result rescue StandardError => e @sync_result.record_error(e) @sync_result end |