Preparations for 1.1.0
This commit is contained in:
parent
d7f6c34fc0
commit
5a93a54c64
58
README.md
58
README.md
@ -1,46 +1,64 @@
|
|||||||
jURAclient [](https://travis-ci.org/stklcode/juraclient)
|
# jURAclient [](https://travis-ci.org/stklcode/juraclient)
|
||||||
==========
|
|
||||||
|
|
||||||
|
|
||||||
Java client for URA based public transport APIs.
|
Java client for URA based public transport APIs.
|
||||||
|
|
||||||
This client allows to simply connect any Java application to the public transport API to implement a monitor for the
|
This client allows to simply connect any Java application to the public transport API to implement a monitor for the
|
||||||
local bus station or any other custom queries.
|
local bus station or any other custom queries. API versions 1.x and 2.x are supported.
|
||||||
|
|
||||||
**Usage Example**
|
## Usage Examples
|
||||||
|
|
||||||
|
### Initialization
|
||||||
```java
|
```java
|
||||||
// Instantiate the client (e.g. using the ASEAG API)
|
// Instantiate the client (e.g. using the TFL API)
|
||||||
UraClient ura = new UraClient("http://ivu.aseag.de");
|
UraClient ura = new UraClient("http://countdown.api.tfl.gov.uk");
|
||||||
|
|
||||||
// Initiailize with non-standard endpoints
|
// Initiailize the API with non-standard endpoints (e.g. ASEAG with API V2)
|
||||||
UraClient ura = new UraClient("http://ivu.aseag.de",
|
UraClient ura = new UraClient("http://ivu.aseag.de",
|
||||||
"interfaces/ura/instant_V2",
|
"interfaces/ura/instant_V2",
|
||||||
"interfaces/ura/stream_V2");
|
"interfaces/ura/stream_V2");
|
||||||
|
|
||||||
// List available stops
|
|
||||||
List<Stop> stops = ura.listStops();
|
|
||||||
|
|
||||||
// Get next 10 trips for given stops and lines (all filters optional)
|
|
||||||
List<Trip> trips = ura.forStop("100000")
|
|
||||||
.forLines("25", "35")
|
|
||||||
.getTrips(10);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Maven Artifact**
|
### List Stops
|
||||||
|
|
||||||
|
```java
|
||||||
|
// List ALL available stops
|
||||||
|
List<Stop> stops = ura.getStops();
|
||||||
|
|
||||||
|
// List available stops in a 200m radius around given coordinates
|
||||||
|
List<Stop> stops = ura.forPosition(51.51009, -0.1345734, 200)
|
||||||
|
.getStops();
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get Trips
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Get next 10 trips for given stops and lines in a single direction (all filters optional)
|
||||||
|
List<Trip> trips = ura.forStop("100000")
|
||||||
|
.forLines("25", "35")
|
||||||
|
.forDirection(1)
|
||||||
|
.getTrips(10);
|
||||||
|
|
||||||
|
// Get trips from given stop towards your destination
|
||||||
|
List<Trip> trips = ura.forStopByName("Piccadilly Circus")
|
||||||
|
.towards("Marble Arch")
|
||||||
|
.getTrips();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Maven Artifact
|
||||||
```
|
```
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.stklcode.pubtrans</groupId>
|
<groupId>de.stklcode.pubtrans</groupId>
|
||||||
<artifactId>juraclient</artifactId>
|
<artifactId>juraclient</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
**Planned features:**
|
## Planned Features
|
||||||
|
|
||||||
* More refined query parameters
|
* More refined query parameters
|
||||||
* Stream API with asynchronous consumer
|
* Stream API with asynchronous consumer
|
||||||
|
|
||||||
**License**
|
## License
|
||||||
|
|
||||||
The project is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
The project is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.stklcode.pubtrans</groupId>
|
<groupId>de.stklcode.pubtrans</groupId>
|
||||||
<artifactId>juraclient</artifactId>
|
<artifactId>juraclient</artifactId>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.1.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -145,6 +145,7 @@ public class UraClient {
|
|||||||
*
|
*
|
||||||
* @param destinationNames destination names
|
* @param destinationNames destination names
|
||||||
* @return the request
|
* @return the request
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query forDestinationNames(final String... destinationNames) {
|
public Query forDestinationNames(final String... destinationNames) {
|
||||||
return new Query().forDestinationNames(destinationNames);
|
return new Query().forDestinationNames(destinationNames);
|
||||||
@ -155,6 +156,7 @@ public class UraClient {
|
|||||||
*
|
*
|
||||||
* @param towards towards stop point names
|
* @param towards towards stop point names
|
||||||
* @return the request
|
* @return the request
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query towards(final String... towards) {
|
public Query towards(final String... towards) {
|
||||||
return new Query().towards(towards);
|
return new Query().towards(towards);
|
||||||
@ -167,6 +169,7 @@ public class UraClient {
|
|||||||
* @param longitude Longitude (WGS84)
|
* @param longitude Longitude (WGS84)
|
||||||
* @param radius Search radius (meters)
|
* @param radius Search radius (meters)
|
||||||
* @return the request
|
* @return the request
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query forPosition(final Double latitude, final Double longitude, final Integer radius) {
|
public Query forPosition(final Double latitude, final Double longitude, final Integer radius) {
|
||||||
return new Query().forPosition(latitude, longitude, radius);
|
return new Query().forPosition(latitude, longitude, radius);
|
||||||
@ -370,6 +373,7 @@ public class UraClient {
|
|||||||
*
|
*
|
||||||
* @param destinationNames names of destinations
|
* @param destinationNames names of destinations
|
||||||
* @return the query
|
* @return the query
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query forDestinationNames(final String... destinationNames) {
|
public Query forDestinationNames(final String... destinationNames) {
|
||||||
this.destinationNames = destinationNames;
|
this.destinationNames = destinationNames;
|
||||||
@ -381,6 +385,7 @@ public class UraClient {
|
|||||||
*
|
*
|
||||||
* @param towards towards stop point names
|
* @param towards towards stop point names
|
||||||
* @return the request
|
* @return the request
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query towards(final String... towards) {
|
public Query towards(final String... towards) {
|
||||||
this.towards = towards;
|
this.towards = towards;
|
||||||
@ -394,6 +399,7 @@ public class UraClient {
|
|||||||
* @param longitude Longitude (WGS84)
|
* @param longitude Longitude (WGS84)
|
||||||
* @param radius Search radius (meters)
|
* @param radius Search radius (meters)
|
||||||
* @return the query
|
* @return the query
|
||||||
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public Query forPosition(final Double latitude, final Double longitude, final Integer radius) {
|
public Query forPosition(final Double latitude, final Double longitude, final Integer radius) {
|
||||||
this.circle = latitude.toString() + "," + longitude.toString() + "," + radius.toString();
|
this.circle = latitude.toString() + "," + longitude.toString() + "," + radius.toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user