kontocheck 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/CHANGES ADDED
@@ -0,0 +1,16 @@
1
+ important changes in version 0.0.3:
2
+
3
+ - Function konto_check: the order of parameters changed:
4
+ konto_check(blz,kto) instead of konto_check(kto,blz)
5
+
6
+ - The function load_bank_data will go away; instead a new function
7
+ konto_check::init() is provided which reads directly a lut file.
8
+ This function is much faster (about 7..25 times, depending on the
9
+ blocks to load) and has some more advantages.
10
+
11
+ - This version can be compiled for Ruby 1.8 and 1.9
12
+
13
+ - some new functions give access to all fields of the bank file:
14
+ bank_{name|name_kurz|plz|ort|pan|bic|nr|pz|aenderung|loeschung|nachfolge_blz}()
15
+
16
+ - for documentation, RTFS. Later some more documentation will be added ;-)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2010 Provideal Systems GmbH
2
+
3
+ This program is free software: you can redistribute it and/or modify
4
+ it under the terms of the GNU General Public License as published by
5
+ the Free Software Foundation, either version 3 of the License, or
6
+ (at your option) any later version.
7
+
8
+ This program is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU General Public License for more details.
12
+
13
+ You should have received a copy of the GNU General Public License
14
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ ACKNOWLEDGEMENT
17
+
18
+ This software is entirely based on the C library konto_check
19
+ http://www.informatik.hs-mannheim.de/konto_check/
20
+ http://sourceforge.net/projects/kontocheck/
21
+ by Michael Plugge.
data/README.textile ADDED
@@ -0,0 +1,61 @@
1
+ h1. KontoCheck
2
+
3
+ Check whether a certain bic/account-no-combination can possibly be valid for a German bank.
4
+
5
+ It uses the C library konto_check (see http://sourceforge.net/projects/kontocheck/) by
6
+ Michael Plugge.
7
+
8
+ h2. Example
9
+
10
+ An example tends to tell more than a 1000 words:
11
+
12
+ <pre>
13
+ >> require "konto_check"
14
+ true
15
+
16
+ >> KontoCheck::init("./blz.lut")
17
+ true
18
+
19
+ # konto_check?(blz, ktno) => true/false (valid/invalid)
20
+ >> KontoCheck::konto_check?("52250030", "52001")
21
+ true
22
+
23
+ >> KontoCheck::konto_check?("52250030", "52002")
24
+ false
25
+
26
+ # ISO-8859-1 encoded name of bank
27
+ >> KontoCheck::bank_name("10010010")
28
+ "Postbank"
29
+
30
+ # there is more, RTFS or wait for/help creating more examples...
31
+ </pre>
32
+
33
+ h2. Short 'Documentation'
34
+
35
+ h3. <tt>KontoCheck::konto_check?(&lt;blz&gt;, &lt;kto&gt;)</tt>
36
+
37
+ check whether the given account number <tt>kto</tt> can possibly be
38
+ a valid number of the bank with the bic <tt>blz</tt>.
39
+
40
+ h3. <tt>KontoCheck::init(&lt;lut_file&gt;)</tt>
41
+
42
+ initialize the underlying C library konto_check with bank
43
+ information from the LUT file <tt>lut_file</tt>.
44
+ The LUT file can be created from the plain text file
45
+ found at: http://www.bundesbank.de/zahlungsverkehr/zahlungsverkehr_bankleitzahlen_download.php
46
+ This file is updated every three months, so be sure to
47
+ replace (and regenerate) it regularly.
48
+
49
+ There will be a rake task to update the LUT file soon.
50
+
51
+ h3. <tt>KontoCheck::bank_name(&lt;blz&gt;)</tt>
52
+
53
+ returns the name of the bank as a (ISO-8859-1 encoded)
54
+ string or raises a runtime error with a short error message
55
+ if an error occurred (invalid blz, blz too short, etc.).
56
+ This may be changed in the future to simply return nil (should be discussed).
57
+
58
+ h2. License
59
+
60
+ Since the original http://www.informatik.hs-mannheim.de/konto_check/ is
61
+ licensed under LGPL, so is this module.
data/Rakefile ADDED
@@ -0,0 +1,72 @@
1
+ # Copyright (c) 2010 Provideal Systems GmbH
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'rubygems'
17
+ require 'rake'
18
+ require 'rake/extensiontask'
19
+
20
+ Rake::ExtensionTask.new('kontocheck')
21
+
22
+ begin
23
+ require 'jeweler'
24
+ Jeweler::Tasks.new do |gem|
25
+ gem.name = "kontocheck"
26
+ gem.summary = %Q{Checking german BICs/Bank account numbers}
27
+ gem.description = %Q{Check whether a certain bic/account-no-combination can possibly be valid. It uses the C library konto_check (see http://sourceforge.net/projects/kontocheck/) by Michael Plugge.}
28
+ gem.email = "jan@general-scripting.com"
29
+ gem.homepage = "http://github.com/jeanmartin/konto_check"
30
+ gem.authors = ["Provideal Systems GmbH","Michael Plugge","Jan Schwenzien"]
31
+ gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
32
+ #gem.files.exclude "ext"
33
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
34
+ end
35
+ Jeweler::GemcutterTasks.new
36
+ rescue LoadError
37
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
38
+ end
39
+
40
+ require 'rake/testtask'
41
+ Rake::TestTask.new(:test) do |test|
42
+ test.libs << 'lib' << 'test'
43
+ test.pattern = 'test/**/test_*.rb'
44
+ test.verbose = true
45
+ end
46
+
47
+ begin
48
+ require 'rcov/rcovtask'
49
+ Rcov::RcovTask.new do |test|
50
+ test.libs << 'test'
51
+ test.pattern = 'test/**/test_*.rb'
52
+ test.verbose = true
53
+ end
54
+ rescue LoadError
55
+ task :rcov do
56
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
57
+ end
58
+ end
59
+
60
+ task :test => :check_dependencies
61
+
62
+ task :default => :test
63
+
64
+ require 'rake/rdoctask'
65
+ Rake::RDocTask.new do |rdoc|
66
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
67
+
68
+ rdoc.rdoc_dir = 'rdoc'
69
+ rdoc.title = "konto_check #{version}"
70
+ rdoc.rdoc_files.include('README*')
71
+ rdoc.rdoc_files.include('lib/**/*.rb')
72
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,5 @@
1
+ --
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 6
5
+
@@ -0,0 +1,32 @@
1
+ # Copyright (c) 2010 Provideal Systems GmbH
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+
17
+ # Loads mkmf which is used to make makefiles for Ruby extensions
18
+ require 'mkmf'
19
+
20
+ # Give it a name
21
+ extension_name = 'konto_check_raw'
22
+
23
+ if have_library("z", "uncompress")
24
+ # The destination
25
+ dir_config(extension_name)
26
+
27
+ # Do the work
28
+ create_makefile(extension_name)
29
+ else
30
+ puts("Sadly, I can't find zlib. But I need it to compile. :(")
31
+ end
32
+