mt940 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,19 @@
1
+ * 0.5.1
2
+
3
+ - Delegated determination of bank to corresponding subclass
4
+
5
+ * 0.5.0
6
+
7
+ - Added bank to a transaction
8
+
9
+ * 0.4.1
10
+
11
+ - Handle can be a Tempfile as well
12
+
13
+ * 0.4.0
14
+
15
+ - Also handle to MT940 file possible
16
+
1
17
  * 0.3.0
2
18
 
3
19
  - Added a date to a transaction
@@ -9,5 +25,5 @@
9
25
  - Automatic determination of bank on the base of the first line implemented
10
26
 
11
27
  * 0.1.0
12
-
28
+
13
29
  Initial release
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -1,5 +1,9 @@
1
1
  class MT940::Abnamro < MT940::Base
2
2
 
3
+ def self.determine_bank(*args)
4
+ self if args[0].match(/ABNANL/)
5
+ end
6
+
3
7
  def parse_tag_61
4
8
  if @line.match(/^:61:(\d{6})\d{4}(C|D)(\d+),(\d{0,2})/)
5
9
  type = $2 == 'D' ? -1 : 1
@@ -1,2 +1,7 @@
1
1
  class MT940::Ing < MT940::Base
2
+
3
+ def self.determine_bank(*args)
4
+ self if args[0].match(/INGBNL/)
5
+ end
6
+
2
7
  end
@@ -1,5 +1,9 @@
1
1
  class MT940::Rabobank < MT940::Base
2
2
 
3
+ def self.determine_bank(*args)
4
+ self if args[0].match(/^:940:/)
5
+ end
6
+
3
7
  def parse_tag_61
4
8
  if @line.match(/^:61:(\d{6})(C|D)(\d+),(\d{0,2})\w{4}(.{16})(.+)$/)
5
9
  type = $2 == 'D' ? -1 : 1
@@ -1,2 +1,7 @@
1
1
  class MT940::Triodos < MT940::Base
2
+
3
+ def self.determine_bank(*args)
4
+ self if args[0].match(/^:20:/) && args[1] && args[1].match(/^:25:TRIODOSBANK/)
5
+ end
6
+
2
7
  end
data/lib/mt940/base.rb CHANGED
@@ -30,18 +30,15 @@ module MT940
30
30
 
31
31
  private
32
32
 
33
- def self.determine_bank(first_line, second_line)
34
- if first_line.match(/INGBNL/)
35
- Ing
36
- elsif first_line.match(/ABNANL/)
37
- Abnamro
38
- elsif first_line.match(/^:940:/)
39
- Rabobank
40
- elsif first_line.match(/^:20:/) && second_line && second_line.match(/^:25:TRIODOSBANK/)
41
- Triodos
42
- else
43
- self
33
+ def self.determine_bank(*args)
34
+ Dir.foreach('lib/mt940/banks/') do |file|
35
+ if file.match(/\.rb$/)
36
+ klass = eval(file.gsub(/\.rb$/,'').capitalize)
37
+ bank = klass.determine_bank(*args)
38
+ return bank if bank
39
+ end
44
40
  end
41
+ self
45
42
  end
46
43
 
47
44
  def initialize(file)
data/mt940.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mt940}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["dovadi"]
12
- s.date = %q{2011-07-04}
12
+ s.date = %q{2011-07-05}
13
13
  s.description = %q{A basic MT940 parser with implementations for Dutch banks.}
14
14
  s.email = %q{frank.oxener@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - dovadi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-07-04 00:00:00 +02:00
17
+ date: 2011-07-05 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency