VinUtils
A gem to check and suggest VIN identifiers.
Installation
Add this line to your application's Gemfile:
gem 'vin_utils'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install vin_utils
Usage
You can use this gem in your code to check the validity of a given VIN.
input_vin = '11111111111111111'
validator = VinUtils::Validator.new(input_vin)
validator.valid? # true
validator.calculate_check_digit # "1"
validator.suggest_valid_vin # "11111111111111111"
Both
calculate_check_digitandsuggest_valid_vinwill return:invalidincase of an invalid input (invalid characters, size or data type).
Example
There is an example console application that can be run by typing:
bin/example <VIN>
And it will print to the console something like the example below:
Provided VIN: <VIN>
Check Digit: VALID
This looks like a VALID VIN!
License
The gem is available as open source under the terms of the MIT License.