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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c7cc32ffca411662b2ec9370ec48119b19c7c29
4
- data.tar.gz: efad5f26823ef1843a63351de65d3c618ff2f0ee
3
+ metadata.gz: 50903b48fd64a40c9178ed79eebe34291cb1d3d4
4
+ data.tar.gz: 974ac48d09d4d7fe1b9d2a00ae2b8ae168fa209b
5
5
  SHA512:
6
- metadata.gz: 85a6244394f46b3f9513314bcdc69875a6f1d14cf4ca33a17ff9ee913de7f76746690eadc64ca66384c36cbe2536c5e8bef26745d6ddffa9cefe971bc476c26e
7
- data.tar.gz: 44b6dba9272e2b9a357421a415f8269b8edf04f143b2164b3ba2b2d5930120e94c49db9920699a41503bb6c0976d33f994cccfe81745d7a06e34119a54af7871
6
+ metadata.gz: 28a4353847b8b4301d283867cd73d067447386925d6fd52e6dc09cb5aea083b8057ff8ca805b53e702af0cda350d63b74dfb91dc226da9b5278ed7b924c627b9
7
+ data.tar.gz: dfe7bb6e302680efd1c4c9921f939454974c0d0b4ad1792292435e3495ca5b1bfbe0b9ac54a72359a58ef2ac7a9af0c46ea6bf9a6a5db452d60a7f408661fe7b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.3 - March 4, 2015
2
+
3
+ - Add Greece to LocalDetailsCleaner and IBANAssembler
4
+
1
5
  ## 0.3.2 - February 24, 2015
2
6
 
3
7
  - Allow for injection of a modulus checker
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,4 +1 @@
1
- - Build IBANs from national banking details for each SEPA country
2
- - GREECE: TODO
3
-
4
1
  - Specs for IBANSTRUCTURE parser
@@ -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 MT
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 MT
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]/, '')
@@ -1,3 +1,3 @@
1
1
  module Ibandit
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.freeze
3
3
  end
@@ -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.2
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-02-24 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec