blz 0.1.4.20151206 → 0.1.4.20160306

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: 33023e83cd9e16e94c0b240f8addc1612ca81e63
4
- data.tar.gz: fedb13301cee62530ac05ef94054437e2c1ec10f
3
+ metadata.gz: 4ec43cc901559a19bbc81211ba965fa4133c28fc
4
+ data.tar.gz: 237c92c51e8e4d5d1056fcc3c5aa5868faeb1ee2
5
5
  SHA512:
6
- metadata.gz: 90c614d051660ac862545b31718c7fb6287a478dac01fa2f43d7610c5535564e3f17bc0f754527c5fd8db25630bb943665ab343ff94a6f5708589ac5d74753e4
7
- data.tar.gz: cbff722767f5987c488d6dea8510fe3123035c819187f8352378973efbcbc8a12799963334aa862565828e1deeeb28a31db874b6954812611f7d0e5e8a25b09e
6
+ metadata.gz: 2d71da44cf5fc3a5b94776650ae13afd471ca3cb14af3a8ab9e1d8e0cde9583f861e1d4b94dcf4995d012a0af72740499e3828cd5917c8fcd3396acf6b0ccdea
7
+ data.tar.gz: 22b87537f9ce9ea963e7557f5b6c0e45c1cbb1fd5031e8ff11eec05d2bcb3035e00cdecaeeba7ff79c9689fb24b3adfe5db0393cb2d5ea53d25237e4df8dc6f2
@@ -1,7 +1,17 @@
1
- # 0.1.4.20151206, unreleased
1
+ # 0.1.4.20160306, unreleased
2
+
3
+ * BLZ data file for cycle 2015-12-07 to 2016-03-06 added
4
+ * removed data files for 2012-2014
5
+ * refactored data file finder logic
6
+
7
+ # 0.1.4.20151206, released 2015-08-19
2
8
 
3
9
  * BLZ data file for cycle 2015-09-07 to 2015-12-06 added
4
10
 
11
+ # 0.1.4.20150607, released 2015-03-09
12
+
13
+ * BLZ data file for cycle 2015-06-09 to 2015-09-07 added
14
+
5
15
  # 0.1.4.20141207, released 2014-09-08
6
16
 
7
17
  * pinned data to last update cycle (there were no changes)
@@ -47,4 +57,3 @@
47
57
  # 0.1.0, released 2012-09-27
48
58
 
49
59
  * Initial version released on GitHub
50
-
@@ -4,7 +4,7 @@ extra_rdoc_files = ['CHANGELOG.md', 'LICENSE', 'README.md']
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'blz'
7
- s.version = '0.1.4.20151206'
7
+ s.version = '0.1.4.20160306'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.summary = "BLZ (Bankleitzahlen) for Ruby"
10
10
 
@@ -16,8 +16,8 @@ and Austria.
16
16
  http://github.com/olivere/blz
17
17
  EOF
18
18
 
19
- s.author = 'Oliver Eilhard'
20
- s.email = 'oliver.eilhard@gmail.com'
19
+ s.author = ['Oliver Eilhard', 'Dominik Menke']
20
+ s.email = ['oliver.eilhard@gmail.com', 'dominik.menke@gmail.com']
21
21
  s.homepage = 'http://github.com/olivere/blz'
22
22
  s.license = 'MIT'
23
23
 
Binary file
data/lib/blz.rb CHANGED
@@ -7,28 +7,29 @@
7
7
  # Provides information about "Bankleitzahlen" (BLZ),
8
8
  # a bank identifier code system used by German and Austrian banks.
9
9
 
10
+ require "date"
11
+
10
12
  module BLZ
11
- # TODO (dmke 2014/09/08): Extract data files into a blz-data gem and
12
- # move finder logic over there
13
- DATA_FILE = begin
14
- now = Time.now
13
+ def self.find_data_file(now=Date.today)
15
14
  glob = Dir[ File.join(File.dirname(__FILE__), '../data/*.tsv.gz') ].sort
16
15
 
17
16
  file2time = proc do |f|
18
17
  match = f.match /(?<y>\d{4})_(?<m>\d\d)_(?<d>\d\d)\.tsv\.gz$/
19
- Time.new match[:y], match[:m], match[:d]
18
+ Date.new match[:y].to_i, match[:m].to_i, match[:d].to_i
20
19
  end
21
20
 
22
21
  filename = glob.find {|c| now <= file2time[c] } || glob.last
23
22
 
24
23
  # sanity check
25
24
  t = file2time[filename]
26
- if t < Time.new(2013, 12, 9) || now > t + (90 * 24 * 60 * 60)
25
+ if t < Date.new(2013, 12, 9) || now > t + 90
27
26
  warn '[BLZ] The data provided may not be accurate.'
28
27
  end
29
28
 
30
29
  filename
31
30
  end
31
+
32
+ DATA_FILE = find_data_file
32
33
  end
33
34
 
34
35
  require 'blz/bank'
@@ -5,8 +5,27 @@ require 'test/unit'
5
5
 
6
6
  class TestBank < Test::Unit::TestCase
7
7
 
8
+ def test_data_file_finder
9
+ {
10
+ Date.new(2000,1,1) => "2015_03_09.tsv.gz",
11
+ Date.new(2015,1,1) => "2015_03_09.tsv.gz",
12
+ Date.new(2015,3,9) => "2015_03_09.tsv.gz",
13
+
14
+ Date.new(2015,3,10) => "2015_12_06.tsv.gz",
15
+ Date.new(2015,6,25) => "2015_12_06.tsv.gz",
16
+ Date.new(2015,12,6) => "2015_12_06.tsv.gz",
17
+
18
+ Date.new(2015,12,7) => "2016_03_06.tsv.gz",
19
+ Date.new(2016,3,6) => "2016_03_06.tsv.gz",
20
+ Date.new(2016,3,7) => "2016_03_06.tsv.gz", # ! until next release cycle
21
+ }.each do |date, filename|
22
+ file = BLZ.find_data_file(date)
23
+ assert_equal filename, File.basename(file)
24
+ end
25
+ end
26
+
8
27
  def test_current_data_file
9
- assert_equal "2015_12_06.tsv.gz", File.basename(BLZ::DATA_FILE)
28
+ assert_match /\A\d{4}_\d\d_\d\d\.tsv\.gz\z/, File.basename(BLZ::DATA_FILE)
10
29
  end
11
30
 
12
31
  def test_all_banks
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4.20151206
4
+ version: 0.1.4.20160306
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Eilhard
8
+ - Dominik Menke
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
12
+ date: 2015-12-04 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -70,7 +71,9 @@ description: |
70
71
  and Austria.
71
72
 
72
73
  http://github.com/olivere/blz
73
- email: oliver.eilhard@gmail.com
74
+ email:
75
+ - oliver.eilhard@gmail.com
76
+ - dominik.menke@gmail.com
74
77
  executables:
75
78
  - blz
76
79
  extensions: []
@@ -87,12 +90,9 @@ files:
87
90
  - Rakefile
88
91
  - bin/blz
89
92
  - blz.gemspec
90
- - data/2012_06_04.tsv.gz
91
- - data/2013_12_09.tsv.gz
92
- - data/2014_03_03.tsv.gz
93
- - data/2014_09_08.tsv.gz
94
93
  - data/2015_03_09.tsv.gz
95
94
  - data/2015_12_06.tsv.gz
95
+ - data/2016_03_06.tsv.gz
96
96
  - lib/blz.rb
97
97
  - lib/blz/bank.rb
98
98
  - test/test_bank.rb
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.4.6
119
+ rubygems_version: 2.4.5.1
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: BLZ (Bankleitzahlen) for Ruby
Binary file
Binary file
Binary file
Binary file