bank-validator 0.2.7 → 0.2.8

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
  SHA1:
3
- metadata.gz: 807273f16dc0e267557227693e9bf4529c061cec
4
- data.tar.gz: b08467338faedf112b8673466d452525ac295c19
3
+ metadata.gz: f49faff0bcd5e27910cf566ce176927797ecf639
4
+ data.tar.gz: 9c3eef67cf8c6a4d777bb6226691fd1c4ab2b88e
5
5
  SHA512:
6
- metadata.gz: b2440fe62e88868ac32e767c2e330ce070d69b52955c9b6e4dc17b4623321c73122c341f15219b6388bfe7b1e4381d34f7908ced924add8fb0fb34350866c4a5
7
- data.tar.gz: a6908c652a3e1af8607ae3fb4022a10cd651debd6a915c4f867deeebe041c0c5536d929409437ad99017276ca1b9d2e2210993bc1629ccc33d8342ab2ec18358
6
+ metadata.gz: 8892e7baee39182971b77f7796a361315af96de85aa1128573eb389830905f118dcb7a3df2c7c34bdb914e7a006c5e069ca887f6883ce8c5110f53978693ea98
7
+ data.tar.gz: e7810dfe4e9e4b61d7ef748e3dc9b91467485c762e315c35f42f4050386c896c376a25d91780bd91820d438021fb324a8be7bca3c4d2e47fcdf9941f598724c0
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/declarus/bank-validator.svg)](https://travis-ci.org/declarus/bank-validator)
2
+
1
3
  # bank-validator
2
4
 
3
5
  bank-validator lets you validate different bank account numbers. A validated number means that the number follows the correct format has the correct checksum, which means it *could* be a real bank account. Currently supported formats are:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.8
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bank-validator 0.2.7 ruby lib
5
+ # stub: bank-validator 0.2.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bank-validator"
9
- s.version = "0.2.7"
9
+ s.version = "0.2.8"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Adam Bahlke"]
14
- s.date = "2015-04-14"
14
+ s.date = "2015-04-20"
15
15
  s.description = "Validates IBAN and BIC account numbers. Still a work in progress"
16
16
  s.email = "adam.bahlke@hitfoxgroup.com"
17
17
  s.extra_rdoc_files = [
@@ -19,6 +19,10 @@ class RoutingNumberValidator < ActiveModel::EachValidator
19
19
  def valid_routing_number?(route_number)
20
20
  d = route_number.each_char.to_a
21
21
 
22
- ((3 * (d[0].to_i + d[3].to_i + d[6].to_i)) + (7 * (d[1].to_i + d[4].to_i + d[7].to_i)) + (d[2].to_i + d[5].to_i + d[8].to_i)) % 10 == 0
22
+ (weighted_value(1, d, [2, 5, 8]) + weighted_value(3, d, [0, 3, 6]) + weighted_value(7, d, [1, 4, 7])) % 10 == 0
23
+ end
24
+
25
+ def weighted_value(weight, array, indexes)
26
+ weight * array.values_at(*indexes).collect! {|v| v.to_i}.inject(:+)
23
27
  end
24
28
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ~/Workspace/bank-validator
3
3
  specs:
4
- bank-validator (0.2.5)
4
+ bank-validator (0.2.7)
5
5
  activemodel (>= 3.0)
6
6
 
7
7
  GEM
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bank-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bahlke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-14 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel