Class: Vindetta::Decoder
- Inherits:
-
Object
show all
- Defined in:
- lib/vindetta/decoder.rb,
lib/vindetta/decoder/dsl.rb,
lib/vindetta/decoder/result.rb
Defined Under Namespace
Modules: DSL
Classes: Result
Class Method Summary
collapse
Class Method Details
.check_digit(vin) ⇒ Object
15
16
17
|
# File 'lib/vindetta/decoder.rb', line 15
def self.check_digit(vin)
vin[8]
end
|
.plant_code(vin) ⇒ Object
11
12
13
|
# File 'lib/vindetta/decoder.rb', line 11
def self.plant_code(vin)
vin[10]
end
|
.production_number(vin) ⇒ Object
40
41
42
|
# File 'lib/vindetta/decoder.rb', line 40
def self.production_number(vin)
vin[11..16]
end
|
.vds(vin, options = {}) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/vindetta/decoder.rb', line 23
def self.vds(vin, options = {})
defaults = { :check_digit => true }
options = defaults.merge(options)
vin[3..8].tap do |vds|
vds.chop! unless options[:check_digit]
end
end
|
.vin(vin) ⇒ Object
7
8
9
|
# File 'lib/vindetta/decoder.rb', line 7
def self.vin(vin)
Result.new(Api.get(vin)["Results"])
end
|
.vis(vin) ⇒ Object
36
37
38
|
# File 'lib/vindetta/decoder.rb', line 36
def self.vis(vin)
vin[9..16]
end
|
.wmi(vin) ⇒ Object
19
20
21
|
# File 'lib/vindetta/decoder.rb', line 19
def self.wmi(vin)
vin[0..2]
end
|
.year(vin) ⇒ Object
32
33
34
|
# File 'lib/vindetta/decoder.rb', line 32
def self.year(vin)
vin(vin).year
end
|