Skip to content

tinomen/vin_exploder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VinExploder

A ruby library for retrieving and caching Vehicle Identification Number (VIN) lookups.

How to install

Bundler

  gem vin_exploder

Rubygems

  gem install vin_exploder

How to use

Using the vin exploder will require a decoding service adapter. Thankfully one is available in the Vinquery gem

  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   # Ford

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'}

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

About

vehicle identification number decoder

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages