Java implementation to get a historical record of motor racing data from Ergast Developer API.
Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add the dependency:
dependencies {
compile 'com.github.olerom.formula-one-ergast:ergast:0.1.1'
}
Add the JitPack repository to your build file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add the dependency:
<dependency>
<groupId>com.github.olerom.formula-one-ergast</groupId>
<artifactId>ergast</artifactId>
<version>0.1.1</version>
</dependency>
You have to initialize Ergast object:
Ergast ergast = new Ergast(2016, 100, 2);
Ergast ergast = new Ergast();
If you use default constructor, season will be set as NO_SEASON, limit as DEFAULT_LIMIT and offset as DEFAULT_OFFSET.
You can get the following objects that satisfy Ergast queries:
- Season
- Qualification
- Constructor
- LapTimes
- Schedule
- DriverStandings, ConstructorStandings
- Circuit
- RacePitStops
- RaceResult
- Driver
- FinishingStatus
For example, to get information about pit stops at final race of 2016 season with 100 limit:
Ergast ergast = new Ergast(2016, 100, Ergast.DEFAULT_OFFSET);
ergast.getRacePitStops(21).forEach(System.out::println);
It would be cool, if you review the code or create a pull request.