iban-tools 0.0.9 → 1.0.0

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: a70a2f9aeb3b139da9d84a9f50869b36541a86aa
4
- data.tar.gz: a19616dd03eb8bbd6518b679dc80523896b0d473
3
+ metadata.gz: 97281d569702141068c2a7a708e8c2575ac867e7
4
+ data.tar.gz: 32d623b80cb8878fc2295e27ca7bd987bcef5f1c
5
5
  SHA512:
6
- metadata.gz: 1575260ee396f4c6c37333c718e66bdf0835cf887faae159cef5ba6c8024d455c55c1fc7ca7b954ae58a18c4025fbeba403bfc305c6d01db97b83e0f614c8ac3
7
- data.tar.gz: d32b4e7856f27ec9f7aa20408ff2938df2c379cb333d428bf42741ae9a575189869619fd93a4f3d231b402aa1b23f0f327492091a7973e2f517aaa3d8ca8d24b
6
+ metadata.gz: f4528a15faae008626cffd1b92d4979a1d18f0414eea511e55163a07e5b0620796eb3b69f94d100fb43168a59ba28dc7f517501746f02c6bd52c650594b0010b
7
+ data.tar.gz: f74d8c5ced292331dd28d3908035265d482161e3929c7d50f04344f4542dd94d037e989ccb219dd606898be7bd111387513563eab36e27eacce605c8762b816c
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  iban-tools is a Ruby library for manipulating and validating IBAN account numbers. You can [read more about IBAN](http://en.wikipedia.org/wiki/International_Bank_Account_Number) on Wikipedia
4
4
 
5
+ [![Build Status](https://travis-ci.org/alphasights/iban-tools.svg)](https://travis-ci.org/alphasights/iban-tools)
6
+
5
7
  ## INSTALLATION
6
8
 
7
9
  gem install iban-tools
@@ -35,4 +37,4 @@ Pretty print, canonicalize, and extract fields from an IBAN code
35
37
 
36
38
  ## Credit
37
39
 
38
- [Iulianu](http://github.com/iulianu) wrote [iban-tools](http://github.com/iulianu/iban-tools). ([AlphaSights](http://dev.alphasights.com)) is now maintaining the gem.
40
+ [Iulianu](http://github.com/iulianu) wrote [iban-tools](http://github.com/iulianu/iban-tools). [AlphaSights](https://coderwall.com/team/alphasights) is maintaining the gem.
@@ -5,7 +5,11 @@ module IBANTools
5
5
  config = load_config country_code
6
6
 
7
7
  bban = config.map do |key, value|
8
- value[1] % data[key.to_sym]
8
+ insert_pattern = value[1]
9
+ # apply integer-typecast if it is intended to format as decimal-value
10
+ # this prevent mis-interpretation of integer with leading zeros into octal number!
11
+ insert_value = insert_pattern.include?('d') ? data[key.to_sym].to_i : data[key.to_sym]
12
+ insert_pattern % insert_value
9
13
  end.join('')
10
14
 
11
15
  check_digits = "%02d" % checksum(country_code, bban)
@@ -1,3 +1,11 @@
1
1
  'DE':
2
2
  blz: ['\d{8}', "%08d"]
3
3
  account_number: ['\d{10}', "%010d"]
4
+
5
+ 'ES':
6
+ account_number: ['\d{20}', "%020d"]
7
+
8
+ 'SK':
9
+ bank_code: ['\d{4}', "%04d"]
10
+ account_prefix: ['\d{6}', "%06d"]
11
+ account_number: ['\d{10}', "%010d"]
@@ -8,7 +8,7 @@ module IBANTools
8
8
  end
9
9
 
10
10
  def self.canonicalize_code( code )
11
- code.strip.gsub(/\s+/, '').upcase
11
+ code.to_s.strip.gsub(/\s+/, '').upcase
12
12
  end
13
13
 
14
14
  # Load and cache the default rules from rules.yml
@@ -20,6 +20,11 @@
20
20
  length: 20
21
21
  bban_pattern: '\d{16}'
22
22
 
23
+ 'AZ':
24
+ # Azerbaijan
25
+ length: 28
26
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{20}'
27
+
23
28
  'BA':
24
29
  # Bosnia
25
30
  length: 20
@@ -150,6 +155,11 @@
150
155
  length: 27
151
156
  bban_pattern: '[A-Z]\d{10}[A-Z0-9]{12}'
152
157
 
158
+ 'JO':
159
+ # Jordan
160
+ length: 30
161
+ bban_pattern: '[A-Z]{4}\d{4}[A-Z0-9]{18}'
162
+
153
163
  'KW':
154
164
  # Kuwait
155
165
  length: 30
@@ -190,6 +200,11 @@
190
200
  length: 27
191
201
  bban_pattern: '\d{10}[A-Z0-9]{11}\d{2}'
192
202
 
203
+ 'MD':
204
+ # Moldova
205
+ length: 24
206
+ bban_pattern: '[A-Z0-9]{20}'
207
+
193
208
  'ME':
194
209
  # Montenegro
195
210
  length: 22
@@ -225,6 +240,11 @@
225
240
  length: 15
226
241
  bban_pattern: '\d{11}'
227
242
 
243
+ 'PK':
244
+ # Pakistan
245
+ length: 24
246
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{16}'
247
+
228
248
  'PL':
229
249
  # Poland
230
250
  length: 28
@@ -235,6 +255,11 @@
235
255
  length: 25
236
256
  bban_pattern: '\d{21}'
237
257
 
258
+ 'QA':
259
+ # Quatar
260
+ length: 29
261
+ bban_pattern: '[A-Z]{4}[A-Z0-9]{21}'
262
+
238
263
  'RO':
239
264
  # Romania
240
265
  length: 24
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iban-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iulian Dogariu
@@ -9,36 +9,36 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-17 00:00:00.000000000 Z
12
+ date: 2014-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '3.1'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '3.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: coveralls
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '0.7'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '0.7'
42
42
  description: Validates IBAN account numbers
43
43
  email:
44
44
  - code@iuliandogariu.com
@@ -54,8 +54,9 @@ files:
54
54
  - lib/iban-tools/iban.rb
55
55
  - lib/iban-tools/iban_rules.rb
56
56
  - lib/iban-tools/rules.yml
57
- homepage:
58
- licenses: []
57
+ homepage: https://github.com/alphasights/iban-tools
58
+ licenses:
59
+ - MIT
59
60
  metadata: {}
60
61
  post_install_message:
61
62
  rdoc_options: []
@@ -63,19 +64,20 @@ require_paths:
63
64
  - lib
64
65
  required_ruby_version: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - '>='
67
+ - - ">="
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  required_rubygems_version: !ruby/object:Gem::Requirement
70
71
  requirements:
71
- - - '>='
72
+ - - ">="
72
73
  - !ruby/object:Gem::Version
73
74
  version: '0'
74
75
  requirements:
75
76
  - none
76
77
  rubyforge_project:
77
- rubygems_version: 2.0.0
78
+ rubygems_version: 2.2.2
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: IBAN validator
81
82
  test_files: []
83
+ has_rdoc: