Skip to content

Commit

Permalink
Avv: update to new api url
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-albers committed Aug 6, 2023
1 parent 07a49dd commit aa08a62
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
12 changes: 10 additions & 2 deletions Sources/TripKit/Provider/Implementations/AvvAugsburgProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> { ["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),
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions Tests/StaticTripKitTests/AvvAugsburgProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ class AvvAugsburgProviderTests: TripKitProviderTestCase, TripKitProviderTestsDel
return AvvAugsburgProvider()
}

var supportsRefreshTrip: Bool { return false }
}
22 changes: 11 additions & 11 deletions Tests/TestsCommon/Resources/Test Cases/avv.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{
"constraint": "Augsburg, Hbf",
"result": {
"id": "2000100"
"id": "80000589"
}
},
{
"constraint": "Königspl",
"constraint": "Gies",
"result": {
"id": "2000101"
"id": "2000018"
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand All @@ -85,11 +85,11 @@
"__comment": "Augsburg Königsplatz",
"from": {
"type": "station",
"id": "101"
"id": "2000101"
},
"to": {
"type": "station",
"id": "101"
"id": "2000101"
}
}
]
Expand Down

0 comments on commit aa08a62

Please sign in to comment.