SwaggerClient - the Ruby gem for the Ergast F1 DB OpenAPI Spec
This is a partial definition of the Ergast F1 API in the OpenAPI 3.0 specification. Of the the endpoints that are implemented here, the url paths and return data schemas are structured to match the structure currently used on the live Ergast API. You should be able to use the as a starting point for generating your client libraries for use with Ergast, or setting up your own API to use with a copy of the Ergast DB. Some notes: - This only defines the JSON data schema, not the XML version of the API return data - Outside of the year, most of the inline parameters used by the Ergast API are not defined here. - The placeholder values for year are not currently implemented.
This SDK is automatically generated by the Swagger Codegen project:
- API version: 1.1.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen For more information, please visit http://github.com/adampax
To build the Ruby code into a gem:
gem build swagger_client.gemspec
Then either install the gem locally:
gem install ./swagger_client-1.0.0.gem
(for development, run gem install --dev ./swagger_client-1.0.0.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'swagger_client', '~> 1.0.0'
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
gem 'swagger_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Please follow the installation procedure and then run the following code:
# Load the gem
require 'swagger_client'
api_instance = SwaggerClient::ConstructorsApi.new
year = '2020' # String | Year in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_constructor_standings_by_year(year, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ConstructorsApi->get_constructor_standings_by_year: #{e}"
end
api_instance = SwaggerClient::ConstructorsApi.new
year = '2020' # String | Year in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_constructors_by_year(year, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ConstructorsApi->get_constructors_by_year: #{e}"
end
api_instance = SwaggerClient::DriversApi.new
year = '2020' # String | Year in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_driver_standings_by_year(year, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling DriversApi->get_driver_standings_by_year: #{e}"
end
api_instance = SwaggerClient::ResultsApi.new
year = '2020' # String | Year in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_results_by_year(year, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ResultsApi->get_results_by_year: #{e}"
end
api_instance = SwaggerClient::ResultsApi.new
year = '2020' # String | Year in question
constructor_id = 'constructor_id_example' # String | Limit results to this constructor
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_results_by_year_and_constructor(year, constructor_id, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ResultsApi->get_results_by_year_and_constructor: #{e}"
end
api_instance = SwaggerClient::ResultsApi.new
year = '2020' # String | Year in question
round = 'round_example' # String | Round in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_results_by_year_and_round(year, round, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ResultsApi->get_results_by_year_and_round: #{e}"
end
api_instance = SwaggerClient::ScheduleApi.new
year = '2020' # String | Year in question
opts = {
offset: 56, # Integer | The number of items to skip before starting to collect the result set.
limit: 30 # Integer | The numbers of items to return.
}
begin
result = api_instance.get_season_by_year(year, opts)
p result
rescue SwaggerClient::ApiError => e
puts "Exception when calling ScheduleApi->get_season_by_year: #{e}"
end
All URIs are relative to https://ergast.com/api/f1
Class | Method | HTTP request | Description |
---|---|---|---|
SwaggerClient::ConstructorsApi | get_constructor_standings_by_year | GET /{year}/constructorStandings.json | |
SwaggerClient::ConstructorsApi | get_constructors_by_year | GET /{year}/constructors.json | |
SwaggerClient::DriversApi | get_driver_standings_by_year | GET /{year}/driverStandings.json | |
SwaggerClient::ResultsApi | get_results_by_year | GET /{year}/results.json | |
SwaggerClient::ResultsApi | get_results_by_year_and_constructor | GET /{year}/constructors/{constructorId}/results.json | |
SwaggerClient::ResultsApi | get_results_by_year_and_round | GET /{year}/{round}/results.json | |
SwaggerClient::ScheduleApi | get_season_by_year | GET /{year}.json |
- SwaggerClient::Circuit
- SwaggerClient::CircuitLocation
- SwaggerClient::Constructor
- SwaggerClient::ConstructorStandingsByYearResponse
- SwaggerClient::ConstructorStandingsByYearResponseMRData
- SwaggerClient::ConstructorStandingsByYearResponseMRDataStandingsTable
- SwaggerClient::ConstructorStandingsByYearResponseMRDataStandingsTableConstructorStandings
- SwaggerClient::ConstructorStandingsByYearResponseMRDataStandingsTableStandingsLists
- SwaggerClient::ConstructorsByYearResponse
- SwaggerClient::ConstructorsByYearResponseMRData
- SwaggerClient::ConstructorsByYearResponseMRDataConstructorTable
- SwaggerClient::Driver
- SwaggerClient::DriverStandingsByYearResponse
- SwaggerClient::DriverStandingsByYearResponseMRData
- SwaggerClient::DriverStandingsByYearResponseMRDataStandingsTable
- SwaggerClient::DriverStandingsByYearResponseMRDataStandingsTableDriverStandings
- SwaggerClient::DriverStandingsByYearResponseMRDataStandingsTableStandingsLists
- SwaggerClient::Race
- SwaggerClient::Result
- SwaggerClient::ResultFastestLap
- SwaggerClient::ResultFastestLapAverageSpeed
- SwaggerClient::ResultFastestLapTime
- SwaggerClient::ResultTime
- SwaggerClient::ResultsByYearResponse
- SwaggerClient::ResultsByYearResponseMRData
- SwaggerClient::ResultsByYearResponseMRDataRaceTable
- SwaggerClient::SeasonByYearResponse
- SwaggerClient::SeasonByYearResponseMRData
- SwaggerClient::SeasonByYearResponseMRDataRaceTable
All endpoints do not require authorization.