iso-iban 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +7 -0
- data/Rakefile +6 -0
- data/iso-iban.gemspec +1 -1
- data/lib/iso/iban/no_autoload.rb +5 -5
- data/lib/iso/iban/version.rb +1 -1
- data/test/runner.rb +2 -1
- data/test/unit/lib/iso/iban.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4402c7ebb7d222edf897ba5466807e38510bb2c7
|
4
|
+
data.tar.gz: ca97241a61a6c8ddc59740ba5b0658ff7d8b6f0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 417cab785f146574f13687a0299a19e480d3900cb612780175e3800163f9c92990676f4be0827a298ffb84c91cc36bdfb4a12ee7645a3acd589d07b14a517f76
|
7
|
+
data.tar.gz: cdc18fdfe2fcd46d3a03743d065223bd3a94f2a18124c4b148104c31c4341b09aee1144858347068403533974bca394ffe22a1651b24e11789048b44a540a630
|
data/README.markdown
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('lib')
|
2
|
+
ENV['RAKE'] = "true"
|
2
3
|
|
3
4
|
desc 'Updates and generates the YAML file with the IBAN specs'
|
4
5
|
task :update_iban_specs => [:update_iban_registry, :generate_iban_specs]
|
@@ -17,3 +18,8 @@ task :generate_iban_specs do
|
|
17
18
|
specs = ISO::IBAN::Specification.parse_file('dev/IBAN_Registry.txt')
|
18
19
|
File.write('data/iso-iban/specs.yaml', Hash[specs.map { |spec| [spec.a2_country_code, spec.to_a] }].to_yaml)
|
19
20
|
end
|
21
|
+
|
22
|
+
desc 'run the tests'
|
23
|
+
task :test do
|
24
|
+
require File.expand_path("../test/runner", __FILE__)
|
25
|
+
end
|
data/iso-iban.gemspec
CHANGED
data/lib/iso/iban/no_autoload.rb
CHANGED
@@ -181,7 +181,7 @@ module ISO
|
|
181
181
|
|
182
182
|
# Like ISO::IBAN.parse, but raises an ISO::IBAN::Invalid exception if the IBAN is invalid.
|
183
183
|
#
|
184
|
-
# @param [String] iban_number
|
184
|
+
# @param [String, nil] iban_number
|
185
185
|
# The IBAN in either compact or human readable form.
|
186
186
|
#
|
187
187
|
# @return [ISO::IBAN]
|
@@ -193,13 +193,13 @@ module ISO
|
|
193
193
|
iban
|
194
194
|
end
|
195
195
|
|
196
|
-
# @param [String] iban_number
|
196
|
+
# @param [String, nil] iban_number
|
197
197
|
# The IBAN in either compact or human readable form.
|
198
198
|
#
|
199
199
|
# @return [ISO::IBAN]
|
200
200
|
# An IBAN instance representing the passed IBAN number.
|
201
201
|
def self.parse(iban_number)
|
202
|
-
new(strip(iban_number))
|
202
|
+
new(strip(iban_number || ""))
|
203
203
|
end
|
204
204
|
|
205
205
|
# Generate an IBAN from country code and components, automatically filling in the checksum.
|
@@ -280,8 +280,8 @@ module ISO
|
|
280
280
|
def initialize(iban)
|
281
281
|
raise ArgumentError, "String expected for iban, but got #{iban.class}" unless iban.is_a?(String)
|
282
282
|
|
283
|
-
@compact = iban.b
|
284
|
-
@country =
|
283
|
+
@compact = iban.b.upcase
|
284
|
+
@country = @compact[0,2]
|
285
285
|
@specification = self.class.specification(@country, nil)
|
286
286
|
end
|
287
287
|
|
data/lib/iso/iban/version.rb
CHANGED
data/test/runner.rb
CHANGED
@@ -13,8 +13,9 @@ TEST_DIR = File.expand_path('../../test', __FILE__)
|
|
13
13
|
require 'test/unit'
|
14
14
|
require 'helper'
|
15
15
|
|
16
|
-
units = ARGV.empty? ? Dir["#{TEST_DIR}/unit/**/*.rb"] : ARGV
|
16
|
+
units = (ARGV.empty? || ENV['RAKE']) ? Dir["#{TEST_DIR}/unit/**/*.rb"] : ARGV
|
17
17
|
|
18
18
|
units.each do |unit|
|
19
|
+
puts unit
|
19
20
|
load unit
|
20
21
|
end
|
data/test/unit/lib/iso/iban.rb
CHANGED
@@ -64,6 +64,8 @@ suite "ISO::IBAN" do
|
|
64
64
|
assert !ISO::IBAN.valid?('CH99 1234 5987 6543 2109 A')
|
65
65
|
assert !ISO::IBAN.valid?('CH150+') # raised before 0.1.0, fixed in 0.1.1
|
66
66
|
assert !ISO::IBAN.valid?('foo')
|
67
|
+
assert_equal false, ISO::IBAN.valid?(nil)
|
68
|
+
assert_equal false, ISO::IBAN.valid?('')
|
67
69
|
end
|
68
70
|
|
69
71
|
test 'ISO::IBAN::validate' do
|
@@ -76,6 +78,8 @@ suite "ISO::IBAN" do
|
|
76
78
|
assert_equal [:invalid_country, :invalid_checksum, :invalid_length, :invalid_format], ISO::IBAN.validate('XX35 1234 5987 6543 2109 A')
|
77
79
|
assert_equal [:invalid_characters, :invalid_checksum, :invalid_length, :invalid_format], ISO::IBAN.validate('CH35 1234 5987 6543 2109 Ä')
|
78
80
|
assert_equal [:invalid_characters, :invalid_country, :invalid_checksum, :invalid_length, :invalid_format], ISO::IBAN.validate('XX35 1234 5987 6543 2109 Ä')
|
81
|
+
assert_equal [:invalid_characters, :invalid_country, :invalid_checksum, :invalid_length, :invalid_format], ISO::IBAN.validate(nil)
|
82
|
+
assert_equal [:invalid_characters, :invalid_country, :invalid_checksum, :invalid_length, :invalid_format], ISO::IBAN.validate('')
|
79
83
|
end
|
80
84
|
|
81
85
|
test "ISO::IBAN::parse" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso-iban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rusterholz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
ISO::IBAN implements IBAN (International Bank Account Number) specification as per ISO 13616-1.
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: 1.3.1
|
66
66
|
requirements: []
|
67
67
|
rubyforge_project:
|
68
|
-
rubygems_version: 2.2.
|
68
|
+
rubygems_version: 2.2.2
|
69
69
|
signing_key:
|
70
70
|
specification_version: 3
|
71
71
|
summary: Utilities for International Bank Account Numbers (IBAN) as per ISO 13616-1.
|