iban_bic 1.4.2 → 1.4.3

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
- SHA1:
3
- metadata.gz: 79d54adf9bc8b595fc9f7694432b98b4691cb961
4
- data.tar.gz: 188d724bc1d08a24915e56a9a66daf3164657968
2
+ SHA256:
3
+ metadata.gz: 29b8179fb169e953a9eb678c7eb6ce155949083615134466aa2b55b05f1c8dab
4
+ data.tar.gz: 7f541e2e670a0139b15e4be2c9d997a0dd02f97e6f7310ce6b768b57039ff650
5
5
  SHA512:
6
- metadata.gz: 4ba5148098f2477779407e6fc309ce4c4a24492a4f31b70c7adf994cc6f85e5fe8fa0583dbd573465f9a658a368757e701bb686d6870942f6a3add6b466f0114
7
- data.tar.gz: 589012935320b25bfe476a84fc2d6ed6cd722eee088c260d4221eca7324d77a00f5e5f0dce1ff065f2914bf826815986e7fb3c42e2331b6c2ba925bb03707cc2
6
+ metadata.gz: 5f381e9984afed963f7cc22a7440cfc39058fde74b0d7650255d369109ce1202bf0ef947ab378857b0e0a0f3680b5a6e308ac0a016bce060ff5733529d11f964
7
+ data.tar.gz: f990ed3fa2c8fef5f6c949383626c1c35ff9d0583a2f1365b32360983e5a9391ee2f0b1adb6b0212ef239165f2e3ef75aa3b8dd5cc27b4a3062ddf39726e9609
data/README.md CHANGED
@@ -132,7 +132,7 @@ $ bundle exec rake iban_bic:load_data
132
132
  3.b. Using static data from YAML files
133
133
 
134
134
  Create an initializer file for configuration:
135
-
135
+
136
136
  ```bash
137
137
  $ bundle exec rails generate iban_bic:install --with-static-data
138
138
  ```
@@ -140,6 +140,10 @@ $ bundle exec rails generate iban_bic:install --with-static-data
140
140
  4. Customize initializer if needed, adding validations for new countries, or overriding YAML files.
141
141
 
142
142
  ## Changelog
143
+ #### 1.4.3
144
+
145
+ * Fixed validators to avoid failing when values are `nil`.
146
+
143
147
  #### 1.4.2
144
148
 
145
149
  * Dependencies security update.
@@ -9,6 +9,8 @@ module ActiveModel
9
9
  module Validations
10
10
  class BicValidator < ActiveModel::EachValidator
11
11
  def validate_each(record, attribute, value)
12
+ return unless value.present?
13
+
12
14
  country_field = options[:country] ? record[options[:country]] : "[A-Z]{2}"
13
15
  record.errors.add(attribute, :invalid_format) unless /^[A-Z]{4}#{country_field}[0-9A-Z]{2}([0-9A-Z]{3})?$/.match? value.upcase
14
16
  end
@@ -9,6 +9,8 @@ module ActiveModel
9
9
  module Validations
10
10
  class IbanValidator < ActiveModel::EachValidator
11
11
  def validate_each(record, attribute, value)
12
+ return unless value.present?
13
+
12
14
  if !IbanBic.parse(value)
13
15
  record.errors.add(attribute, :invalid_format)
14
16
  elsif !IbanBic.valid_check?(value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbanBic
4
- VERSION = "1.4.2"
4
+ VERSION = "1.4.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iban_bic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonardo Diez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-06 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: 5.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.1'
26
+ version: 5.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: regexp-examples
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  version: '0'
170
170
  requirements: []
171
171
  rubyforge_project:
172
- rubygems_version: 2.6.12
172
+ rubygems_version: 2.7.7
173
173
  signing_key:
174
174
  specification_version: 4
175
175
  summary: IBAN and BIC tools for Rails applications