Ibanvalidator (under Construction)
Ibanvalidator ist eine Ruby/Rails Library zum überüfen von IBANs in > 60 Ländern. Mehr Infos zur IBAN
Es basiert auf der gem iban-tools von Iulianu die dann vom Team bei AlphaSights weiterentwickelt wurde.
Wir wollen diese gem weiterpflegen und zusätzliche Funktionen integrieren.
Installation
Add this line to your application's Gemfile:
gem 'ibanvalidator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ibanvalidator
Usage
quick validation
require 'ibanvalidator'
Ibanvalidator::IBAN.valid?("DE89370400440532013000") => true
advanced
require 'ibanvalidator'
iban = Ibanvalidator::IBAN.new("DE89370 40044053201 3000")
iban.valid? => true
iban.code => "DE89370400440532013000"
iban.bban => "370400440532013000"
iban.country_code => "DE"
iban.check_digits => "89"
iban.prettify => "DE89 3704 0044 0532 0130 00"
iban.sepa_scheme? => true
converting iban => to_local
iban = Ibanvalidator::IBAN.new("DE89370 40044053201 3000")
iban.to_local => {bank_code: '37040044', account_number: '532013000'}
Steuerung der Ausgabe der f
errors
iban.errors => [] => Array mit den m
Konstants/Inits
**Ibanvalidator.default_rules** => liefert alle IBAN Regeln
**Ibanvalidator.rule_countries** => liefert ein Array mit allen L
ActiveRecord/Model Validator
Man kann auch den Model Validator einbinden. Die Fehlermeldungen sind übersetzt in deutsch und englisch siehe /locales
validates :iban, iban_model: true
locales:
de:
errors:
messages:
iban_too_short: zu wenig Zeichen
iban_too_long: zu viel Zeichen
iban_bad_chars: ung
Development
After checking out the repo, run bin/setup to install dependencies. Then, run spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/olafkaderka/ibanvalidator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.