iso-iban 0.1.2 → 0.1.3

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: a7379b788718b0e4fd3ad118a63d0e80aaad4ff1
4
- data.tar.gz: b80ed6b73a12ae63ffe267888727064f60313c01
3
+ metadata.gz: 4402c7ebb7d222edf897ba5466807e38510bb2c7
4
+ data.tar.gz: ca97241a61a6c8ddc59740ba5b0658ff7d8b6f0e
5
5
  SHA512:
6
- metadata.gz: 2596de4b35c81cad993d7b35b0c9ce642e39870c9c5016b34fd923cc66eeaaa87dac25a4280510680dab367a41dc1d4415ad9fa634b3fb475794593d9d20785e
7
- data.tar.gz: 40bab933fc8a9cd2c1b8b26ba732d4804c61c9ca2565703486df15dfb3a9c6556a84379a503c02ce667770ed055dce0500ee112196dce0e3e43b637ea527e5a3
6
+ metadata.gz: 417cab785f146574f13687a0299a19e480d3900cb612780175e3800163f9c92990676f4be0827a298ffb84c91cc36bdfb4a12ee7645a3acd589d07b14a517f76
7
+ data.tar.gz: cdc18fdfe2fcd46d3a03743d065223bd3a94f2a18124c4b148104c31c4341b09aee1144858347068403533974bca394ffe22a1651b24e11789048b44a540a630
@@ -64,6 +64,13 @@ Links
64
64
  * [RubyGems Site](https://rubygems.org/gems/iso-iban)
65
65
 
66
66
 
67
+ Contributors
68
+ ------------
69
+
70
+ * Carsten Wirth (ISO::IBAN#parse accepts nil)
71
+ * John Cant (Travis CI)
72
+
73
+
67
74
  License
68
75
  -------
69
76
 
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "iso-iban"
5
- s.version = "0.1.2"
5
+ s.version = "0.1.3"
6
6
  s.authors = "Stefan Rusterholz"
7
7
  s.email = "stefan.rusterholz@gmail.com"
8
8
  s.homepage = "https://github.com/apeiros/iso-iban"
@@ -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 = iban[0,2]
283
+ @compact = iban.b.upcase
284
+ @country = @compact[0,2]
285
285
  @specification = self.class.specification(@country, nil)
286
286
  end
287
287
 
@@ -13,6 +13,6 @@ module ISO
13
13
  # @note
14
14
  # require 'iso/iban' loads the version.
15
15
  #
16
- Version = Gem::Version.new("0.1.2")
16
+ Version = Gem::Version.new("0.1.3")
17
17
  end
18
18
  end
@@ -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
@@ -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.2
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-03-14 00:00:00.000000000 Z
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.1
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.