IBAN 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +10 -0
- data/iban.gemspec +25 -0
- data/lib/iban.rb +63 -0
- data/lib/iban/specs.yml +332 -0
- data/lib/iban/version.rb +3 -0
- data/spec/iban_spec.rb +134 -0
- data/spec/spec_helper.rb +8 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 160b4963be5a276c90d654aa181897d9af2c0fdd
|
4
|
+
data.tar.gz: 4360a66f06acf0168901eaf1a26f1a50ff51616a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e92682150285f417e3577508a63d7bdc759ea04fcc5543b0de6c1fd42c3fd3eed1fe3b72a211a370734924748bcdaaac9231f068f7e7f9d2eec81cc1a678bc56
|
7
|
+
data.tar.gz: f6e5eceeee6f5ecda0ac6c3894c4cdc3b55b7e5d7e90d1fd0fa72ffdbf27a5d1bb58bfc030c799483859d882feee6b1e085aed5ff95ad573767af5ef2b73feff
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kevin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# International Bank Account Number
|
2
|
+
|
3
|
+
IBAN validation and formatting
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/max-power/iban.png?branch=master)](https://travis-ci.org/max-power/iban)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'iban'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install iban
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
iban = IBAN.new('GR16 0110 1250 0000 0001 2300 695')
|
24
|
+
|
25
|
+
iban.country_code # GR
|
26
|
+
iban.check_digits # 16
|
27
|
+
iban.bban # 01101250000000012300695
|
28
|
+
|
29
|
+
iban.valid? # true
|
30
|
+
|
31
|
+
iban.to_s # 'GR1601101250000000012300695'
|
32
|
+
iban.to_s(true) # 'GR16 0110 1250 0000 0001 2300 695'
|
33
|
+
|
34
|
+
iban.to_i # 1101250000000012300695162716
|
35
|
+
|
36
|
+
# or
|
37
|
+
|
38
|
+
IBAN.valid? 'GR16 0110 1250 0000 0001 2300 695' # true
|
39
|
+
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/iban.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'iban/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "IBAN"
|
9
|
+
spec.version = IBAN::VERSION
|
10
|
+
spec.authors = ["Kevin"]
|
11
|
+
spec.email = ["kevin.melchert@gmail.com"]
|
12
|
+
spec.description = %q{IBAN: International Bank Account Number}
|
13
|
+
spec.summary = %q{IBAN validation}
|
14
|
+
spec.homepage = ""
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files`.split($/)
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency 'minitest', "~> 4.2"
|
25
|
+
end
|
data/lib/iban.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class IBAN
|
4
|
+
def self.specifications
|
5
|
+
@@specs ||= YAML.load_file(File.expand_path('iban/specs.yml', File.dirname(__FILE__)))
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.valid?(code)
|
9
|
+
new(code).valid?
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(code)
|
13
|
+
@code = code.strip.gsub(/\s+/, '').upcase
|
14
|
+
end
|
15
|
+
|
16
|
+
def country_code
|
17
|
+
@code[0..1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_digits
|
21
|
+
@code[2..3]
|
22
|
+
end
|
23
|
+
|
24
|
+
def bban
|
25
|
+
@code[4..-1]
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_i
|
29
|
+
"#{bban}#{country_code}#{check_digits}".each_byte.map do |byte|
|
30
|
+
case byte
|
31
|
+
when 48..57 then byte - 48 # 0..9 # or byte.chr
|
32
|
+
when 65..90 then byte - 55 # A..Z
|
33
|
+
else raise RuntimeError.new("Unexpected byte '#{byte}' in IBAN code '#{@code}'")
|
34
|
+
end
|
35
|
+
end.join.to_i
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s(formatted=false)
|
39
|
+
formatted ? @code.gsub(/(.{4})/, '\1 ').strip : @code
|
40
|
+
end
|
41
|
+
|
42
|
+
def valid?
|
43
|
+
valid_check_digits? && valid_length? && valid_bban?
|
44
|
+
end
|
45
|
+
|
46
|
+
def valid_check_digits?
|
47
|
+
to_i % 97 == 1
|
48
|
+
end
|
49
|
+
|
50
|
+
def valid_length?
|
51
|
+
!!specification && specification['length'] == @code.length
|
52
|
+
end
|
53
|
+
|
54
|
+
def valid_bban?
|
55
|
+
!!specification && !!(bban =~ Regexp.new("^#{specification['regexp']}$"))
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def specification
|
61
|
+
self.class.specifications[country_code.downcase]
|
62
|
+
end
|
63
|
+
end
|
data/lib/iban/specs.yml
ADDED
@@ -0,0 +1,332 @@
|
|
1
|
+
# Source: http://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country
|
2
|
+
al:
|
3
|
+
length: 28
|
4
|
+
regexp: '\d{8}[A-Z0-9]{16}'
|
5
|
+
|
6
|
+
ad:
|
7
|
+
length: 24
|
8
|
+
regexp: '\d{8}[A-Z0-9]{12}'
|
9
|
+
|
10
|
+
at:
|
11
|
+
length: 20
|
12
|
+
regexp: '\d{16}'
|
13
|
+
|
14
|
+
az:
|
15
|
+
length: 28
|
16
|
+
regexp: '[A-Z0-9]{4}\d{20}'
|
17
|
+
|
18
|
+
bh:
|
19
|
+
length: 22
|
20
|
+
regexp: '[A-Z]{4}[A-Z0-9]{14}'
|
21
|
+
|
22
|
+
be:
|
23
|
+
length: 16
|
24
|
+
regexp: '\d{12}'
|
25
|
+
|
26
|
+
ba:
|
27
|
+
length: 20
|
28
|
+
regexp: '\d{16}'
|
29
|
+
|
30
|
+
br:
|
31
|
+
length: 29
|
32
|
+
regexp: '\d{23}[A-Z][A-Z0-9]'
|
33
|
+
|
34
|
+
br:
|
35
|
+
length: 29
|
36
|
+
regexp: '\d{23}[A-Z][A-Z0-9]'
|
37
|
+
|
38
|
+
bg:
|
39
|
+
length: 22
|
40
|
+
regexp: '[A-Z]{4}\d{6}[A-Z0-9]{8}'
|
41
|
+
|
42
|
+
cr:
|
43
|
+
length: 21
|
44
|
+
regexp: '\d{17}'
|
45
|
+
|
46
|
+
hr:
|
47
|
+
length: 21
|
48
|
+
regexp: '\d{17}'
|
49
|
+
|
50
|
+
cy:
|
51
|
+
length: 28
|
52
|
+
regexp: '\d{8}[A-Z0-9]{16}'
|
53
|
+
|
54
|
+
cz:
|
55
|
+
length: 24
|
56
|
+
regexp: '\d{20}'
|
57
|
+
|
58
|
+
dk:
|
59
|
+
length: 18
|
60
|
+
regexp: '\d{14}'
|
61
|
+
|
62
|
+
do:
|
63
|
+
length: 28
|
64
|
+
regexp: '[A-Z]{4}\d{20}'
|
65
|
+
|
66
|
+
ee:
|
67
|
+
length: 20
|
68
|
+
regexp: '\d{16}'
|
69
|
+
|
70
|
+
fo:
|
71
|
+
length: 18
|
72
|
+
regexp: '\d{14}'
|
73
|
+
|
74
|
+
fi:
|
75
|
+
length: 18
|
76
|
+
regexp: '\d{14}'
|
77
|
+
|
78
|
+
fr:
|
79
|
+
length: 27
|
80
|
+
regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
81
|
+
|
82
|
+
de:
|
83
|
+
length: 22
|
84
|
+
regexp: '\d{18}'
|
85
|
+
|
86
|
+
gi:
|
87
|
+
length: 23
|
88
|
+
regexp: '[A-Z]{4}[A-Z0-9]{15}'
|
89
|
+
|
90
|
+
gr:
|
91
|
+
length: 27
|
92
|
+
regexp: '\d{7}[A-Z0-9]{16}'
|
93
|
+
|
94
|
+
gl:
|
95
|
+
length: 18
|
96
|
+
regexp: '\d{14}'
|
97
|
+
|
98
|
+
gt:
|
99
|
+
length: 28
|
100
|
+
regexp: '[A-Z0-9]{4}[A-Z0-9]{20}'
|
101
|
+
|
102
|
+
hu:
|
103
|
+
length: 28
|
104
|
+
regexp: '\d{24}'
|
105
|
+
|
106
|
+
is:
|
107
|
+
length: 26
|
108
|
+
regexp: '\d{22}'
|
109
|
+
|
110
|
+
ie:
|
111
|
+
length: 22
|
112
|
+
regexp: '[A-Z0-9]{4}\d{14}'
|
113
|
+
|
114
|
+
il:
|
115
|
+
length: 23
|
116
|
+
regexp: '\d{19}'
|
117
|
+
|
118
|
+
it:
|
119
|
+
length: 27
|
120
|
+
regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
121
|
+
|
122
|
+
kz:
|
123
|
+
length: 20
|
124
|
+
regexp: '\d{3}[A-Z0-9]{13}'
|
125
|
+
|
126
|
+
kw:
|
127
|
+
length: 30
|
128
|
+
regexp: '[A-Z]{4}[A-Z0-9]{22}'
|
129
|
+
|
130
|
+
lv:
|
131
|
+
length: 21
|
132
|
+
regexp: '[A-z]{4}[A-Z0-9]{13}'
|
133
|
+
|
134
|
+
lb:
|
135
|
+
length: 28
|
136
|
+
regexp: '\d{4}[A-Z0-9]{20}'
|
137
|
+
|
138
|
+
li:
|
139
|
+
length: 21
|
140
|
+
regexp: '\d{5}[A-Z0-9]{12}'
|
141
|
+
|
142
|
+
lt:
|
143
|
+
length: 20
|
144
|
+
regexp: '\d{16}'
|
145
|
+
|
146
|
+
lu:
|
147
|
+
length: 20
|
148
|
+
regexp: '\d{3}[A-Z0-9]{13}'
|
149
|
+
|
150
|
+
mk:
|
151
|
+
length: 19
|
152
|
+
regexp: '\d{3}[A-Z0-9]{10}\d{2}'
|
153
|
+
|
154
|
+
mt:
|
155
|
+
length: 31
|
156
|
+
regexp: '[A-Z]{4}\d{5}[A-Z0-9]{18}'
|
157
|
+
|
158
|
+
mr:
|
159
|
+
length: 27
|
160
|
+
regexp: '\d{23}'
|
161
|
+
|
162
|
+
mu:
|
163
|
+
length: 30
|
164
|
+
regexp: '[A-Z]{4}\d{19}[A-Z]{3}'
|
165
|
+
|
166
|
+
mc:
|
167
|
+
length: 27
|
168
|
+
regexp: '\d{10}[A-Z0-9]{11}\d{2}'
|
169
|
+
|
170
|
+
md:
|
171
|
+
length: 24
|
172
|
+
regexp: '[A-Z0-9]{2}\d{18}'
|
173
|
+
|
174
|
+
me:
|
175
|
+
length: 22
|
176
|
+
regexp: '\d{18}'
|
177
|
+
|
178
|
+
nl:
|
179
|
+
length: 18
|
180
|
+
regexp: '[A-Z]{4}\d{10}'
|
181
|
+
|
182
|
+
'no':
|
183
|
+
length: 15
|
184
|
+
regexp: '\d{11}'
|
185
|
+
|
186
|
+
pk:
|
187
|
+
length: 24
|
188
|
+
regexp: '[A-Z0-9]{4}\d{16}'
|
189
|
+
|
190
|
+
ps:
|
191
|
+
length: 29
|
192
|
+
regexp: '[A-Z0-9]{4}\d{21}'
|
193
|
+
|
194
|
+
pl:
|
195
|
+
length: 28
|
196
|
+
regexp: '\d{24}'
|
197
|
+
|
198
|
+
pt:
|
199
|
+
length: 25
|
200
|
+
regexp: '\d{21}'
|
201
|
+
|
202
|
+
ro:
|
203
|
+
length: 24
|
204
|
+
regexp: '[A-Z]{4}[A-Z0-9]{16}'
|
205
|
+
|
206
|
+
sm:
|
207
|
+
length: 27
|
208
|
+
regexp: '[A-Z]\d{10}[A-Z0-9]{12}'
|
209
|
+
|
210
|
+
sa:
|
211
|
+
length: 24
|
212
|
+
regexp: '\d{2}[A-Z0-9]{18}'
|
213
|
+
|
214
|
+
rs:
|
215
|
+
length: 22
|
216
|
+
regexp: '\d{18}'
|
217
|
+
|
218
|
+
sk:
|
219
|
+
length: 24
|
220
|
+
regexp: '\d{20}'
|
221
|
+
|
222
|
+
si:
|
223
|
+
length: 19
|
224
|
+
regexp: '\d{15}'
|
225
|
+
|
226
|
+
es:
|
227
|
+
length: 24
|
228
|
+
regexp: '\d{20}'
|
229
|
+
|
230
|
+
se:
|
231
|
+
length: 24
|
232
|
+
regexp: '\d{20}'
|
233
|
+
|
234
|
+
ch:
|
235
|
+
length: 21
|
236
|
+
regexp: '\d{5}[A-Z0-9]{12}'
|
237
|
+
|
238
|
+
tn:
|
239
|
+
length: 24
|
240
|
+
regexp: '\d{20}'
|
241
|
+
|
242
|
+
tr:
|
243
|
+
length: 26
|
244
|
+
regexp: '\d{5}[A-Z0-9]{17}'
|
245
|
+
|
246
|
+
ae:
|
247
|
+
length: 23
|
248
|
+
regexp: '\d{3}\d{16}'
|
249
|
+
|
250
|
+
gb:
|
251
|
+
length: 22
|
252
|
+
regexp: '[A-Z]{4}\d{14}'
|
253
|
+
|
254
|
+
vg:
|
255
|
+
length: 24
|
256
|
+
regexp: '[A-Z0-9]{4}\d{16}'
|
257
|
+
|
258
|
+
# In addition to the above list, Nordea has catalogued IBANs for countries listed below.[32]
|
259
|
+
|
260
|
+
ao:
|
261
|
+
length: 25
|
262
|
+
regexp: '\d{21}'
|
263
|
+
|
264
|
+
bj:
|
265
|
+
length: 28
|
266
|
+
regexp: '[A-Z]\d{23}'
|
267
|
+
|
268
|
+
bf:
|
269
|
+
length: 27
|
270
|
+
regexp: '\d{23}'
|
271
|
+
|
272
|
+
bi:
|
273
|
+
length: 16
|
274
|
+
regexp: '\d{12}'
|
275
|
+
|
276
|
+
cm:
|
277
|
+
length: 27
|
278
|
+
regexp: '\d{23}'
|
279
|
+
|
280
|
+
cv:
|
281
|
+
length: 25
|
282
|
+
regexp: '\d{21}'
|
283
|
+
|
284
|
+
ir:
|
285
|
+
length: 26
|
286
|
+
regexp: '\d{22}'
|
287
|
+
|
288
|
+
ci:
|
289
|
+
length: 28
|
290
|
+
regexp: '[A-Z]\d{23}'
|
291
|
+
|
292
|
+
mg:
|
293
|
+
length: 27
|
294
|
+
regexp: '\d{23}'
|
295
|
+
|
296
|
+
ml:
|
297
|
+
length: 28
|
298
|
+
regexp: '[A-Z]\d{23}'
|
299
|
+
|
300
|
+
mz:
|
301
|
+
length: 25
|
302
|
+
regexp: '\d{21}'
|
303
|
+
|
304
|
+
sn:
|
305
|
+
length: 28
|
306
|
+
regexp: '[A-Z]\d{23}'
|
307
|
+
|
308
|
+
# not quite sure about these:
|
309
|
+
|
310
|
+
# cg: # Republic Congo
|
311
|
+
# length: 27
|
312
|
+
# regexp: ''
|
313
|
+
#
|
314
|
+
# dz: # Algeria
|
315
|
+
# length: 24
|
316
|
+
# regexp: ''
|
317
|
+
#
|
318
|
+
# eg: # Egypt
|
319
|
+
# length: 27
|
320
|
+
# regexp: ''
|
321
|
+
#
|
322
|
+
# ga: # Gabun
|
323
|
+
# length: 27
|
324
|
+
# regexp: ''
|
325
|
+
#
|
326
|
+
# ge: # Georgia
|
327
|
+
# length: 22
|
328
|
+
# regexp: ''
|
329
|
+
#
|
330
|
+
# ua: # Ukraine
|
331
|
+
# length: 29
|
332
|
+
# regexp: ''
|
data/lib/iban/version.rb
ADDED
data/spec/iban_spec.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IBAN do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@iban = IBAN.new('FR14 2004 1010 0505 0001 3M026 06')
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should valid from class method" do
|
10
|
+
IBAN.valid?('FR14 2004 1010 0505 0001 3M026 06').must_equal true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should load the validation rules" do
|
14
|
+
IBAN.specifications.wont_be :empty?
|
15
|
+
IBAN.specifications.must_be_kind_of Hash
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should return the county code" do
|
19
|
+
@iban.country_code.must_equal "FR"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return the check digits" do
|
23
|
+
@iban.check_digits.must_equal "14"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return the BBAN" do
|
27
|
+
@iban.bban.must_equal "20041010050500013M02606"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should convert to integer value" do
|
31
|
+
@iban.to_i.must_equal 200410100505000132202606152714
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should convert to string" do
|
35
|
+
@iban.to_s.must_equal 'FR1420041010050500013M02606'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should convert to formatted string" do
|
39
|
+
@iban.to_s(true).must_equal 'FR14 2004 1010 0505 0001 3M02 606'
|
40
|
+
end
|
41
|
+
|
42
|
+
[
|
43
|
+
"AL47212110090000000235698741",
|
44
|
+
"AD12 00012030200359100100",
|
45
|
+
"AT611904300234573201",
|
46
|
+
"BE68539007547034",
|
47
|
+
"BA391290079401028494",
|
48
|
+
"BG80BNBG96611020345678",
|
49
|
+
"HR1210010051863000160",
|
50
|
+
"CY17002001280000001200527600",
|
51
|
+
"CZ6508000000192000145399",
|
52
|
+
"DK5000400440116243",
|
53
|
+
"EE382200221020145685",
|
54
|
+
"FO1464600009692713",
|
55
|
+
"FI2112345600000785",
|
56
|
+
"FR1420041010050500013M02606",
|
57
|
+
#"GE29NB0000000101904917",
|
58
|
+
"DE89370400440532013000",
|
59
|
+
"GI75NWBK000000007099453",
|
60
|
+
"GR1601101250000000012300695",
|
61
|
+
"GL8964710001000206",
|
62
|
+
"HU42117730161111101800000000",
|
63
|
+
"IS140159260076545510730339",
|
64
|
+
"IE29AIBK93115212345678",
|
65
|
+
"IT60X0542811101000000123456",
|
66
|
+
"LV80BANK0000435195001",
|
67
|
+
"LI21088100002324013AA",
|
68
|
+
"LT121000011101001000",
|
69
|
+
"LU280019400644750000",
|
70
|
+
"MK07300000000042425",
|
71
|
+
"MT84MALT011000012345MTLCAST001S",
|
72
|
+
"MD24AG000225100013104168",
|
73
|
+
"MC5813488000010051108001292",
|
74
|
+
"ME25505000012345678951",
|
75
|
+
"NL91ABNA0417164300",
|
76
|
+
"NO9386011117947",
|
77
|
+
"PL27114020040000300201355387",
|
78
|
+
"PT50000201231234567890154",
|
79
|
+
"RO49AAAA1B31007593840000",
|
80
|
+
"SM86U0322509800000000270100",
|
81
|
+
"RS35260005601001611379",
|
82
|
+
"SK3112000000198742637541",
|
83
|
+
"SI56191000000123438",
|
84
|
+
"ES9121000418450200051332",
|
85
|
+
"SE3550000000054910000003",
|
86
|
+
"CH9300762011623852957",
|
87
|
+
#"UA573543470006762462054925026",
|
88
|
+
"GB29NWBK60161331926819",
|
89
|
+
#"DZ4000400174401001050486",
|
90
|
+
"AO06000600000100037131174",
|
91
|
+
"AZ21NABZ00000000137010001944",
|
92
|
+
"BH29BMAG1299123456BH00",
|
93
|
+
"BJ11B00610100400271101192591",
|
94
|
+
"BR9700360305000010009795493P1",
|
95
|
+
"VG96VPVG0000012345678901",
|
96
|
+
"BF1030134020015400945000643",
|
97
|
+
"BI43201011067444",
|
98
|
+
"CM2110003001000500000605306",
|
99
|
+
"CV64000300004547069110176",
|
100
|
+
"FR7630007000110009970004942",
|
101
|
+
#"CG5230011000202151234567890",
|
102
|
+
"CR0515202001026284066",
|
103
|
+
"DO28BAGR00000001212453611324",
|
104
|
+
#"EG1100006001880800100014553",
|
105
|
+
#"GA2140002000055602673300064",
|
106
|
+
"GT82TRAJ01020000001210029690",
|
107
|
+
"IR580540105180021273113007",
|
108
|
+
"IL620108000000099999999",
|
109
|
+
"CI05A00060174100178530011852",
|
110
|
+
"KZ176010251000042993",
|
111
|
+
"KW74NBOK0000000000001000372151",
|
112
|
+
"LB30099900000001001925579115",
|
113
|
+
"MG4600005030010101914016056",
|
114
|
+
"ML03D00890170001002120000447",
|
115
|
+
"MR1300012000010000002037372",
|
116
|
+
"MU17BOMM0101101030300200000MUR",
|
117
|
+
"MZ59000100000011834194157",
|
118
|
+
"PK24SCBL0000001171495101",
|
119
|
+
"PS92PALS000000000400123456702",
|
120
|
+
"PT50000200000163099310355",
|
121
|
+
"SA0380000000608010167519",
|
122
|
+
"SN12K00100152000025690007542",
|
123
|
+
"TN5914207207100707129648",
|
124
|
+
"TR330006100519786457841326",
|
125
|
+
"AE260211000000230064016"
|
126
|
+
].each do |code|
|
127
|
+
describe code do
|
128
|
+
it "should be valid" do
|
129
|
+
IBAN.new(code).valid?.must_equal true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: IBAN
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.2'
|
55
|
+
description: 'IBAN: International Bank Account Number'
|
56
|
+
email:
|
57
|
+
- kevin.melchert@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .travis.yml
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- iban.gemspec
|
69
|
+
- lib/iban.rb
|
70
|
+
- lib/iban/specs.yml
|
71
|
+
- lib/iban/version.rb
|
72
|
+
- spec/iban_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage: ''
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.3
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: IBAN validation
|
98
|
+
test_files:
|
99
|
+
- spec/iban_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
has_rdoc:
|