Class: SpreeCmCommissioner::Integrations::Larryta::Polling::SyncTripStop
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Integrations::Larryta::Polling::SyncTripStop
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/polling/sync_trip_stop.rb
Overview
SyncTripStop synchronizes trip stops for a single Larryta schedule.
Larryta provides only origin and destination locations (branches). This service creates two TripStop records:
-
Stop 1: Origin branch (boarding only)
-
Stop 2: Destination branch (drop-off only)
Instance Method Summary collapse
- #call(trip_mapping:, schedule:) ⇒ Object
-
#initialize(integration:, sync_result: nil) ⇒ SyncTripStop
constructor
A new instance of SyncTripStop.
Constructor Details
#initialize(integration:, sync_result: nil) ⇒ SyncTripStop
Returns a new instance of SyncTripStop.
9 10 11 12 13 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/polling/sync_trip_stop.rb', line 9 def initialize(integration:, sync_result: nil) @integration = integration @sync_result = sync_result || SpreeCmCommissioner::Integrations::Base::SyncResult.new @location_mappings = {} end |
Instance Method Details
#call(trip_mapping:, schedule:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/polling/sync_trip_stop.rb', line 15 def call(trip_mapping:, schedule:) raise ArgumentError, 'trip_mapping is required' if trip_mapping.blank? raise ArgumentError, 'schedule is required' if schedule.blank? @trip_mapping = trip_mapping @schedule = schedule preload_location_mappings! sync_origin_stop! sync_destination_stop! end |