mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 17:39:49 +00:00
AbstractHafasClientInterfaceProvider: Support for 'ext' configuration.
This commit is contained in:
parent
43647e7c77
commit
12f597fe78
3 changed files with 17 additions and 0 deletions
|
@ -87,6 +87,8 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
@Nullable
|
||||
private String apiVersion;
|
||||
@Nullable
|
||||
private String apiExt;
|
||||
@Nullable
|
||||
private String apiAuthorization;
|
||||
@Nullable
|
||||
private String apiClient;
|
||||
|
@ -117,6 +119,11 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
return this;
|
||||
}
|
||||
|
||||
protected AbstractHafasClientInterfaceProvider setApiExt(final String apiExt) {
|
||||
this.apiExt = checkNotNull(apiExt);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected AbstractHafasClientInterfaceProvider setApiAuthorization(final String apiAuthorization) {
|
||||
this.apiAuthorization = apiAuthorization;
|
||||
return this;
|
||||
|
@ -704,6 +711,7 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
|||
return "{" //
|
||||
+ (apiAuthorization != null ? "\"auth\":" + apiAuthorization + "," : "") //
|
||||
+ "\"client\":" + checkNotNull(apiClient) + "," //
|
||||
+ (apiExt != null ? "\"ext\":\"" + apiExt + "\"," : "") //
|
||||
+ "\"ver\":\"" + checkNotNull(apiVersion) + "\",\"lang\":\"eng\"," //
|
||||
+ "\"svcReqL\":[" //
|
||||
+ "{\"meth\":\"ServerInfo\",\"req\":{\"getServerDateTime\":true,\"getTimeTablePeriod\":false}}," //
|
||||
|
|
|
@ -41,6 +41,7 @@ public final class DbProvider extends AbstractHafasClientInterfaceProvider {
|
|||
public DbProvider(final String apiAuthorization) {
|
||||
super(NetworkId.DB, API_BASE, PRODUCTS_MAP);
|
||||
setApiVersion("1.14");
|
||||
setApiExt("DB.R15.12.a");
|
||||
setApiClient("{\"id\":\"DB\",\"v\":\"16040000\",\"type\":\"AND\",\"name\":\"DB Navigator\"}");
|
||||
setApiAuthorization(apiAuthorization);
|
||||
setRequestChecksumSalt("bdI8UVj40K5fvxwf".getBytes(Charsets.UTF_8));
|
||||
|
|
|
@ -190,4 +190,12 @@ public class DbProviderLiveTest extends AbstractProviderLiveTest {
|
|||
print(result);
|
||||
assertEquals(QueryTripsResult.Status.INVALID_DATE, result.status);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tripBetweenAreas() throws Exception {
|
||||
final Location from = new Location(LocationType.STATION, "8096021"); // FRANKFURT(MAIN)
|
||||
final Location to = new Location(LocationType.STATION, "8096022"); // KÖLN
|
||||
final QueryTripsResult result = queryTrips(from, null, to, new Date(), true, null);
|
||||
print(result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue