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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec6e411bf638b2318d4fe1bf4c796f0c810a864b
4
- data.tar.gz: 02d654ef53a4ee03400d23222e30a91a8c456238
3
+ metadata.gz: f5072d29300e00cab35df8a654a4cedcf8fa449a
4
+ data.tar.gz: f4f1a5b618cd662103b70024baa86d035889b238
5
5
  SHA512:
6
- metadata.gz: b949fa729808ee7dc46bf96397f9d0630d351c08186507e03aeb8dc29297f39e63510d98af79f4bf3de9d40b009e3b28434376a9e7b09293dc665e953124f3c6
7
- data.tar.gz: 8b264a790a86755a5fbcee093a6450762033ce3a8188293f304a80dff05a7d80c620aa77d0b19783fb6ef5488ba9ba6b96ff6a634f8a4729bfcb2f2934526525
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
- record.errors.add(
5
- attribute,
6
- :invalid_iban,
7
- message: options[:message],
8
- value: value,
9
- ) unless ISO::IBAN.valid?(value || '')
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
@@ -1,5 +1,5 @@
1
1
  module Iso
2
2
  module IbanValidation
3
- VERSION = "0.0.7"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  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.7
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-06-05 00:00:00.000000000 Z
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: