iban_bic 1.2.0 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbba9bbccde215ba50dbd29a909f2c9e01968e7a
4
- data.tar.gz: 710aad2c5fa749eb059d3eb33d3832c4a202d792
3
+ metadata.gz: ceee574baf89047cca1c43e4a56867d1a21c5765
4
+ data.tar.gz: aca6662efc0a326032265cd136d700da947c7010
5
5
  SHA512:
6
- metadata.gz: 6a183e9f254b0b2b97573cc398c9949fdd850617b4a0eace66c4d36bf7ed51ee0c138528d8854fe83ddb72b63963a84eaf2c23627bd9890c733860a6d23e8a2f
7
- data.tar.gz: 7cae3dec5fbc0a6a218ad71b94482a53288a488763a944767f64a0dc69cde1e528a2bdda068ae9262284bd35e039c259b601bba613f82dacc20815ecd1affbe2
6
+ metadata.gz: 620962ed8c778c9a76fa26bad91bf8893761caa57d48f8468eb3dd2ac8e3b59845ddee9c9ddfa2916571827a3448421d6b30280b5844c8cbcc57bf980b32478c
7
+ data.tar.gz: bfb982acd2ed33a89d7da67d115d9bee90e9681a070f2f87d7a3ffc606b0fdc87113f10413995105f870f17dd9ff8e1baec7d3825fe8b2eab136420e31da5686
data/README.md CHANGED
@@ -126,6 +126,10 @@ $ bundle exec rails generate iban_bic:install --with-static-data
126
126
  4. Customize initializer if needed, adding validations for new countries, or overriding YAML files.
127
127
 
128
128
  ## Changelog
129
+ #### 1.3.0
130
+
131
+ * Added BIC format validation in BIC model.
132
+
129
133
  #### 1.2.0
130
134
 
131
135
  * Added `like_pattern_from_parts` method. Not a very performant version.
@@ -137,7 +141,7 @@ $ bundle exec rails generate iban_bic:install --with-static-data
137
141
 
138
142
  #### 1.0.1
139
143
 
140
- * Added presence validations in BIC model
144
+ * Added presence validations in BIC model.
141
145
 
142
146
  #### 1.0.0
143
147
 
@@ -5,6 +5,13 @@ class Bic < ActiveRecord::Base
5
5
 
6
6
  validates :country, :bank_code, :bic, presence: true
7
7
 
8
+ validate do
9
+ bic.upcase!
10
+ unless /[A-Z]{4}#{country}[0-9A-Z]{2,5}/.match? bic
11
+ errors.add(:bic, :invalid_format)
12
+ end
13
+ end
14
+
8
15
  after_commit do
9
16
  IbanBic.clear_cache
10
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IbanBic
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
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.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonardo Diez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails