h1. VinExploder A ruby library for retrieving and caching Vehicle Identification Number (VIN) lookups. !https://badge.fury.io/rb/vin_exploder.png!:http://badge.fury.io/rb/vin_exploder !https://travis-ci.org/tinomen/vin_exploder.png?branch=master!:https://travis-ci.org/tinomen/vin_exploder !https://codeclimate.com/github/tinomen/vin_exploder.png!:https://codeclimate.com/github/tinomen/vin_exploder h2. How to install *Bundler*
gem vin_exploder*Rubygems*
gem install vin_exploderh2. How to use Using the vin exploder will require a decoding service adapter. Thankfully one is available in the Vinquery "gem":http://github.com/tinomen/vinquery
require 'vin_exploder' # require the Vinquery.com adapter require 'vinquery/vin_exploder/adapter' # tell vin_exploder to use the Vinquery.com adapter and pass it's required config VinExploder.config.adapter :vinquery, {:url => 'VINQUERY_URL', :access_code => 'ACCESS_CODE', :report_type => 'REPORT_TYPE'} # request the decoded VIN data vin_explosion = VinExploder.get('1FTWX31R19EB18840') vin_explosion.valid? # true vin_explosion.make # Fordh3. Rails use Create an initializer for the config
require 'vin_exploder' require 'vinquery/vin_exploder/adapter' VinExploder.config.adapter :vinquery, {:url => 'VINQUERY_URL', :access_code => 'ACCESS_CODE', :report_type => 'REPORT_TYPE'}h3. Optional Cache To save on the cost of looking up a VIN multiple times setup a cache
require 'vin_exploder' # require the Sequel based cache store require 'vin_exploder/cache/sequel_cache_store' # require the Vinquery.com adapter require 'vinquery/vin_exploder/adapter' # tell vin_exploder to use the Sequel based cache store adapter and pass in the connection config VinExploder.config.cache_store :sequel_cache_store, "mysql://localhost:3896/vin_cache" # tell vin_exploder to use the Vinquery.com adapter and pass it's required config VinExploder.config.adapter :vinquery, {:url => 'VINQUERY_URL', :access_code => 'ACCESS_CODE', :report_type => 'REPORT_TYPE'} # request the decoded VIN data vin_explosion = VinExploder.get('1FTWX31R19EB18840') vin_explosion.valid? #=> true vin_explosion.make #=> Ford # decoded VIN data is retrieved from cache vin_explosion2 = VinExploder.get('1FTWX31R19EB18840') vin_explosion2.make #=> Ford