vin-validator 1.1.0.pre.rc.1 → 1.1.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6523c6bd1ad2fea7e124214d1373e350ad91651425e356895b27fa9e3e65345f
4
- data.tar.gz: 8f904a2603046eb4381f417300e0450b0f095aca1c43857de1b9c9753c47bff8
3
+ metadata.gz: d8e5a52d479ddb4dd27dd04bd8f913aaaaea50fee21536ca8bed3062c1ef84b6
4
+ data.tar.gz: 728d00c37bfc36d52cb3d71e9e5ebdcac7fc37a15f704cabd175d095a51f426c
5
5
  SHA512:
6
- metadata.gz: a77c0325d479f4f263e1beb3354cafeb21d6eb7251cba6c7e48f64e735c559c0843fb4d50088c91d910c46002ea234589684b50e7e08edcbb52c4cf943d51a3c
7
- data.tar.gz: 90c38e20991bfd30dfc0df5b40eab5c56360d8e1a1e42933482c95af5bb87faacb0df0332b74dd7cd03649df81311393ca1db341aa0a91f901e9c832887a25ef
6
+ metadata.gz: f89831b12d70327d1b8cc2b69dee43a09b1b0ae10453117021b45050bc0fdb7a35e7e935e875fccdff806c84f55b54dd56f7f1c138d8a53c1e7ba9fcaf17a78a
7
+ data.tar.gz: 940a7c613399ce02e4a2cd4e24f02ac069ce6869268326134267f86f76fa50b00bc848d9f536cadc265060edc021292b663348bfcbf5d2dc0dbe3d06eed1ec62
data/CHANGELOG.adoc CHANGED
@@ -1,3 +1,8 @@
1
+ = 1.1.0
2
+
3
+ * Added ``VinValidator::Knowledge::validate``
4
+ ** Track revolving 30 years too
5
+
1
6
  = 1.0.0
2
7
 
3
8
  * Intial Release
data/README.adoc CHANGED
@@ -21,6 +21,8 @@ Or install it yourself as:
21
21
 
22
22
  == Usage
23
23
 
24
+ === ``vin_info``
25
+
24
26
  [source,ruby]
25
27
  ----
26
28
  just_a_vin = 'AA5325L1588827'
@@ -86,6 +88,57 @@ Value hash:
86
88
  * ``type`` - The type of result (``error``, ``make``, ``year``, etc)
87
89
  * ``value`` - The value of the result
88
90
 
91
+ === ``validate``
92
+
93
+ [source,ruby]
94
+ ----
95
+ just_a_vin = 'AA5325L1588827'
96
+ other_vins = %w[13N153201K1533942 1E9AA5325L1588827 1RND48A27GR039983 1RND53A33KR049282]
97
+
98
+ VinValidator::Knowledge.validate(just_a_vin).fetch(just_a_vin)
99
+
100
+ VinValidator::Knowledge.validate(just_a_vin, true).fetch(just_a_vin)
101
+
102
+ VinValidator::Knowledge.validate(other_vins)
103
+
104
+ VinValidator::Knowledge.validate(other_vins, true)
105
+ ----
106
+
107
+ Every call to ``VinValidator::Knowledge::vin_info`` will return a hash.
108
+ Each key in the result is one of the VINs provided, and each value is another hash.
109
+
110
+ Value hash:
111
+
112
+ |===
113
+ |Key |Value |Description
114
+
115
+ |``:valid``
116
+ |``Boolean``
117
+ |``false`` if there are errors or year/wmi is blank
118
+
119
+ |``:year``
120
+ |``Hash``, ``Nil``
121
+ |``:letter``(``String``) and ``:year``(``Integer``)
122
+
123
+ |``:wmi``
124
+ |``Array<VinValidator::Result>``
125
+ |Possible makes the VIN can have
126
+
127
+ |``:infos``
128
+ |``Array<String>``
129
+ |The info messages
130
+
131
+ |``:errors``
132
+ |``Array<String>``
133
+ |The error messages
134
+ |===
135
+
136
+ ``VinValidator::Result`` has 3 attributes: ``vin``, ``type``, and ``value``.
137
+
138
+ * ``vin`` - The vin the result belongs to
139
+ * ``type`` - The type of result (``error``, ``make``, ``year``, etc)
140
+ * ``value`` - The value of the result
141
+
89
142
  == Changelog
90
143
 
91
144
  See xref:./CHANGELOG.adoc[CHANGELOG] see changes
@@ -29,7 +29,6 @@ module VinValidator
29
29
  next [vin, {
30
30
  valid: false,
31
31
  wmi: [],
32
- year: {},
33
32
  errors: simple_check.fetch(:errors).map(&:value)
34
33
  }]
35
34
  end
@@ -40,7 +39,7 @@ module VinValidator
40
39
  vin_year = vin_split[9].to_s
41
40
  year = VinValidator::Year.find_by(letter: vin_year)
42
41
 
43
- possible_wmis = Array(simple_check[:make]).map { |gem_vin_wmi| { make: gem_vin_wmi.value } }
42
+ possible_wmis = Array(simple_check[:make])
44
43
 
45
44
  errors = []
46
45
 
@@ -61,10 +60,10 @@ module VinValidator
61
60
  end
62
61
 
63
62
  [vin, {
64
- valid: !year.nil? && !possible_wmis.nil?,
65
- year: { letter: year.letter, year: year.year },
63
+ valid: !year.nil? && !possible_wmis.empty?,
64
+ year: year,
66
65
  errors: errors,
67
- wmi: possible_wmis.uniq { |wmi| wmi[:make] },
66
+ wmi: possible_wmis.uniq(&:value),
68
67
  infos: infos
69
68
  }]
70
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VinValidator
4
- VERSION = '1.1.0-rc.1'
4
+ VERSION = '1.1.0-rc.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vin-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre.rc.1
4
+ version: 1.1.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance