From aa08a622e099b652a1e38521972fb57e4228edee Mon Sep 17 00:00:00 2001 From: alexander-albers <27898390+alexander-albers@users.noreply.github.com> Date: Sun, 6 Aug 2023 16:19:37 +0200 Subject: [PATCH] Avv: update to new api url --- .../Implementations/AvvAugsburgProvider.swift | 12 ++++++++-- .../AvvAugsburgProviderTests.swift | 1 + .../TestsCommon/Resources/Test Cases/avv.json | 22 +++++++++---------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Sources/TripKit/Provider/Implementations/AvvAugsburgProvider.swift b/Sources/TripKit/Provider/Implementations/AvvAugsburgProvider.swift index a3828e63..57ee919b 100644 --- a/Sources/TripKit/Provider/Implementations/AvvAugsburgProvider.swift +++ b/Sources/TripKit/Provider/Implementations/AvvAugsburgProvider.swift @@ -3,14 +3,17 @@ import Foundation /// Augsburger Verkehrs- und Tarifverbund (DE) public class AvvAugsburgProvider: AbstractEfaWebProvider { - static let API_BASE = "https://efa.avv-augsburg.de/avv2/" + static let API_BASE = "https://fahrtauskunft.avv-augsburg.de/efa/" + static let DEPARTURE_MONITOR_ENDPOINT = "XML_DM_REQUEST" + static let TRIP_ENDPOINT = "XML_TRIP_REQUEST2" public override var supportedLanguages: Set { ["de", "en"] } public init() { - super.init(networkId: .AVV, apiBase: AvvAugsburgProvider.API_BASE) + super.init(networkId: .AVV, apiBase: AvvAugsburgProvider.API_BASE, departureMonitorEndpoint: AvvAugsburgProvider.DEPARTURE_MONITOR_ENDPOINT, tripEndpoint: AvvAugsburgProvider.TRIP_ENDPOINT) useRouteIndexAsTripId = false + useStatelessTripContexts = true styles = [ "B": LineStyle(shape: .circle, backgroundColor: LineStyle.parseColor("#abb1b1"), foregroundColor: LineStyle.black), "BB1": LineStyle(shape: .circle, backgroundColor: LineStyle.parseColor("#93117e"), foregroundColor: LineStyle.white), @@ -61,6 +64,11 @@ public class AvvAugsburgProvider: AbstractEfaWebProvider { ] } + override func stopFinderRequestParameters(builder: UrlBuilder, constraint: String, types: [LocationType]?, maxLocations: Int, outputFormat: String) { + super.stopFinderRequestParameters(builder: builder, constraint: constraint, types: types, maxLocations: maxLocations, outputFormat: outputFormat) + builder.addParameter(key: "avvStopFinderMacro", value: 1) + } + override func queryTripsParameters(builder: UrlBuilder, from: Location, via: Location?, to: Location, date: Date, departure: Bool, tripOptions: TripOptions) { super.queryTripsParameters(builder: builder, from: from, via: via, to: to, date: date, departure: departure, tripOptions: tripOptions) diff --git a/Tests/StaticTripKitTests/AvvAugsburgProviderTests.swift b/Tests/StaticTripKitTests/AvvAugsburgProviderTests.swift index fa1ab59a..f26c0e57 100644 --- a/Tests/StaticTripKitTests/AvvAugsburgProviderTests.swift +++ b/Tests/StaticTripKitTests/AvvAugsburgProviderTests.swift @@ -12,4 +12,5 @@ class AvvAugsburgProviderTests: TripKitProviderTestCase, TripKitProviderTestsDel return AvvAugsburgProvider() } + var supportsRefreshTrip: Bool { return false } } diff --git a/Tests/TestsCommon/Resources/Test Cases/avv.json b/Tests/TestsCommon/Resources/Test Cases/avv.json index 4fdda856..0dd257aa 100644 --- a/Tests/TestsCommon/Resources/Test Cases/avv.json +++ b/Tests/TestsCommon/Resources/Test Cases/avv.json @@ -3,13 +3,13 @@ { "constraint": "Augsburg, Hbf", "result": { - "id": "2000100" + "id": "80000589" } }, { - "constraint": "Königspl", + "constraint": "Gies", "result": { - "id": "2000101" + "id": "2000018" } }, { @@ -39,31 +39,31 @@ "lat": 48365854, "lon": 10884123, "result": { - "id": "2000100" + "id": "80000589" } } ], "queryDepartures": [ { "__comment": "Augsburg Königsplatz", - "id": "101" + "id": "2000101" }, { "__comment": "Augsburg Hauptbahnhof", - "id": "100" + "id": "80000589" } ], "queryDeparturesInvalidId": "999999", "queryTrips": [ { - "__comment": "Augsburg Königsplatz to Augsburg Hauptbahnhof", + "__comment": "Augsburg Gieseckestraße to Augsburg Hauptbahnhof", "from": { "type": "station", - "id": "101" + "id": "2000018" }, "to": { "type": "station", - "id": "100" + "id": "80000589" } }, { @@ -85,11 +85,11 @@ "__comment": "Augsburg Königsplatz", "from": { "type": "station", - "id": "101" + "id": "2000101" }, "to": { "type": "station", - "id": "101" + "id": "2000101" } } ]