ibandit 0.3.2 → 0.3.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/CHANGELOG.md +4 -0
- data/README.md +10 -3
- data/TODO.md +0 -3
- data/lib/ibandit/iban_assembler.rb +2 -2
- data/lib/ibandit/local_details_cleaner.rb +8 -2
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/iban_assembler_spec.rb +30 -0
- data/spec/ibandit/local_details_cleaner_spec.rb +24 -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: 50903b48fd64a40c9178ed79eebe34291cb1d3d4
|
4
|
+
data.tar.gz: 974ac48d09d4d7fe1b9d2a00ae2b8ae168fa209b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a4353847b8b4301d283867cd73d067447386925d6fd52e6dc09cb5aea083b8057ff8ca805b53e702af0cda350d63b74dfb91dc226da9b5278ed7b924c627b9
|
7
|
+
data.tar.gz: dfe7bb6e302680efd1c4c9921f939454974c0d0b4ad1792292435e3495ca5b1bfbe0b9ac54a72359a58ef2ac7a9af0c46ea6bf9a6a5db452d60a7f408661fe7b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -71,7 +71,7 @@ module ModulusChecker
|
|
71
71
|
def self.valid_bank_code?(iban_string)
|
72
72
|
some_codes
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def self.valid_account_number?(iban_string)
|
76
76
|
some_codes
|
77
77
|
end
|
@@ -223,6 +223,15 @@ iban = Ibandit::IBAN.new(
|
|
223
223
|
)
|
224
224
|
iban.iban # => "GB60BARC20000055779911"
|
225
225
|
|
226
|
+
# Greece
|
227
|
+
iban = Ibandit::IBAN.new(
|
228
|
+
country_code: 'GR',
|
229
|
+
bank_code: '011',
|
230
|
+
branch_code: '0125',
|
231
|
+
account_number: '0000000012300695'
|
232
|
+
)
|
233
|
+
iban.iban # => "GR16011012500000000012300695"
|
234
|
+
|
226
235
|
# Ireland
|
227
236
|
iban = Ibandit::IBAN.new(
|
228
237
|
country_code: 'IE',
|
@@ -343,8 +352,6 @@ iban = Ibandit::IBAN.new(
|
|
343
352
|
iban.iban # => "SM88X0542811101000000123456"
|
344
353
|
```
|
345
354
|
|
346
|
-
Support for Greece and Malta is coming soon.
|
347
|
-
|
348
355
|
## Other libraries
|
349
356
|
|
350
357
|
Another gem, [iban-tools](https://github.com/alphasights/iban-tools), also
|
data/TODO.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ibandit
|
2
2
|
module IBANAssembler
|
3
|
-
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB IE IT LT LU LV MC
|
4
|
-
NL PT SI SK SM).freeze
|
3
|
+
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB GR IE IT LT LU LV MC
|
4
|
+
MT NL PT SI SK SM).freeze
|
5
5
|
|
6
6
|
EXCEPTION_COUNTRY_CODES = %w(IT SM BE).freeze
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Ibandit
|
2
2
|
module LocalDetailsCleaner
|
3
|
-
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB IE IT LT LU LV MC
|
4
|
-
NL PT SI SK SM).freeze
|
3
|
+
SUPPORTED_COUNTRY_CODES = %w(AT BE CY DE EE ES FI FR GB GR IE IT LT LU LV MC
|
4
|
+
MT NL PT SI SK SM).freeze
|
5
5
|
|
6
6
|
def self.clean(local_details)
|
7
7
|
country_code = local_details[:country_code]
|
@@ -200,6 +200,12 @@ module Ibandit
|
|
200
200
|
}
|
201
201
|
end
|
202
202
|
|
203
|
+
def self.clean_gr_details(local_details)
|
204
|
+
# Greek IBANs construction is idiosyncratic to the individual banks, and
|
205
|
+
# no central specification is published.
|
206
|
+
local_details
|
207
|
+
end
|
208
|
+
|
203
209
|
def self.clean_ie_details(local_details)
|
204
210
|
# Ireland uses the same local details as the United Kingdom
|
205
211
|
branch_code = local_details[:branch_code].gsub(/[-\s]/, '')
|
data/lib/ibandit/version.rb
CHANGED
@@ -262,6 +262,36 @@ describe Ibandit::IBANAssembler do
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
+
context 'with GR as the country_code' do
|
266
|
+
let(:args) do
|
267
|
+
{
|
268
|
+
country_code: 'GR',
|
269
|
+
bank_code: '011',
|
270
|
+
branch_code: '0125',
|
271
|
+
account_number: '0000000012300695'
|
272
|
+
}
|
273
|
+
end
|
274
|
+
|
275
|
+
it { is_expected.to eq('GR1601101250000000012300695') }
|
276
|
+
|
277
|
+
it_behaves_like 'allows round trips', 'GR16 0110 1250 0000 0001 2300 695'
|
278
|
+
|
279
|
+
context 'without an account_number' do
|
280
|
+
before { args.delete(:account_number) }
|
281
|
+
it { is_expected.to be_nil }
|
282
|
+
end
|
283
|
+
|
284
|
+
context 'without a bank_code' do
|
285
|
+
before { args.delete(:bank_code) }
|
286
|
+
it { is_expected.to be_nil }
|
287
|
+
end
|
288
|
+
|
289
|
+
context 'without a branch_code' do
|
290
|
+
before { args.delete(:branch_code) }
|
291
|
+
it { is_expected.to be_nil }
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
265
295
|
context 'with IE as the country_code' do
|
266
296
|
let(:args) do
|
267
297
|
{ country_code: 'IE',
|
@@ -345,6 +345,30 @@ describe Ibandit::LocalDetailsCleaner do
|
|
345
345
|
end
|
346
346
|
end
|
347
347
|
|
348
|
+
context 'Greece' do
|
349
|
+
let(:country_code) { 'GR' }
|
350
|
+
let(:bank_code) { '011' }
|
351
|
+
let(:branch_code) { '0125' }
|
352
|
+
let(:account_number) { '0000000012300695' }
|
353
|
+
|
354
|
+
it { is_expected.to eq(local_details) }
|
355
|
+
|
356
|
+
context 'without an account number' do
|
357
|
+
let(:account_number) { nil }
|
358
|
+
it { is_expected.to eq(local_details) }
|
359
|
+
end
|
360
|
+
|
361
|
+
context 'without a bank code' do
|
362
|
+
let(:bank_code) { nil }
|
363
|
+
it { is_expected.to eq(local_details) }
|
364
|
+
end
|
365
|
+
|
366
|
+
context 'without a branch code' do
|
367
|
+
let(:branch_code) { nil }
|
368
|
+
it { is_expected.to eq(local_details) }
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
348
372
|
context 'Ireland' do
|
349
373
|
let(:country_code) { 'IE' }
|
350
374
|
let(:bank_code) { 'AIBK' }
|
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.3.
|
4
|
+
version: 0.3.3
|
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-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|