br_documents 0.1.1 → 0.1.2

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: af282960d7eec2aace8577ece140037ae92bccc7
4
- data.tar.gz: 6a0949192d3fa4e7629b3616607a4ce1a7fa69d6
3
+ metadata.gz: 70d69d78462e3ab61040e25f8540bf7775a80f0f
4
+ data.tar.gz: da45afd43f7ab8283f2175a6d7202d1bbe34ae5e
5
5
  SHA512:
6
- metadata.gz: faae22eac35ea67c6c76d94987fbf4202d50e7dbb97b08d871f8284a5da121c79636aed37e61f275bcabfe91f8fa6aff248536556c343e55687368494b3ef4aa
7
- data.tar.gz: 5ee7e4460d07128179bff951441ca1cb7ab8b214187ca1122e846d72303d84bac591c54af2514374682b86e4df0e558a55fe72db4f1a52035c52881e6b32b949
6
+ metadata.gz: 53f7b3ca1a384b09aa3a4ece17793fc5707e9443015b0916822c808278d1f1c18eb2e0dff24346b24a1b68815b85088fbe9478f38f92330bfeda1f58f1afd5ae
7
+ data.tar.gz: f7bc5af898cd89ceaa00ac06261fa91559a9187d72bce79fc4121eba7cc501c69710774bac7b6c1eb032e542dde2351905a63ce306e4445784537ae5fbebfd5c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- br_documents (0.1.1)
4
+ br_documents (0.1.2)
5
5
  activemodel (>= 4.0.0)
6
6
  i18n (>= 0.6.5)
7
7
 
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  simplecov (>= 0.9.0)
62
62
 
63
63
  BUNDLED WITH
64
- 1.16.4
64
+ 1.16.3
@@ -0,0 +1,21 @@
1
+ module BrDocuments
2
+ module Commons
3
+ module Mod14
4
+
5
+ def generate_digital_check(values, weights)
6
+ sum = reduce_weights(values, weights)
7
+ mod = sum % 11
8
+ mod = (11 - mod)
9
+ mod < 10 ? mod : (mod - 10)
10
+ end
11
+
12
+ def reduce_weights(values, weights)
13
+ sum = 0
14
+ weights.each_index do |i|
15
+ sum += weights[i] * values[i].to_i
16
+ end
17
+ sum
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,10 +1,10 @@
1
1
  require_relative "base"
2
- require_relative "../commons/mod11"
2
+ require_relative "../commons/mod14"
3
3
 
4
4
  module BrDocuments
5
5
  module IE
6
6
  class RO < Base
7
- include Commons::Mod11
7
+ include Commons::Mod14
8
8
 
9
9
  private
10
10
  def format_ie(number)
@@ -1,3 +1,3 @@
1
1
  module BrDocuments
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -52,7 +52,7 @@ describe BrDocuments::IE::RO do
52
52
  end
53
53
 
54
54
  it "is valid with valid number" do
55
- ie = described_class.new("00000000625213")
55
+ ie = described_class.new("00000003497861")
56
56
  expect(ie).to be_valid
57
57
  end
58
58
  end
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.1.1
4
+ version: 0.1.2
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: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2019-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -144,6 +144,7 @@ files:
144
144
  - lib/br_documents/cnpj_cpf/document.rb
145
145
  - lib/br_documents/cnpj_validator.rb
146
146
  - lib/br_documents/commons/mod11.rb
147
+ - lib/br_documents/commons/mod14.rb
147
148
  - lib/br_documents/cpf_validator.rb
148
149
  - lib/br_documents/gtin/gtin.rb
149
150
  - lib/br_documents/gtin_validator.rb