bicvalidator 0.1.6 → 0.1.7
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.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/bicvalidator.gemspec +1 -0
- data/lib/bicvalidator/version.rb +1 -1
- data/lib/bicvalidator.rb +5 -2
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786e4bf30de058e920d733251a099ca19aa5c08b
|
4
|
+
data.tar.gz: b61fcc4448692a261a0c237efdd9589d24d1ff85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b0c48bed78bea721c15b149cb244d344beff5ab031d13c00ab5375edd221cf97709b24143417cb4f39b593b04fc3289a721ad1fea3d8fd9037504c92762b819
|
7
|
+
data.tar.gz: 591257c388490872ce0db5ab21712360eb97098b89163fe2cb955d3cbefbfc939aeb64a9d780d7698c28a6420e1a87a945f9a4b99ee431307cf678844f3bcb9a
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Bicvalidator
|
2
2
|
Mit dem BicValidator wird eine BIC gemäß den [ISO9362)(https://de.wikipedia.org/wiki/ISO_9362) Anforderungen geprüft. Zusätzlich wird übeprüft ob die BIC gemäß dem Ländercode im SEPA Raum ist.
|
3
|
-
|
3
|
+
Man kann die checks direkt aufrufen oder als Model.Validator einsetzen
|
4
4
|
Inspiriert von [boostify/bic_validation](https://github.com/boostify/bic_validation)
|
5
5
|
|
6
6
|
## Installation
|
@@ -29,7 +29,7 @@ In den Bics sind mehr Länder als in den IBANS, denn die französischen und engl
|
|
29
29
|
### Instanz Initialisierung
|
30
30
|
**Bicvalidator::Bic.new(string)**
|
31
31
|
|
32
|
-
### Beipiele
|
32
|
+
### Beipiele Direktcheck
|
33
33
|
**bv = Bicvalidator::Bic.new(" GENODEM 1A HL ")**
|
34
34
|
|
35
35
|
bv.errorcode => nil
|
@@ -40,6 +40,12 @@ In den Bics sind mehr Länder als in den IBANS, denn die französischen und engl
|
|
40
40
|
bv.sepa_scheme? => true (ist gemäß dem SEPA-Ländercodes im SEPA-Schema Raum, zb CH ist drin, obwohl nicht EU)
|
41
41
|
bv.eu? => true
|
42
42
|
|
43
|
+
|
44
|
+
### Beipiele ActiveRecord Validator
|
45
|
+
* validates :bic, bic_model: true
|
46
|
+
* Liefert die übersetzten Erroscodes zurück => z.B. model.errors.messages =>{:bic=>["invalid length"]}
|
47
|
+
|
48
|
+
|
43
49
|
### Errorcodes
|
44
50
|
Wenn man genau wissen will , was der Fehler ist kann man mit bv.errorcode den genauen Wert ermitteln
|
45
51
|
* "BV0010" if !has_valid_lenght?
|
data/bicvalidator.gemspec
CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
#for mattr_accessor, reverse_merge
|
40
40
|
spec.add_dependency "activesupport"
|
41
41
|
|
42
|
+
spec.add_dependency 'activemodel'
|
42
43
|
#laender
|
43
44
|
#Countries is a collection of all sorts of useful information for every country in the ISO 3166 standard.
|
44
45
|
#It contains info for the following standards ISO3166-1 (countries),
|
data/lib/bicvalidator/version.rb
CHANGED
data/lib/bicvalidator.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require "bicvalidator/version"
|
2
|
+
require 'active_model'
|
2
3
|
require 'active_support'
|
3
4
|
require 'active_support/core_ext'
|
4
5
|
require "bicvalidator/bic"
|
6
|
+
require 'bicvalidator/bic_model_validator'
|
5
7
|
#brauch ich fuer laendercodes ISO3166::Country
|
6
8
|
require 'countries'
|
7
9
|
module Bicvalidator
|
@@ -9,9 +11,10 @@ module Bicvalidator
|
|
9
11
|
mattr_accessor :countries
|
10
12
|
mattr_accessor :eu_countries
|
11
13
|
#mattr_accessor :non_eu_countries
|
12
|
-
|
13
14
|
Bicvalidator.sepa_bic_countries = ["AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "IE", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "NL", "NO", "PL", "PT", "RO", "SE", "SI", "SK", "SM", "GI", "GF", "GP", "GG", "IS", "IM", "JE", "MQ", "YT", "RE", "BL", "MF", "PM"]
|
14
15
|
Bicvalidator.countries = ISO3166::Country.translations.keys
|
15
16
|
Bicvalidator.eu_countries = ISO3166::Country.all.select {|it| it.in_eu?}.map{|et| et.alpha2}
|
16
|
-
|
17
17
|
end
|
18
|
+
ActiveModel::Validations.send(:include, Bicvalidator)
|
19
|
+
I18n.load_path += Dir[File.expand_path(File.join(File.dirname(__FILE__),
|
20
|
+
'/locales', '*.yml')).to_s]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bicvalidator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olaf Kaderka
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activemodel
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: countries
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|