Socket
Book a DemoInstallSign in
Socket

rbktoblzcheck

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rbktoblzcheck

0.1.2
bundlerRubygems
Version published
Maintainers
2
Created
Source

Ruby KtoBlzCheck

rbKtoBlzCheck is a small Ruby extension for Linux (written in C) that provides an interface for libktoblzcheck, a library to check German account numbers and bank codes. See http://ktoblzcheck.sourceforge.net for details.

Install instructions

Just install the gem with the following command:

$ gem install ktoblzcheck

Common errors:

  • ruby extconf.rb fails with "Couldn't find header file..." or "Couldn't find link library..."

    => Make sure the ktoblzcheck library and header files are correctly installed. => Consult the file mkmf.log for details of build time checks => Hint: If you've build and installed the ktoblzcheck library from source, make sure the install locations of the library files are listed in /etc/ld.so.conf and you've run ldconfig

  • compile errors

    Nothing to mention here: the code compiles without warning on Linux 2.6.7, glibc-2.3.2, gcc version 3.3.4 (Debian 1:3.3.4-7) with ruby 1.8.2 (2004-07-29) [i386-linux].

Dependencies:

  • Ruby >= 1.8
  • libktoblzcheck (obviously :)

The ktoblzcheck package can be downloaded from http://ktoblzcheck.sourceforge.net/ as source distribution tar-ball or RPM.

Debian has a package named 'libktoblzcheck1-dev' available in testing and unstable, simply apt-get install it.

Other platforms:

As I have no suitable non-Linux systems to mess around with, I have no idea whether this Ruby extension compiles and/or runs correctly on other platforms.

I guess, there should be no problems on BSDish systems. While the C-code should be quiet portable, I'm not sure if linking works correctly on Microsoft (R) Windows (R).

Comments on problems with OSes other than Linux are always welcome.

License:

BSD-style, see LICENSE

This project is based on the work of Sascha Loetz (blog.cadego.de, info@cadego(dot)de).

Ruby Interface:

Example:

require 'ktoblzcheck'

$bc="20030700" $an="0"

puts "Testing Bank Code: #{$bc} / Account No. #{$an}"

KtoBlzCheck.new do |kbc| name,location=kbc.find($bc) if name puts "Bank found! #{name} located in #{location}" else puts "Bank not found!" end case kbc.check($bc,$an) when KtoBlzCheck::ERROR puts "Failed, bank code and account number don't match" when KtoBlzCheck::OK puts "Success, valid combination of bank code and account number" when KtoBlzCheck::UNKNOWN puts "Unknown." when KtoBlzCheck::BANK_NOT_KNOWN puts "Unknown bank code" else puts "Never reached :)" end end

For more code examples refer to the rbkbc program and the test-*.rb files provided with this distribution.

Interface documentation:

KtoBlzCheck.new [ |block| ] -> obj KtoBlzCheck.new(datafilepath) [ |block| ] -> obj

Constructs a new KtoBlzCheck object, returns it or passes it to an optional code block. If no block is provided, the user must call KtoBlzCheck#close to ensure that all resources are freed after usage.

If a parameter is passed to new it is interpreted as the path to the data file to be used by libktoblzcheck. When the parameter is omitted, the default file of libktoblzcheck is used (usually /usr/[local/]share/[lib]ktoblzcheck[*]/bankdata.txt).

A nil value passed as parameter is ignored.

KtoBlzCheck#close

Closes the KtoBlzCheck object's handle for libktoblzcheck. Must be called to prevent resource leaks if KtoBlzCheck#new is not used with block syntax.

KtoBlzCheck#num_records -> aFixnum

Returns the number of entries in the currently used data file for libktoblzcheck.

KtoBlzCheck#check(bank_code, account_no) -> aFixnum

Checks if bank_code and account_no form a valid combination. The returned Fixnum indicates the result. The following constants can be used test the result:

KtoBlzCheck::OK -> valid combination of bank code and account number KtoBlzCheck::ERROR -> !OK KtoBlzCheck::UNKNOWN -> no verification possible for unknown reason KtoBlzCheck::BANK_NOT_KNOWN -> bank code not known

If bank_code and account_no are not of type String a TypeError is raised.

KtoBlzCheck#find(bank_code) -> anArray

Looks up bank name and bank location (city) for the bank identified by bank_code.

Returns an array with the bank's name (index 0) and the bank's location (index 1). The returned array is empty if no bank is found for the given bank code.

FAQs

Package last updated on 21 Jul 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.