ibandit 0.2.0 → 0.2.1

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: e354548ce5ccd7e438122cab71113695ba594bb2
4
- data.tar.gz: ec2bf102a89775fa82aa073807f24a1b1f418998
3
+ metadata.gz: 1af198971c12eee07f52d36f221c8aad6ae74d19
4
+ data.tar.gz: 6fd28ff02942241485baa88a467e2bac4243de76
5
5
  SHA512:
6
- metadata.gz: 35d16a5c6800d4bea177cc4da16ea7685ed98de7c9411795771d5d90b593435de5c97ff4cbb744d27bc8f9eeae494817fac7c90c3c0a2f7ecb4cfb1c16be2f03
7
- data.tar.gz: dae8537f870ca98c74046f574b826d887e5070c7cbc75e32619ceb06b989f5b8b20dbc7d73e8e57a8f4362aca5abaa4d93582170ee8d60b8d54b7504eeb07d3f
6
+ metadata.gz: 2d55d85858f2842f59c3ca940f5a1dea1638e39d191e1ed34f3a8e265a710cb673c2715b916c084e515044b561b98e2e9d18239afead21d67319e1290305f7b1
7
+ data.tar.gz: 1e62d33b36ac2a4d2b90cdce248a308b547721f493757fbb19f4a31bb48668a88d6fb72aecacf2932dc9daf33529e32d5d26922f6f46e98f01f686b8fcb8b7f8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.1 - January 30, 2014
2
+
3
+ - Add Lithuania to IBANBuilder
4
+
1
5
  ## 0.2.0 - January 27, 2014
2
6
 
3
7
  - Add GermanDetailsConverter
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
@@ -2,4 +2,6 @@
2
2
  - GREECE: TODO
3
3
  - MALTA: TODO (maybe - not sure if local details are still used in Malta).
4
4
 
5
+ - Clarify Lithuanian check digits
6
+
5
7
  - Specs for IBANSTRUCTURE parser
@@ -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 PT
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)
@@ -1,3 +1,3 @@
1
1
  module Ibandit
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -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.0
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-27 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec