Gem for gathering info on VINs, optionally using NHTSA’s API
Installation
Add this line to your application’s Gemfile:
gem 'vin-validator'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install vin-validator
Usage
vin_info
just_a_vin = 'AA5325L1588827'
other_vins = %w[13N153201K1533942 1E9AA5325L1588827 1RND48A27GR039983 1RND53A33KR049282]
VinValidator::Knowledge.vin_info(just_a_vin).fetch(just_a_vin)
VinValidator::Knowledge.vin_info(just_a_vin, true).fetch(just_a_vin)
VinValidator::Knowledge.vin_info(other_vins)
VinValidator::Knowledge.vin_info(other_vins, true)
Every call to VinValidator::Knowledge::vin_info will return a hash.
Each key in the result is one of the VINs provided, and each value is another hash.
Value hash:
| Key | Value |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VinValidator::Result has 3 attributes: vin, type, and value.
-
vin- The vin the result belongs to -
type- The type of result (error,make,year, etc) -
value- The value of the result
validate
just_a_vin = 'AA5325L1588827'
other_vins = %w[13N153201K1533942 1E9AA5325L1588827 1RND48A27GR039983 1RND53A33KR049282]
VinValidator::Knowledge.validate(just_a_vin).fetch(just_a_vin)
VinValidator::Knowledge.validate(just_a_vin, true).fetch(just_a_vin)
VinValidator::Knowledge.validate(other_vins)
VinValidator::Knowledge.validate(other_vins, true)
Every call to VinValidator::Knowledge::vin_info will return a hash.
Each key in the result is one of the VINs provided, and each value is another hash.
Value hash:
| Key | Value | Description |
|---|---|---|
|
|
|
|
|
|
|
|
Possible makes the VIN can have |
|
|
The info messages |
|
|
The error messages |
VinValidator::Result has 3 attributes: vin, type, and value.
-
vin- The vin the result belongs to -
type- The type of result (error,make,year, etc) -
value- The value of the result
Changelog
See CHANGELOG see changes