IBAN 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -12
- data/iban.gemspec +2 -2
- data/lib/active_model/iban_validator.rb +5 -0
- data/lib/iban.rb +16 -4
- data/lib/iban/specs.yml +231 -157
- data/lib/iban/version.rb +1 -1
- data/spec/iban_spec.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05384522e8cc437be731e5beb0df9d53825c09a7
|
4
|
+
data.tar.gz: 47050586e11b101829d9877d62140e4a19f9a905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 240a7bcc243999d0a3223eebedc4cf910ffe631d4f58d7547e1ec50f1cf2452800630a188a4cb70debb2bb4e20c2b75e0d47930e36d3d33dacca5f3bea4ea64d
|
7
|
+
data.tar.gz: a787d4f8320b2ec7d96730b9c236b4e1fd8b3cabfa79ee29b117f8fb2afe28b67d8286451e49a2890cdc717a406b5d85812ee46c6fa67485f0af23b525f6d35e
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# International Bank Account Number
|
2
2
|
|
3
|
-
IBAN validation and formatting
|
3
|
+
IBAN information, validation and formatting.
|
4
|
+
Ships with an ActiveModel validator.
|
4
5
|
|
5
6
|
[![Build Status](https://travis-ci.org/max-power/iban.png?branch=master)](https://travis-ci.org/max-power/iban)
|
6
7
|
|
@@ -8,7 +9,7 @@ IBAN validation and formatting
|
|
8
9
|
|
9
10
|
Add this line to your application's Gemfile:
|
10
11
|
|
11
|
-
gem '
|
12
|
+
gem 'IBAN'
|
12
13
|
|
13
14
|
And then execute:
|
14
15
|
|
@@ -16,26 +17,28 @@ And then execute:
|
|
16
17
|
|
17
18
|
Or install it yourself as:
|
18
19
|
|
19
|
-
$ gem install
|
20
|
+
$ gem install IBAN
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
|
-
iban = IBAN.new(
|
24
|
+
iban = IBAN.new("DE89 3704 0044 0532 0130 00")
|
24
25
|
|
25
|
-
iban.country_code
|
26
|
-
iban.check_digits
|
27
|
-
iban.bban
|
26
|
+
iban.country_code # "DE"
|
27
|
+
iban.check_digits # "89"
|
28
|
+
iban.bban # "370400440532013000"
|
29
|
+
iban.account_number # "0532013000"
|
30
|
+
iban.bank_identifier # "37040044"
|
28
31
|
|
29
|
-
iban.valid?
|
32
|
+
iban.valid? # true
|
30
33
|
|
31
|
-
iban.to_s
|
32
|
-
iban.to_s(true)
|
34
|
+
iban.to_s # "DE89370400440532013000"
|
35
|
+
iban.to_s(true) # "DE89 3704 0044 0532 0130 00"
|
33
36
|
|
34
|
-
iban.to_i
|
37
|
+
iban.to_i # 370400440532013000131489
|
35
38
|
|
36
39
|
# or
|
37
40
|
|
38
|
-
IBAN.valid?
|
41
|
+
IBAN.valid? "DE89 3704 0044 0532 0130 00" # true
|
39
42
|
|
40
43
|
|
41
44
|
## Contributing
|
data/iban.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Kevin"]
|
11
11
|
spec.email = ["kevin.melchert@gmail.com"]
|
12
12
|
spec.description = %q{IBAN: International Bank Account Number}
|
13
|
-
spec.summary = %q{IBAN validation}
|
14
|
-
spec.homepage = ""
|
13
|
+
spec.summary = %q{IBAN information, validation and formatting.}
|
14
|
+
spec.homepage = "https://github.com/max-power/iban"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
data/lib/iban.rb
CHANGED
@@ -28,7 +28,7 @@ class IBAN
|
|
28
28
|
def to_i
|
29
29
|
"#{bban}#{country_code}#{check_digits}".each_byte.map do |byte|
|
30
30
|
case byte
|
31
|
-
when 48..57 then byte - 48 # 0..9
|
31
|
+
when 48..57 then byte - 48 # 0..9
|
32
32
|
when 65..90 then byte - 55 # A..Z
|
33
33
|
else raise RuntimeError.new("Unexpected byte '#{byte}' in IBAN code '#{@code}'")
|
34
34
|
end
|
@@ -52,12 +52,24 @@ class IBAN
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def valid_bban?
|
55
|
-
!!
|
55
|
+
!!bban_data
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
|
+
def respond_to?(method_name, include_private=false)
|
59
|
+
(bban_data && bban_data.names.include?(method_name.to_s)) || super
|
60
|
+
end
|
61
|
+
|
58
62
|
private
|
59
63
|
|
60
64
|
def specification
|
61
|
-
self.class.specifications[country_code.downcase]
|
65
|
+
@specification ||= self.class.specifications[country_code.downcase]
|
66
|
+
end
|
67
|
+
|
68
|
+
def bban_data
|
69
|
+
@bban_data ||= Regexp.new("^#{specification['regexp']}$").match(bban) if specification
|
70
|
+
end
|
71
|
+
|
72
|
+
def method_missing(method_name, *args)
|
73
|
+
respond_to?(method_name) ? bban_data[method_name] : super
|
62
74
|
end
|
63
75
|
end
|
data/lib/iban/specs.yml
CHANGED
@@ -1,332 +1,406 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# http://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
|
2
|
+
# http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
|
3
|
+
|
4
|
+
al: # Albania
|
3
5
|
length: 28
|
4
|
-
regexp: '\d{8}[A-Z0-9]{16}'
|
6
|
+
# regexp: '\d{8}[A-Z0-9]{16}'
|
7
|
+
regexp: '(?<bank_identifier>\d{8})(?<account_number>[A-Z0-9]{16})'
|
5
8
|
|
6
|
-
ad:
|
9
|
+
ad: # Andorra
|
7
10
|
length: 24
|
8
|
-
regexp: '\d{8}[A-Z0-9]{12}'
|
11
|
+
# regexp: '\d{8}[A-Z0-9]{12}'
|
12
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{4})(?<account_number>[A-Z0-9]{12})'
|
9
13
|
|
10
|
-
at:
|
14
|
+
at: # Austria
|
11
15
|
length: 20
|
12
|
-
regexp: '\d{16}'
|
16
|
+
# regexp: '\d{16}'
|
17
|
+
regexp: '(?<bank_identifier>\d{5})(?<account_number>\d{11})'
|
13
18
|
|
14
|
-
az:
|
19
|
+
az: # Azerbaijan
|
15
20
|
length: 28
|
16
|
-
regexp: '[A-Z0-9]{4}\d{20}'
|
21
|
+
# regexp: '[A-Z0-9]{4}\d{20}'
|
22
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{4})(?<account_number>\d{20})'
|
17
23
|
|
18
|
-
bh:
|
24
|
+
bh: # Bahrain
|
19
25
|
length: 22
|
20
|
-
regexp: '[A-Z]{4}[A-Z0-9]{14}'
|
26
|
+
# regexp: '[A-Z]{4}[A-Z0-9]{14}'
|
27
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>[A-Z0-9]{14})'
|
21
28
|
|
22
|
-
be:
|
29
|
+
be: # Belgium
|
23
30
|
length: 16
|
24
|
-
regexp: '\d{12}'
|
31
|
+
# regexp: '\d{12}'
|
32
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>\d{7})(?<national_check_digits>\d{2})'
|
25
33
|
|
26
|
-
ba:
|
34
|
+
ba: # Bosnia and Herzegovina
|
27
35
|
length: 20
|
28
|
-
regexp: '\d{16}'
|
36
|
+
# regexp: '\d{16}'
|
37
|
+
regexp: '(?<bank_identifier>\d{3})(?<branch_identifier>\d{3})(?<account_number>\d{8})(?<national_check_digits>\d{2})'
|
29
38
|
|
30
|
-
br:
|
39
|
+
br: # Brazil
|
31
40
|
length: 29
|
32
|
-
regexp: '\d{23}[A-Z][A-Z0-9]'
|
41
|
+
# regexp: '\d{23}[A-Z][A-Z0-9]'
|
42
|
+
regexp: '(?<bank_identifier>\d{8})(?<branch_identifier>\d{5})(?<account_number>\d{10})(?<account_type>[A-Z])(?<account_owner>[A-Z0-9])'
|
33
43
|
|
34
|
-
|
35
|
-
length: 29
|
36
|
-
regexp: '\d{23}[A-Z][A-Z0-9]'
|
37
|
-
|
38
|
-
bg:
|
44
|
+
bg: # Bulgaria
|
39
45
|
length: 22
|
40
|
-
regexp: '[A-Z]{4}\d{6}[A-Z0-9]{8}'
|
46
|
+
# regexp: '[A-Z]{4}\d{6}[A-Z0-9]{8}'
|
47
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<branch_identifier>\d{4})(?<account_type>\d{2})(?<account_number>[A-Z0-9]{8})'
|
41
48
|
|
42
|
-
cr:
|
49
|
+
cr: # Costa Rica
|
43
50
|
length: 21
|
44
|
-
regexp: '\d{17}'
|
51
|
+
# regexp: '\d{17}'
|
52
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>\d{14})'
|
45
53
|
|
46
|
-
hr:
|
54
|
+
hr: # Croatia
|
47
55
|
length: 21
|
48
|
-
regexp: '\d{17}'
|
56
|
+
# regexp: '\d{17}'
|
57
|
+
regexp: '(?<bank_identifier>\d{7})(?<account_number>\d{10})'
|
49
58
|
|
50
|
-
cy:
|
59
|
+
cy: # Cyprus
|
51
60
|
length: 28
|
52
|
-
regexp: '\d{8}[A-Z0-9]{16}'
|
61
|
+
# regexp: '\d{8}[A-Z0-9]{16}'
|
62
|
+
regexp: '(?<bank_identifier>\d{3})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{16})'
|
53
63
|
|
54
|
-
cz:
|
64
|
+
cz: # Czech Republic
|
55
65
|
length: 24
|
56
|
-
regexp: '\d{20}'
|
66
|
+
# regexp: '\d{20}'
|
67
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>\d{6}\d{10})'
|
68
|
+
|
69
|
+
de: # Germany
|
70
|
+
length: 22
|
71
|
+
# regexp: '\d{18}'
|
72
|
+
regexp: '(?<bank_identifier>\d{8})(?<account_number>\d{10})'
|
57
73
|
|
58
|
-
dk:
|
74
|
+
dk: # Denmark
|
75
|
+
length: 18
|
76
|
+
# regexp: '\d{14}'
|
77
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>\d{9})(?<national_check_digits>\d{1})'
|
78
|
+
|
79
|
+
gl: # Greenland (same as Denmark)
|
80
|
+
length: 18
|
81
|
+
# regexp: '\d{14}'
|
82
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>\d{9})(?<national_check_digits>\d{1})'
|
83
|
+
|
84
|
+
fo: # Faroe Islands (same as Denmark)
|
59
85
|
length: 18
|
60
|
-
regexp: '\d{14}'
|
86
|
+
# regexp: '\d{14}'
|
87
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>\d{9})(?<national_check_digits>\d{1})'
|
61
88
|
|
62
|
-
do:
|
89
|
+
do: # Dominican Republic
|
63
90
|
length: 28
|
64
|
-
regexp: '[A-Z]{4}\d{20}'
|
91
|
+
# regexp: '[A-Z]{4}\d{20}'
|
92
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>\d{20})'
|
65
93
|
|
66
|
-
ee:
|
94
|
+
ee: # Estonia
|
67
95
|
length: 20
|
68
|
-
regexp: '\d{16}'
|
96
|
+
# regexp: '\d{16}'
|
97
|
+
regexp: '(?<bank_identifier>\d{2})(?<branch_identifier>\d{2})(?<account_number>\d{11})(?<national_check_digits>\d{1})'
|
69
98
|
|
70
|
-
|
99
|
+
fi: # Finland
|
71
100
|
length: 18
|
72
|
-
regexp: '\d{14}'
|
101
|
+
# regexp: '\d{14}'
|
102
|
+
regexp: '(?<bank_identifier>\d{6})(?<account_number>\d{7})(?<national_check_digits>\d{1})'
|
73
103
|
|
74
|
-
|
75
|
-
length: 18
|
76
|
-
regexp: '\d{14}'
|
77
|
-
|
78
|
-
fr:
|
104
|
+
fr: # France
|
79
105
|
length: 27
|
80
|
-
regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
106
|
+
# regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
107
|
+
regexp: '(?<bank_identifier>\d{5})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{11})(?<national_check_digits>\d{2})'
|
81
108
|
|
82
|
-
|
109
|
+
ge: # Georgia
|
83
110
|
length: 22
|
84
|
-
regexp: '\d{
|
85
|
-
|
86
|
-
|
111
|
+
# regexp: '[A-Z]{2}\d{16}'
|
112
|
+
regexp: '(?<bank_identifier>[A-Z]{2})(?<account_number>\d{16})'
|
113
|
+
|
114
|
+
gi: # Gibraltar
|
87
115
|
length: 23
|
88
|
-
regexp: '[A-Z]{4}[A-Z0-9]{15}'
|
116
|
+
# regexp: '[A-Z]{4}[A-Z0-9]{15}'
|
117
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>[A-Z0-9]{15})'
|
89
118
|
|
90
|
-
gr:
|
119
|
+
gr: # Greece
|
91
120
|
length: 27
|
92
|
-
regexp: '\d{7}[A-Z0-9]{16}'
|
93
|
-
|
94
|
-
gl:
|
95
|
-
length: 18
|
96
|
-
regexp: '\d{14}'
|
121
|
+
# regexp: '\d{7}[A-Z0-9]{16}'
|
122
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{3})(?<account_number>[A-Z0-9]{16})'
|
97
123
|
|
98
|
-
gt:
|
124
|
+
gt: # Guatemala
|
99
125
|
length: 28
|
100
|
-
regexp: '[A-Z0-9]{4}[A-Z0-9]{20}'
|
126
|
+
# regexp: '[A-Z0-9]{4}[A-Z0-9]{20}'
|
127
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{4})(?<account_number>[A-Z0-9]{20})'
|
101
128
|
|
102
|
-
hu:
|
129
|
+
hu: # Hungary
|
103
130
|
length: 28
|
104
|
-
regexp: '\d{24}'
|
131
|
+
# regexp: '\d{24}'
|
132
|
+
regexp: '(?<bank_identifier>\d{3})(?<branch_identifier>\d{4})(?<account_number>\d{1}\d{15})(?<national_check_digits>\d{1})'
|
105
133
|
|
106
|
-
is:
|
134
|
+
is: # Iceland
|
107
135
|
length: 26
|
108
|
-
regexp: '\d{22}'
|
136
|
+
# regexp: '\d{22}'
|
137
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{2})(?<account_number>\d{6}\d{10})'
|
109
138
|
|
110
|
-
ie:
|
139
|
+
ie: # Ireland
|
111
140
|
length: 22
|
112
|
-
regexp: '[A-Z0-9]{4}\d{14}'
|
141
|
+
# regexp: '[A-Z0-9]{4}\d{14}'
|
142
|
+
regexp: '(?<branch_identifier>[A-Z0-9]{4})(?<branch_identifier>\d{6})(?<account_number>\d{8})'
|
113
143
|
|
114
|
-
il:
|
144
|
+
il: # Israel
|
115
145
|
length: 23
|
116
|
-
regexp: '\d{19}'
|
146
|
+
# regexp: '\d{19}'
|
147
|
+
regexp: '(?<bank_identifier>\d{3})(?<branch_identifier>\d{3})(?<account_number>\d{13})'
|
117
148
|
|
118
|
-
it:
|
149
|
+
it: # Italy
|
119
150
|
length: 27
|
120
|
-
regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
151
|
+
# regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
152
|
+
regexp: '(?<national_check_digits>[A-Z])(?<bank_identifier>\d{5})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{12})'
|
121
153
|
|
122
|
-
kz:
|
154
|
+
kz: # Kazakhstan
|
123
155
|
length: 20
|
124
|
-
regexp: '\d{3}[A-Z0-9]{13}'
|
156
|
+
# regexp: '\d{3}[A-Z0-9]{13}'
|
157
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>[A-Z0-9]{13})'
|
125
158
|
|
126
|
-
kw:
|
159
|
+
kw: # Kuwait
|
127
160
|
length: 30
|
128
|
-
regexp: '[A-Z]{4}[A-Z0-9]{22}'
|
161
|
+
# regexp: '[A-Z]{4}[A-Z0-9]{22}'
|
162
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>[A-Z0-9]{22})'
|
129
163
|
|
130
|
-
lv:
|
164
|
+
lv: # Latvia
|
131
165
|
length: 21
|
132
|
-
regexp: '[A-
|
166
|
+
# regexp: '[A-Z]{4}[A-Z0-9]{13}'
|
167
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>[A-Z0-9]{13})'
|
133
168
|
|
134
|
-
lb:
|
169
|
+
lb: # Lebanon
|
135
170
|
length: 28
|
136
|
-
regexp: '\d{4}[A-Z0-9]{20}'
|
171
|
+
# regexp: '\d{4}[A-Z0-9]{20}'
|
172
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>[A-Z0-9]{20})'
|
137
173
|
|
138
|
-
li:
|
174
|
+
li: # Liechtenstein
|
139
175
|
length: 21
|
140
|
-
regexp: '\d{5}[A-Z0-9]{12}'
|
176
|
+
# regexp: '\d{5}[A-Z0-9]{12}'
|
177
|
+
regexp: '(?<bank_identifier>\d{5})(?<account_number>[A-Z0-9]{12})'
|
141
178
|
|
142
|
-
lt:
|
179
|
+
lt: # Lithuania
|
143
180
|
length: 20
|
144
|
-
regexp: '\d{16}'
|
181
|
+
# regexp: '\d{16}'
|
182
|
+
regexp: '(?<bank_identifier>\d{5})(?<account_number>\d{11})'
|
145
183
|
|
146
|
-
lu:
|
184
|
+
lu: # Luxembourg
|
147
185
|
length: 20
|
148
|
-
regexp: '\d{3}[A-Z0-9]{13}'
|
186
|
+
# regexp: '\d{3}[A-Z0-9]{13}'
|
187
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>[A-Z0-9]{13})'
|
149
188
|
|
150
|
-
mk:
|
189
|
+
mk: # Macedonia
|
151
190
|
length: 19
|
152
|
-
regexp: '\d{3}[A-Z0-9]{10}\d{2}'
|
191
|
+
# regexp: '\d{3}[A-Z0-9]{10}\d{2}'
|
192
|
+
regexp: '(?<branch_identifier>\d{3})(?<account_number>[A-Z0-9]{10})(?<national_check_digits>\d{2})'
|
153
193
|
|
154
|
-
mt:
|
194
|
+
mt: # Malta
|
155
195
|
length: 31
|
156
|
-
regexp: '[A-Z]{4}\d{5}[A-Z0-9]{18}'
|
196
|
+
# regexp: '[A-Z]{4}\d{5}[A-Z0-9]{18}'
|
197
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{18})'
|
157
198
|
|
158
|
-
mr:
|
199
|
+
mr: # Mauritania
|
159
200
|
length: 27
|
160
|
-
regexp: '\d{23}'
|
201
|
+
# regexp: '\d{23}'
|
202
|
+
regexp: '(?<bank_identifier>\d{5})(?<branch_identifier>\d{5})(?<account_number>\d{11})(?<national_check_digits>\d{2})'
|
161
203
|
|
162
|
-
mu:
|
204
|
+
mu: # Mauritius
|
163
205
|
length: 30
|
164
|
-
regexp: '[A-Z]{4}\d{19}[A-Z]{3}'
|
206
|
+
# regexp: '[A-Z]{4}\d{19}[A-Z]{3}'
|
207
|
+
regexp: '(?<bank_identifier>[A-Z]{4}\d{2})(?<branch_identifier>\d{2})(?<account_number>\d{12}\d{3}[A-Z]{3})'
|
165
208
|
|
166
|
-
mc:
|
209
|
+
mc: # Monaco
|
167
210
|
length: 27
|
168
|
-
regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
211
|
+
# regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
212
|
+
regexp: '(?<bank_identifier>\d{5})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{11})(?<national_check_digits>\d{2})'
|
169
213
|
|
170
|
-
md:
|
214
|
+
md: # Moldova
|
171
215
|
length: 24
|
172
|
-
regexp: '[A-Z0-9]{2}\d{18}'
|
216
|
+
# regexp: '[A-Z0-9]{2}\d{18}'
|
217
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{2})(?<account_number>\d{18})'
|
173
218
|
|
174
|
-
me:
|
219
|
+
me: # Montenegro
|
175
220
|
length: 22
|
176
|
-
regexp: '\d{18}'
|
221
|
+
# regexp: '\d{18}'
|
222
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>(\d{13})(\d{2}))'
|
177
223
|
|
178
|
-
nl:
|
224
|
+
nl: # Netherlands
|
179
225
|
length: 18
|
180
|
-
regexp: '[A-Z]{4}\d{10}'
|
226
|
+
# regexp: '[A-Z]{4}\d{10}'
|
227
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>\d{10})'
|
181
228
|
|
182
|
-
'no':
|
229
|
+
'no': # Norway
|
183
230
|
length: 15
|
184
|
-
regexp: '\d{11}'
|
231
|
+
# regexp: '\d{11}'
|
232
|
+
regexp: '(?<bank_identifier>\d{4})(?<account_number>(\d{6})(\d{1}))'
|
185
233
|
|
186
|
-
pk:
|
234
|
+
pk: # Pakistan
|
187
235
|
length: 24
|
188
|
-
regexp: '[A-Z0-9]{4}\d{16}'
|
236
|
+
# regexp: '[A-Z0-9]{4}\d{16}'
|
237
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{4})(?<account_number>\d{16})'
|
189
238
|
|
190
|
-
ps:
|
239
|
+
ps: # Palestine
|
191
240
|
length: 29
|
192
|
-
regexp: '[A-Z0-9]{4}\d{21}'
|
241
|
+
# regexp: '[A-Z0-9]{4}\d{21}'
|
242
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{4})(?<account_number>\d{21})'
|
193
243
|
|
194
|
-
pl:
|
244
|
+
pl: # Poland
|
195
245
|
length: 28
|
196
|
-
regexp: '\d{24}'
|
246
|
+
# regexp: '\d{24}'
|
247
|
+
regexp: '(?<bank_identifier>\d{8})(?<account_number>\d{16})'
|
197
248
|
|
198
|
-
pt:
|
249
|
+
pt: # Portugal
|
199
250
|
length: 25
|
200
|
-
regexp: '\d{21}'
|
251
|
+
# regexp: '\d{21}'
|
252
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{4})(?<account_number>\d{11})(?<national_check_digits>\d{2})'
|
201
253
|
|
202
|
-
ro:
|
254
|
+
ro: # Romania
|
203
255
|
length: 24
|
204
|
-
regexp: '[A-Z]{4}[A-Z0-9]{16}'
|
256
|
+
# regexp: '[A-Z]{4}[A-Z0-9]{16}'
|
257
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<account_number>[A-Z0-9]{16})'
|
205
258
|
|
206
|
-
sm:
|
259
|
+
sm: # San Marino
|
207
260
|
length: 27
|
208
|
-
regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
261
|
+
# regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
262
|
+
regexp: '(?<national_check_digits>[A-Z])(?<bank_identifier>\d{5})(?<branch_identifier>\d{5})(?<account_number>[A-Z0-9]{12})'
|
209
263
|
|
210
|
-
sa:
|
264
|
+
sa: # Saudi Arabia
|
211
265
|
length: 24
|
212
|
-
regexp: '\d{2}[A-Z0-9]{18}'
|
266
|
+
# regexp: '\d{2}[A-Z0-9]{18}'
|
267
|
+
regexp: '(?<bank_identifier>\d{2})(?<account_number>[A-Z0-9]{18})'
|
213
268
|
|
214
|
-
rs:
|
269
|
+
rs: # Serbia
|
215
270
|
length: 22
|
216
|
-
regexp: '\d{18}'
|
271
|
+
# regexp: '\d{18}'
|
272
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>\d{13})(?<national_check_digits>\d{2})'
|
217
273
|
|
218
|
-
sk:
|
274
|
+
sk: # Slovak Republic
|
219
275
|
length: 24
|
220
|
-
regexp: '\d{20}'
|
276
|
+
# regexp: '\d{20}'
|
277
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{6})(?<account_number>\d{10})'
|
221
278
|
|
222
|
-
si:
|
279
|
+
si: # Slovenia
|
223
280
|
length: 19
|
224
|
-
regexp: '\d{15}'
|
281
|
+
# regexp: '\d{15}'
|
282
|
+
regexp: '(?<bank_identifier>\d{5})(?<account_number>\d{8})(?<national_check_digits>\d{2})'
|
225
283
|
|
226
|
-
es:
|
284
|
+
es: # Spain
|
227
285
|
length: 24
|
228
|
-
regexp: '\d{20}'
|
286
|
+
# regexp: '\d{20}'
|
287
|
+
regexp: '(?<bank_identifier>\d{4})(?<branch_identifier>\d{4})(?<national_check_digits>\d{1}\d{1})(?<account_number>\d{10})'
|
229
288
|
|
230
|
-
se:
|
289
|
+
se: # Sweden
|
231
290
|
length: 24
|
232
|
-
regexp: '\d{20}'
|
291
|
+
# regexp: '\d{20}'
|
292
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>\d{16}\d{1})'
|
233
293
|
|
234
|
-
ch:
|
294
|
+
ch: # Switzerland
|
235
295
|
length: 21
|
236
|
-
regexp: '\d{5}[A-Z0-9]{12}'
|
296
|
+
# regexp: '\d{5}[A-Z0-9]{12}'
|
297
|
+
regexp: '(?<bank_identifier>\d{5})(?<account_number>[A-Z0-9]{12})'
|
237
298
|
|
238
|
-
tn:
|
299
|
+
tn: # Tunisia
|
239
300
|
length: 24
|
240
|
-
regexp: '\d{20}'
|
301
|
+
# regexp: '\d{20}'
|
302
|
+
regexp: '(?<bank_identifier>\d{2})(?<branch_identifier>\d{3})(?<account_number>\d{13}\d{2})'
|
241
303
|
|
242
|
-
tr:
|
304
|
+
tr: # Turkey
|
243
305
|
length: 26
|
244
|
-
regexp: '\d{5}[A-Z0-9]{17}'
|
306
|
+
# regexp: '\d{5}[A-Z0-9]{17}'
|
307
|
+
regexp: '(?<bank_identifier>\d{5})([A-Z0-9])(?<account_number>[A-Z0-9]{16})'
|
245
308
|
|
246
|
-
ae:
|
309
|
+
ae: # United Arab Emirates
|
247
310
|
length: 23
|
248
|
-
regexp: '\d{3}\d{16}'
|
311
|
+
# regexp: '\d{3}\d{16}'
|
312
|
+
regexp: '(?<bank_identifier>\d{3})(?<account_number>\d{16})'
|
249
313
|
|
250
|
-
gb:
|
314
|
+
gb: # United Kingdom
|
251
315
|
length: 22
|
252
|
-
regexp: '[A-Z]{4}\d{14}'
|
316
|
+
# regexp: '[A-Z]{4}\d{14}'
|
317
|
+
regexp: '(?<bank_identifier>[A-Z]{4})(?<branch_identifier>\d{6})(?<account_number>\d{8})'
|
253
318
|
|
254
|
-
vg:
|
319
|
+
vg: # Virgin Islands, British
|
255
320
|
length: 24
|
256
|
-
regexp: '[A-Z0-9]{4}\d{16}'
|
321
|
+
# regexp: '[A-Z0-9]{4}\d{16}'
|
322
|
+
regexp: '(?<bank_identifier>[A-Z0-9]{4})(?<account_number>\d{16})'
|
257
323
|
|
258
324
|
# In addition to the above list, Nordea has catalogued IBANs for countries listed below.[32]
|
259
325
|
|
260
|
-
ao:
|
326
|
+
ao: # Angola
|
261
327
|
length: 25
|
328
|
+
# regexp: '\d{21}'
|
262
329
|
regexp: '\d{21}'
|
263
330
|
|
264
|
-
bj:
|
331
|
+
bj: # Benin
|
265
332
|
length: 28
|
333
|
+
# regexp: '[A-Z]\d{23}'
|
266
334
|
regexp: '[A-Z]\d{23}'
|
267
335
|
|
268
|
-
bf:
|
336
|
+
bf: # Burkina Faso
|
269
337
|
length: 27
|
338
|
+
# regexp: '\d{23}'
|
270
339
|
regexp: '\d{23}'
|
271
340
|
|
272
|
-
bi:
|
341
|
+
bi: # Burundi
|
273
342
|
length: 16
|
343
|
+
# regexp: '\d{12}'
|
274
344
|
regexp: '\d{12}'
|
275
345
|
|
276
|
-
cm:
|
346
|
+
cm: # Cameroon
|
277
347
|
length: 27
|
348
|
+
# regexp: '\d{23}'
|
278
349
|
regexp: '\d{23}'
|
279
350
|
|
280
|
-
cv:
|
351
|
+
cv: # Cape Verde
|
281
352
|
length: 25
|
353
|
+
# regexp: '\d{21}'
|
282
354
|
regexp: '\d{21}'
|
283
355
|
|
284
|
-
ir:
|
356
|
+
ir: # Iran
|
285
357
|
length: 26
|
358
|
+
# regexp: '\d{22}'
|
286
359
|
regexp: '\d{22}'
|
287
360
|
|
288
|
-
ci:
|
361
|
+
ci: # Ivory Coast
|
289
362
|
length: 28
|
363
|
+
# regexp: '[A-Z]\d{23}'
|
290
364
|
regexp: '[A-Z]\d{23}'
|
291
365
|
|
292
|
-
mg:
|
366
|
+
mg: # Madagascar
|
293
367
|
length: 27
|
368
|
+
# regexp: '\d{23}'
|
294
369
|
regexp: '\d{23}'
|
295
370
|
|
296
|
-
ml:
|
371
|
+
ml: # Mali
|
297
372
|
length: 28
|
373
|
+
# regexp: '[A-Z]\d{23}'
|
298
374
|
regexp: '[A-Z]\d{23}'
|
299
375
|
|
300
|
-
mz:
|
376
|
+
mz: # Mozambique
|
301
377
|
length: 25
|
378
|
+
# regexp: '\d{21}'
|
302
379
|
regexp: '\d{21}'
|
303
380
|
|
304
|
-
sn:
|
381
|
+
sn: # Senegal
|
305
382
|
length: 28
|
383
|
+
# regexp: '[A-Z]\d{23}'
|
306
384
|
regexp: '[A-Z]\d{23}'
|
307
385
|
|
308
386
|
# not quite sure about these:
|
309
387
|
|
310
388
|
# cg: # Republic Congo
|
311
389
|
# length: 27
|
312
|
-
#
|
390
|
+
# # regexp: ''
|
313
391
|
#
|
314
392
|
# dz: # Algeria
|
315
393
|
# length: 24
|
316
|
-
#
|
394
|
+
# # regexp: ''
|
317
395
|
#
|
318
396
|
# eg: # Egypt
|
319
397
|
# length: 27
|
320
|
-
#
|
398
|
+
# # regexp: ''
|
321
399
|
#
|
322
400
|
# ga: # Gabun
|
323
401
|
# length: 27
|
324
|
-
#
|
325
|
-
#
|
326
|
-
# ge: # Georgia
|
327
|
-
# length: 22
|
328
|
-
# regexp: ''
|
402
|
+
# # regexp: ''
|
329
403
|
#
|
330
404
|
# ua: # Ukraine
|
331
405
|
# length: 29
|
332
|
-
|
406
|
+
## regexp: ''
|
data/lib/iban/version.rb
CHANGED
data/spec/iban_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: IBAN
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,12 +66,13 @@ files:
|
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- iban.gemspec
|
69
|
+
- lib/active_model/iban_validator.rb
|
69
70
|
- lib/iban.rb
|
70
71
|
- lib/iban/specs.yml
|
71
72
|
- lib/iban/version.rb
|
72
73
|
- spec/iban_spec.rb
|
73
74
|
- spec/spec_helper.rb
|
74
|
-
homepage:
|
75
|
+
homepage: https://github.com/max-power/iban
|
75
76
|
licenses:
|
76
77
|
- MIT
|
77
78
|
metadata: {}
|
@@ -94,7 +95,7 @@ rubyforge_project:
|
|
94
95
|
rubygems_version: 2.0.3
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
|
-
summary: IBAN validation
|
98
|
+
summary: IBAN information, validation and formatting.
|
98
99
|
test_files:
|
99
100
|
- spec/iban_spec.rb
|
100
101
|
- spec/spec_helper.rb
|