Overview
The Department of Transportation maintains the SaferBusAPI to provide safety information pertaining to transporation companies. Information related to this API and instructions for access the API can be found here: https://mobile.fmcsa.dot.gov/developer/apidescription.page?cid=561
Installation
Add this line to your application's Gemfile:
gem 'safer_bus_api'
Then run:
bundle install
Configuration
Set your api_token obtained from registering at https://mobile.fmcsa.dot.gov/developer/UserAccountCreate.page
Note: Once registered you will be emailed a registration token which you can then use to complete your registration and obtain an api token for your application
SaferBusApi.configure do |config|
config.api_token = 'your-token-here'
end
Example Usage
Query by DOT number:
request = SaferBusApi::Request.new(dot_number: '44110')
response = request.perform
response.data
response.raw_data
Query by Company Name:
request = SaferBusApi::Request.new(company_name: 'greyhound')
response = request.perform
response.data
Query by MC Number:
request = SaferBusApi::Request.new(mc_number: '1515')
response = request.perform
response.data
Author
Nathan Bertram
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Ensure tests are passing with
rspec
- Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- You da man!