kontocheck 0.0.6

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.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'konto_check'
@@ -0,0 +1,152 @@
1
+ # load the c extension
2
+ require 'konto_check_raw'
3
+
4
+ module KontoCheck
5
+
6
+ SEARCH_KEYS = [:ort, :plz, :pz, :bic, :blz, :namen, :namen_kurz]
7
+
8
+ SEARCH_KEY_MAPPINGS = {
9
+ :city => :ort,
10
+ :zip => :plz,
11
+ :name => :namen,
12
+ :kurzname => :namen_kurz,
13
+ :shortname => :namen_kurz
14
+ }
15
+
16
+ class << self
17
+
18
+ # die Funktionalit�t von lut_info() aus KontoCheckRaw ist auf drei Funktionen verteilt:
19
+ # lut_info() gibt die Infos zum geladenen Datensatz zur�ck, die Funktionen
20
+ # lut_info1(<filename>) und lut_info2(<filename>) die Infos zum ersten bzw.
21
+ # zweiten Datensatz der Datei <filename>. Alle drei Funktionen liefern nur den Klartext.
22
+
23
+ def lut_info()
24
+ KontoCheckRaw::lut_info()[3]
25
+ end
26
+
27
+ def lut_info1(filename)
28
+ KontoCheckRaw::lut_info(filename)[3]
29
+ end
30
+
31
+ def lut_info2(filename)
32
+ KontoCheckRaw::lut_info(filename)[4]
33
+ end
34
+
35
+ def dump_lutfile(filename)
36
+ KontoCheckRaw::dump_lutfile(filename).first
37
+ end
38
+
39
+ def retval2dos(*args)
40
+ KontoCheckRaw::retval2dos(*args)
41
+ end
42
+
43
+ def retval2html(*args)
44
+ KontoCheckRaw::retval2html(*args)
45
+ end
46
+
47
+ def retval2utf8(*args)
48
+ KontoCheckRaw::retval2utf8(*args)
49
+ end
50
+
51
+ def retval2txt(*args)
52
+ KontoCheckRaw::retval2txt(*args)
53
+ end
54
+
55
+ def generate_lutfile(*args)
56
+ KontoCheckRaw::generate_lutfile(*args)
57
+ end
58
+
59
+ def init(*args)
60
+ KontoCheckRaw::init(*args)
61
+ end
62
+
63
+ def free(*args)
64
+ KontoCheckRaw::free(*args)
65
+ end
66
+
67
+ def konto_check(blz, ktno)
68
+ KontoCheckRaw::konto_check(blz, ktno)[1]
69
+ end
70
+ alias_method :valid, :konto_check
71
+
72
+ def konto_check?(blz, ktno)
73
+ KontoCheckRaw::konto_check(blz, ktno).first
74
+ end
75
+ alias_method :valid?, :konto_check?
76
+
77
+ def bank_valid(*args)
78
+ KontoCheckRaw::bank_valid(*args)[1]
79
+ end
80
+
81
+ def bank_valid?(*args)
82
+ KontoCheckRaw::bank_valid(*args).first
83
+ end
84
+
85
+ def bank_filialen(*args)
86
+ KontoCheckRaw::bank_filialen(*args).first
87
+ end
88
+
89
+ def bank_name(*args)
90
+ KontoCheckRaw::bank_name(*args).first
91
+ end
92
+
93
+ def bank_name_kurz(*args)
94
+ KontoCheckRaw::bank_name_kurz(*args).first
95
+ end
96
+
97
+ def bank_ort(*args)
98
+ KontoCheckRaw::bank_ort(*args).first
99
+ end
100
+
101
+ def bank_plz(*args)
102
+ KontoCheckRaw::bank_plz(*args).first
103
+ end
104
+
105
+ def bank_pz(*args)
106
+ KontoCheckRaw::bank_pz(*args).first
107
+ end
108
+
109
+ def bank_bic(*args)
110
+ KontoCheckRaw::bank_bic(*args).first
111
+ end
112
+
113
+ def bank_aenderung(*args)
114
+ KontoCheckRaw::bank_aenderung(*args).first
115
+ end
116
+
117
+ def bank_loeschung(*args)
118
+ KontoCheckRaw::bank_loeschung(*args).first
119
+ end
120
+
121
+ def bank_nachfolge_blz(*args)
122
+ KontoCheckRaw::bank_nachfolge_blz(*args).first
123
+ end
124
+
125
+ def bank_pan(*args)
126
+ KontoCheckRaw::bank_pan(*args).first
127
+ end
128
+
129
+ def bank_nr(*args)
130
+ KontoCheckRaw::bank_nr(*args).first
131
+ end
132
+
133
+ # Mammutfunktion, die alle Infos �ber eine Bank zur�ckliefert
134
+ def bank_alles(*args)
135
+ KontoCheckRaw::bank_alles(*args)
136
+ end
137
+
138
+ def suche(options={})
139
+ key = options.keys.first.to_sym
140
+ value = options[key]
141
+ key = SEARCH_KEY_MAPPINGS[key] if SEARCH_KEY_MAPPINGS.keys.include?(key)
142
+ raise 'search key not supported' unless SEARCH_KEYS.include?(key)
143
+ raw_results = KontoCheckRaw::send("bank_suche_#{key}", value)
144
+ # puts "RESULT: #{raw_results.inspect}"
145
+ # []
146
+ raw_results[1]
147
+ end
148
+ alias_method :search, :suche
149
+
150
+ end
151
+
152
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'konto_check'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestKontoCheck < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kontocheck
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 6
10
+ version: 0.0.6
11
+ platform: ruby
12
+ authors:
13
+ - Provideal Systems GmbH
14
+ - Michael Plugge
15
+ - Jan Schwenzien
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-04-16 00:00:00 Z
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: thoughtbot-shoulda
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: 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.
37
+ email: jan@general-scripting.com
38
+ executables: []
39
+
40
+ extensions:
41
+ - ext/konto_check_raw/extconf.rb
42
+ extra_rdoc_files:
43
+ - LICENSE
44
+ - README.textile
45
+ files:
46
+ - .document
47
+ - CHANGES
48
+ - LICENSE
49
+ - README.textile
50
+ - Rakefile
51
+ - VERSION.yml
52
+ - ext/konto_check_raw/extconf.rb
53
+ - ext/konto_check_raw/konto_check.c
54
+ - ext/konto_check_raw/konto_check.h
55
+ - ext/konto_check_raw/konto_check_raw_ruby.c
56
+ - init.rb
57
+ - lib/konto_check.rb
58
+ - test/helper.rb
59
+ - test/test_konto_check.rb
60
+ homepage: http://github.com/jeanmartin/konto_check
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ requirements: []
87
+
88
+ rubyforge_project:
89
+ rubygems_version: 1.7.2
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: Checking german BICs/Bank account numbers
93
+ test_files:
94
+ - test/helper.rb
95
+ - test/test_konto_check.rb