ibandit 0.2.0 → 0.2.1
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/CHANGELOG.md +4 -0
- data/README.md +8 -0
- data/TODO.md +2 -0
- data/lib/ibandit/iban_builder.rb +12 -3
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_builder_spec.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1af198971c12eee07f52d36f221c8aad6ae74d19
|
4
|
+
data.tar.gz: 6fd28ff02942241485baa88a467e2bac4243de76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d55d85858f2842f59c3ca940f5a1dea1638e39d191e1ed34f3a8e265a710cb673c2715b916c084e515044b561b98e2e9d18239afead21d67319e1290305f7b1
|
7
|
+
data.tar.gz: 1e62d33b36ac2a4d2b90cdce248a308b547721f493757fbb19f4a31bb48668a88d6fb72aecacf2932dc9daf33529e32d5d26922f6f46e98f01f686b8fcb8b7f8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -225,6 +225,14 @@ iban = Ibandit::IBANBuilder.build(
|
|
225
225
|
)
|
226
226
|
iban.iban # => "LV72BANK1234567890123"
|
227
227
|
|
228
|
+
# Lithuania
|
229
|
+
iban = Ibandit::IBANBuilder.build(
|
230
|
+
country_code: 'LT',
|
231
|
+
account_number: '11101001000',
|
232
|
+
bank_code: '10000'
|
233
|
+
)
|
234
|
+
iban.iban # => "LT1000011101001000"
|
235
|
+
|
228
236
|
# Luxembourg
|
229
237
|
iban = Ibandit::IBANBuilder.build(
|
230
238
|
country_code: 'LU',
|
data/TODO.md
CHANGED
data/lib/ibandit/iban_builder.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ibandit
|
2
2
|
module IBANBuilder
|
3
|
-
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB IE IT LU LV MC NL
|
4
|
-
SI SK SM).freeze
|
3
|
+
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB IE IT LT LU LV MC NL
|
4
|
+
PT SI SK SM).freeze
|
5
5
|
|
6
6
|
def self.build(opts)
|
7
7
|
country_code = opts.delete(:country_code)
|
@@ -293,6 +293,15 @@ module Ibandit
|
|
293
293
|
].join
|
294
294
|
end
|
295
295
|
|
296
|
+
def self.build_lt_bban(opts)
|
297
|
+
# Additional info:
|
298
|
+
# Lithuanian national bank details were replaced with IBANs in 2004.
|
299
|
+
# All Lithuanian payers should therefore know their IBAN, and are
|
300
|
+
# unlikely to know how it breaks down. This method is included for
|
301
|
+
# consistency with the IBAN structure only.
|
302
|
+
[opts[:bank_code], opts[:account_number]].join
|
303
|
+
end
|
304
|
+
|
296
305
|
def self.build_lu_bban(opts)
|
297
306
|
# Additional info:
|
298
307
|
# Luxembourgian national bank details were replaced with IBANs in 2002.
|
@@ -504,7 +513,7 @@ module Ibandit
|
|
504
513
|
|
505
514
|
def self.required_fields(country_code)
|
506
515
|
case country_code
|
507
|
-
when 'AT', 'CY', 'DE', 'FI', 'LU', 'LV', 'NL', 'SI', 'SK'
|
516
|
+
when 'AT', 'CY', 'DE', 'FI', 'LT', 'LU', 'LV', 'NL', 'SI', 'SK'
|
508
517
|
%i(bank_code account_number)
|
509
518
|
when 'BE', 'EE', 'ES'
|
510
519
|
%i(account_number)
|
data/lib/ibandit/version.rb
CHANGED
@@ -541,6 +541,38 @@ describe Ibandit::IBANBuilder do
|
|
541
541
|
end
|
542
542
|
end
|
543
543
|
|
544
|
+
context 'with LT as the country_code' do
|
545
|
+
let(:args) do
|
546
|
+
{
|
547
|
+
country_code: 'LT',
|
548
|
+
account_number: '11101001000',
|
549
|
+
bank_code: '10000'
|
550
|
+
}
|
551
|
+
end
|
552
|
+
|
553
|
+
its(:iban) { is_expected.to eq('LT121000011101001000') }
|
554
|
+
|
555
|
+
it_behaves_like 'allows round trips', 'LT12 1000 0111 0100 1000'
|
556
|
+
|
557
|
+
context 'without an account_number' do
|
558
|
+
before { args.delete(:account_number) }
|
559
|
+
|
560
|
+
it 'raises a helpful error message' do
|
561
|
+
expect { build }.
|
562
|
+
to raise_error(ArgumentError, /account_number is a required field/)
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
context 'without a bank_code' do
|
567
|
+
before { args.delete(:bank_code) }
|
568
|
+
|
569
|
+
it 'raises a helpful error message' do
|
570
|
+
expect { build }.
|
571
|
+
to raise_error(ArgumentError, /bank_code is a required field/)
|
572
|
+
end
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
544
576
|
context 'with LU as the country_code' do
|
545
577
|
let(:args) do
|
546
578
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibandit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grey Baker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|