iso-iban_validation 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/iso/iban_validation/iban_validator.rb +8 -6
- data/lib/iso/iban_validation/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5072d29300e00cab35df8a654a4cedcf8fa449a
|
4
|
+
data.tar.gz: f4f1a5b618cd662103b70024baa86d035889b238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9441710e40c0b3bb67f8ac8a94561cfe577cca8796983508a7a9ff0c03934bdef46c7cd1b570828db339623991ffced52cdcd7e26288949710b63f5ed5463324
|
7
|
+
data.tar.gz: 325d9fd5358a36861d8fcf2e250c7c127fe107333cd4a03fcf0e320aaf429d316df3c46977195866447c9f2deb471d3d2ef5499fbe20f51343620787a1689b41
|
data/README.md
CHANGED
@@ -31,6 +31,15 @@ or
|
|
31
31
|
|
32
32
|
validates :iban_field, iban: true
|
33
33
|
|
34
|
+
|
35
|
+
## Error translations
|
36
|
+
The following error keys should be defined
|
37
|
+
* :invalid_characters
|
38
|
+
* :invalid_country
|
39
|
+
* :invalid_checksum
|
40
|
+
* :invalid_length
|
41
|
+
* :invalid_format
|
42
|
+
|
34
43
|
## Dependency
|
35
44
|
|
36
45
|
* [iso-iban](https://github.com/apeiros/iso-iban)
|
@@ -1,12 +1,14 @@
|
|
1
1
|
class IbanValidator < ActiveModel::EachValidator
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
ISO::IBAN.validate(value).each do |error_key|
|
5
|
+
record.errors.add(
|
6
|
+
attribute,
|
7
|
+
error_key,
|
8
|
+
message: options[:message],
|
9
|
+
value: value,
|
10
|
+
)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iso-iban_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Simecek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-iban
|
@@ -77,3 +77,4 @@ signing_key:
|
|
77
77
|
specification_version: 3
|
78
78
|
summary: IBAN rails validator
|
79
79
|
test_files: []
|
80
|
+
has_rdoc:
|