ibanizator 0.1.5 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/db/blz.txt +1298 -1481
  3. data/lib/iban/validator.rb +5 -4
  4. data/lib/ibanizator.rb +5 -0
  5. metadata +10 -8
@@ -8,6 +8,11 @@ module Iban
8
8
  valid_length?(iban) && valid_checksum?(iban)
9
9
  end
10
10
 
11
+ # public because it's used in `Ibanizator.calculate_iban`
12
+ def sanitize_input(input)
13
+ input.to_s.chomp.gsub(/\s+/,"")
14
+ end
15
+
11
16
  private
12
17
 
13
18
  def valid_length?(iban)
@@ -16,10 +21,6 @@ module Iban
16
21
  iban.length == LENGTHS[country_code]
17
22
  end
18
23
 
19
- def sanitize_input(input)
20
- input.to_s.chomp.gsub(/\s+/,"")
21
- end
22
-
23
24
  def valid_checksum?(iban)
24
25
  number_representation = integerize(reorder(iban))
25
26
  number_representation % 97 == 1
data/lib/ibanizator.rb CHANGED
@@ -6,6 +6,11 @@ class Ibanizator
6
6
  # Error handling
7
7
  # TODO
8
8
 
9
+ # delete spaces
10
+ validator = Iban::Validator.new
11
+ options[:account_number] = validator.sanitize_input(options[:account_number])
12
+ options[:bank_code] = validator.sanitize_input(options[:bank_code])
13
+
9
14
  # Fill account number to 10 digits
10
15
  while options[:account_number].size < 10 do
11
16
  options[:account_number] = options[:account_number].rjust(10, '0')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibanizator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Stettner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ibanizator generates the correct IBAN for given account number and bank
14
14
  number for german accounts. It is possible to validate given international IBANS.
@@ -18,15 +18,16 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - lib/ibanizator.rb
22
- - lib/iban/validator.rb
23
- - lib/iban/lengths.rb
24
- - lib/swift_bic/bank_db.rb
25
21
  - db/blz.txt
26
22
  - lib/errors/bank_not_found_error.rb
27
23
  - lib/errors/invalid_bank_code_error.rb
24
+ - lib/iban/lengths.rb
25
+ - lib/iban/validator.rb
26
+ - lib/ibanizator.rb
27
+ - lib/swift_bic/bank_db.rb
28
28
  homepage: https://github.com/softwareinmotion/ibanizator
29
- licenses: []
29
+ licenses:
30
+ - MIT
30
31
  metadata: {}
31
32
  post_install_message:
32
33
  rdoc_options: []
@@ -44,8 +45,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
45
  version: '0'
45
46
  requirements: []
46
47
  rubyforge_project:
47
- rubygems_version: 2.0.3
48
+ rubygems_version: 2.2.2
48
49
  signing_key:
49
50
  specification_version: 4
50
51
  summary: An IBAN generator/validator and BIC generator for german accounts.
51
52
  test_files: []
53
+ has_rdoc: