br_documents 0.0.14 → 0.0.15
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/.gitignore +1 -0
- data/README.md +4 -0
- data/lib/br_documents/ie_validator.rb +4 -4
- data/lib/br_documents/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85b3dba0a5cb19581015f983a1ec5f186521756d
|
|
4
|
+
data.tar.gz: f4166ebcf7711bc8849438bd317649ce0c02a5a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74be958176462d91c7eeb8779b0976191dd34fdf361b086717806d1462ffcb9d89b08c63fc2efb20513986e70ac8056e9876531d16c391793dabcc340b2109d2
|
|
7
|
+
data.tar.gz: 69fc04d5fa9cc32d5b52544b094281fa923cec602c11a92f7ea58752e9d4f0400e2b08a2141104e8b356e49e3d2d0b969b05b117337a917d4e1e46ce787aff0f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class IeValidator < ActiveModel::EachValidator
|
|
2
2
|
def validate_each(record, attribute, value)
|
|
3
3
|
if ie_present?(value)
|
|
4
|
-
attribute_uf_was_configured_at_validator?(record
|
|
5
|
-
can_read_uf_at_record?(options, record
|
|
4
|
+
attribute_uf_was_configured_at_validator?(record) and
|
|
5
|
+
can_read_uf_at_record?(options, record) and
|
|
6
6
|
ie_valid?(record, attribute, value)
|
|
7
7
|
end
|
|
8
8
|
end
|
|
@@ -12,13 +12,13 @@ class IeValidator < ActiveModel::EachValidator
|
|
|
12
12
|
value.present?
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def attribute_uf_was_configured_at_validator?(record
|
|
15
|
+
def attribute_uf_was_configured_at_validator?(record)
|
|
16
16
|
record.errors.add(:base,
|
|
17
17
|
I18n.t("validator.ie.uf.no_configured")) unless options[:uf].present?
|
|
18
18
|
record.errors.messages.empty?
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def can_read_uf_at_record?(options, record
|
|
21
|
+
def can_read_uf_at_record?(options, record)
|
|
22
22
|
begin
|
|
23
23
|
read_uf(record)
|
|
24
24
|
rescue NoMethodError
|
data/lib/br_documents/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: br_documents
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ASSEINFO - Sistemas de Informação
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -235,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
235
235
|
version: '0'
|
|
236
236
|
requirements: []
|
|
237
237
|
rubyforge_project:
|
|
238
|
-
rubygems_version: 2.6.
|
|
238
|
+
rubygems_version: 2.6.13
|
|
239
239
|
signing_key:
|
|
240
240
|
specification_version: 4
|
|
241
241
|
summary: Validates brazilian documents like CPF, CNPJ and IE. It can be used with
|