vin-validator 1.0.0.pre.rc.1 → 1.0.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: '09b6a9a66a5d7d95da1f899f47c76dfce32dfe3c64b0ab9da1430c111ed9f41a'
4
- data.tar.gz: 1b6ab1b90068a41859ece6ce59a63441f519bf7fc9a0d52279a357a39c071927
3
+ metadata.gz: 95cf357dcb88d24e42d8a35ff84b597669088179ce1c6c3fe83d6bf888fb8895
4
+ data.tar.gz: 925575c48c968a5c8acaf1c1ecec242deb9f859437582cb0958667f4e3ee6d55
5
5
  SHA512:
6
- metadata.gz: c7dc4990ca5ef305e80aa301ac7e563e65873e2e96c5384768583e320bb27abfa030c3b3c6a7b09caa8ea850251f49b022a64ef7008631a237192a27b100a411
7
- data.tar.gz: d40e46f343c2cf9fbd1ead1daa5220fabe319ff8ca4352ed7556a9d5df028a81d9e539355a47e5984637f16c81b2c0656c02745396c9a6cc4c5ffd340cca9419
6
+ metadata.gz: e516a350da7d1a69f95bdcf9ea560328d5683b7aa54f0b3c3262bfec61e060742212786b7313d1b76daed496b3ab20052b7cf2883cd36fc3a26f4d492ee7b3f5
7
+ data.tar.gz: d99a387b3c484ab33cbfc16080e7875a6e680e645ca71f5c36cebd5a1b8ae6f9e07fe188ad75bab6f5076a92f5852a0df8541d5d0bd02df344b66f032642b56f
data/README.adoc CHANGED
@@ -8,7 +8,7 @@ Add this line to your application's Gemfile:
8
8
 
9
9
  [source,ruby]
10
10
  ----
11
- gem 'vin-validator', require: false
11
+ gem 'vin-validator'
12
12
  ----
13
13
 
14
14
  And then execute:
@@ -18,10 +18,7 @@ module VinValidator
18
18
  def vin_info(vins, hit_nhtsa = false, &block)
19
19
  results = hit_nhtsa ? VinValidator::Api.vin_info(vins, &block) : {}
20
20
 
21
- Array(vins).to_h do |vin|
22
- vin_results = results.fetch(vin, {})
23
- [vin, build_results(vin, vin_results)]
24
- end
21
+ Array(vins).map { |vin| [vin, build_results(vin, results.fetch(vin, {}))] }.to_h
25
22
  end
26
23
 
27
24
  private
@@ -79,7 +76,8 @@ module VinValidator
79
76
  end
80
77
  end
81
78
 
82
- vin_errors << 'Check digit is incorrect.' unless get_check_digit(vin) == vin[8]
79
+ vin_errors << 'Check digit is incorrect.' if get_check_digit(vin) != vin[8]
80
+
83
81
  vin_errors
84
82
  end
85
83
 
@@ -103,13 +101,16 @@ module VinValidator
103
101
  map = '0123456789X'
104
102
  weights = '8765432X098765432'
105
103
  sum = 0
104
+
106
105
  17.times do |i|
107
106
  value_weight = transliterate(vin[i])
107
+
108
108
  return nil if value_weight.nil?
109
109
 
110
110
  sum += value_weight * map.index(weights[i])
111
111
  end
112
- return map[sum % 11]
112
+
113
+ map[sum % 11]
113
114
  end
114
115
 
115
116
  # Combines T2 and NHTSA's results. Will attempt to create `VinValidator::Result`s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VinValidator
4
- VERSION = '1.0.0-rc.1'
4
+ VERSION = '1.0.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.0.0.pre.rc.1
4
+ version: 1.0.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance