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 +4 -4
- data/README.md +2 -0
- data/VERSION +1 -1
- data/bank-validator.gemspec +3 -3
- data/lib/active_model/routing_number_validator.rb +5 -1
- data/test/dummy/Gemfile.lock +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49faff0bcd5e27910cf566ce176927797ecf639
|
4
|
+
data.tar.gz: 9c3eef67cf8c6a4d777bb6226691fd1c4ab2b88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
1
|
+
0.2.8
|
data/bank-validator.gemspec
CHANGED
@@ -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.
|
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.
|
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
|
+
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
|
-
((
|
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
|
data/test/dummy/Gemfile.lock
CHANGED
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.
|
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-
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|