nhtsa_vin 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +12 -5
- data/lib/nhtsa_vin.rb +5 -1
- data/lib/nhtsa_vin/version.rb +1 -1
- data/spec/lib/nhtsa_vin_spec.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 304f6e9a4706dcfd739db613ae7c72498315105c
|
4
|
+
data.tar.gz: d4d6d09d018be6ad53808f6f1373fd2bf8ab1b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85c5e99bbd033576db5f582aeaff92ec8317fa74e459d58e8e68a396b134d2cdeebd601fb43d0446274e04ea26e24b7706d1047ae18ce1237b4f017cc4bc3716
|
7
|
+
data.tar.gz: 2d5b4cb48f8ebab768ce8ee7cda45bb5b2dc106e15bb6a09892195ea9570ea79da42ff06423c2f928a4b874d147c9b71c216594871dbc951807154a800592570
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -30,16 +30,23 @@ Or install it yourself as:
|
|
30
30
|
Validation
|
31
31
|
----
|
32
32
|
|
33
|
-
Prior to dispatching a call to the web service, you can optionally validate a given VIN first.
|
33
|
+
Prior to dispatching a call to the web service, you can optionally validate a given VIN first. Calling `#validate` returns an `NhtsaVin::Validation`.
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
validation = NhtsaVin.
|
36
|
+
validation = NhtsaVin.validate('1J4BA5H11AL143811') # => <#NhtsaVin.Validate>
|
37
37
|
validation.valid? # => true
|
38
|
-
validation.checksum # => 1
|
39
38
|
|
40
|
-
validation = NhtsaVin.
|
39
|
+
validation = NhtsaVin.validate('SOMEBADVIN') # => <#NhtsaVin.Validate>
|
41
40
|
validation.valid? # => false
|
42
|
-
validation.
|
41
|
+
validation.error # => 'Invalid VIN format'
|
42
|
+
```
|
43
|
+
|
44
|
+
Once validated, the validation also provides the components of a VIN, and additional information
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
validation = NhtsaVin.validate('1J4BA5H11AL143811') # => <#NhtsaVin.Validate>
|
48
|
+
validation.checksum # => '1'
|
49
|
+
validation.plant # => 'L'
|
43
50
|
```
|
44
51
|
|
45
52
|
Query
|
data/lib/nhtsa_vin.rb
CHANGED
data/lib/nhtsa_vin/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe NhtsaVin do
|
4
|
+
let(:vin) { '2G1WT57K291223396' }
|
5
|
+
describe '#get' do
|
6
|
+
let(:get) { NhtsaVin.get(vin) }
|
7
|
+
it 'returns a query' do
|
8
|
+
expect(get).to be_a NhtsaVin::Query
|
9
|
+
end
|
10
|
+
end
|
11
|
+
describe '#validate' do
|
12
|
+
let(:validate) { NhtsaVin.validate(vin) }
|
13
|
+
it 'returns a validation' do
|
14
|
+
expect(validate).to be_a NhtsaVin::Validation
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nhtsa_vin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barclay Loftus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- spec/fixtures/success.json
|
80
80
|
- spec/lib/nhtsa_vin/query_spec.rb
|
81
81
|
- spec/lib/nhtsa_vin/validation_spec.rb
|
82
|
+
- spec/lib/nhtsa_vin_spec.rb
|
82
83
|
- spec/spec_helper.rb
|
83
84
|
homepage: https://github.com/deliv/nhtsa_vin
|
84
85
|
licenses:
|
@@ -109,4 +110,5 @@ test_files:
|
|
109
110
|
- spec/fixtures/success.json
|
110
111
|
- spec/lib/nhtsa_vin/query_spec.rb
|
111
112
|
- spec/lib/nhtsa_vin/validation_spec.rb
|
113
|
+
- spec/lib/nhtsa_vin_spec.rb
|
112
114
|
- spec/spec_helper.rb
|