/nhtsa_vin

A ruby gem for interacting with the NHTSA's Vehicle Identification Number webservice

Primary LanguageRubyMIT LicenseMIT

NHTSA Vin

Gem Version

A ruby gem for fetching and parsing vehicle identification via the vehicle identification number (VIN) from the NHTSA webservice. Note, this gem is not officially affiliated with the NHTSA.

Please note, this gem is currently in early development.

Installation

Add this line to your application's Gemfile:

gem 'nhsta_vin'

And then execute:

bundle

Or install it yourself as:

gem install nhsta_vin

Usage

Usage is fairly simple. Provide a VIN, and the gem will return a struct of vehicle data.

query = NhtsaVin.get('1J4BA5H11AL143811')
query.valid? # => true
query.response # => <Struct::NhtsaResponse make="Jeep", model="Grand Cherokee", trim="Laredo/Rocky Mountain Edition", type="SUV", year="2008", size=nil, ... doors=4>

In the result no match is found, the result will be nil, and #valid? will return false.

Vehicle Types

For brievity, we're reducing the Vehicle Type response to an enumerated set of ["Car", "Truck", "Van", "SUV", "Minivan"]. We're doing a rough parse of the type and body style to achieve this. It's probably not perfect.

License

Licensed under the MIT License.