Class: VinExploder::Decode::AbstractAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/vin_exploder/abstract_adapter.rb

Direct Known Subclasses

TestAdapter

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AbstractAdapter

Returns a new instance of AbstractAdapter.



10
11
12
# File 'lib/vin_exploder/abstract_adapter.rb', line 10

def initialize(options={})
  @options = options
end

Instance Method Details

#explode(vin) ⇒ Object

Fetch, normalize and return the decoded data as a hash.

vin

The Vehicle Identification Number

Returns:

An array containing the decoded data hash.

Should an error occur while decoding the vin the hash should include a key of :errors with an array of errors in the form of: name’ => ‘error message’

Normalize the hash from the vendor to use keys known by VinExploder. All keys should be made into symbols following the ruby snake case convention.

The keys that must be normalized are as follows: make model year => YYYY driveline => FWD|4WD|AWD body_style fuel_type => GAS|DIESEL|HYBRID trim_level

All remaining keys should be symbols but can remain vendor specific

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/vin_exploder/abstract_adapter.rb', line 39

def explode(vin)
  raise NotImplementedError.new("Unimplemented explode method.")
end