teodoro 0.59.0 → 0.59.1

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
  SHA256:
3
- metadata.gz: 16090454b943f6dcf593dd00cb47f4d6c2c70a496666604928d8697e93122b52
4
- data.tar.gz: 0e547aec652063cb273180e9f6ac0c02dc2c3d1ccca157f8db49402253ef5fd7
3
+ metadata.gz: 494a77b49bb883ae777a97ce092eb6d2b92308fc98775da3558f2a516f54bc55
4
+ data.tar.gz: 99f67c5e7cdca4f048a80cb9892683d82087b649492457763ffbfad74f0e4cb7
5
5
  SHA512:
6
- metadata.gz: 4d14465f187f7e708321c46e3b30b0bf7970389f29ee8d695a4e027739df22ccb3ec8e50368e52cb226353d537306ae39c99b57e62a4f5f1bd2bba0cbcf6a94c
7
- data.tar.gz: abda36e22058ea1ac2e140dc68fe9f8d1a62b2167a4178367f193b1de99dd1718832c5db71ef5915dc87251abef546637ea6ec9ae567bb3fe4eaa3b9b2cbade9
6
+ metadata.gz: 55093cbbbf718d106d6dbbe9543445b2508b1f09efb2c983cd1d79822b6c6f23900a9d21fee2ed939656761bdb20bf294c096bec139208a1d5fa3b436c1c9385
7
+ data.tar.gz: 8d0a3b5e61eff8df68e171a91f1f83a5c207d148b7a9d4de5fe3aabe9e9d75375daa9cbebbdfee68a7aac327e196d1186cd44673f81581761e7005bf1d0e1a57
@@ -3,7 +3,7 @@ module Teodoro
3
3
  include ArquivoDeEvento
4
4
 
5
5
  def processar
6
- return if exclusao?
6
+ return if excluido?
7
7
 
8
8
  if retificado?
9
9
  processar_retificacao
@@ -14,7 +14,7 @@ module Teodoro
14
14
 
15
15
  private
16
16
 
17
- def exclusao?
17
+ def excluido?
18
18
  empresa.recibos_dos_eventos_excluidos.include?(numero_do_recibo)
19
19
  end
20
20
 
@@ -22,8 +22,7 @@ module Teodoro
22
22
  .readlines(caminho)
23
23
  .map(&:strip)
24
24
  .map { _1.split('=') }
25
- .map { _1.size == 2 ? _1 : [_1.first, nil] }
26
- .to_h
25
+ .to_h { |chave, valor| [chave, valor] }
27
26
  end
28
27
  end
29
28
  end
@@ -50,6 +50,7 @@ module Teodoro
50
50
  ordenar_arquivos_xml
51
51
  validar_que_primeiro_arquivo_xml_eh_s1000
52
52
  processar_arquivos_xml
53
+ validar_que_nao_houve_evento_de_retificacao_sem_inclusao_correspondente
53
54
  salvar_arquivo_de_dados_gerais
54
55
  processar_cargos_gerados
55
56
  processar_funcoes_geradas
@@ -194,6 +195,19 @@ module Teodoro
194
195
  arquivos_xml.shift.processar while arquivos_xml.any?
195
196
  end
196
197
 
198
+ def validar_que_nao_houve_evento_de_retificacao_sem_inclusao_correspondente
199
+ return if arquivo_xml_por_recibo_de_evento_retificado.empty?
200
+
201
+ puts ''
202
+ puts [
203
+ 'Erro! Evento(s) de retificação sem inclusão correspondente:',
204
+ *arquivo_xml_por_recibo_de_evento_retificado
205
+ .values
206
+ .map { "#{_1.nome}.xml" }
207
+ ].map { Rainbow(_1).red }
208
+ exit
209
+ end
210
+
197
211
  def salvar_arquivo_de_dados_gerais
198
212
  arquivo_de_dados_gerais.salvar
199
213
  end
@@ -71,7 +71,7 @@ module Teodoro
71
71
  ]
72
72
  ]
73
73
  end
74
- ).map { [_1.first, _1] }.to_h
74
+ ).to_h { [_1.first, _1] }
75
75
  end
76
76
  end
77
77
  end
@@ -390,7 +390,7 @@ module Teodoro
390
390
  private
391
391
 
392
392
  def indice
393
- @indice ||= chaves_valores.map { [_1.first, _1] }.to_h
393
+ @indice ||= chaves_valores.to_h { [_1.first, _1] }
394
394
  end
395
395
  end
396
396
 
@@ -147,7 +147,7 @@ module Teodoro
147
147
  private
148
148
 
149
149
  def indice
150
- @indice ||= chaves_valores.map { [_1.first, _1] }.to_h
150
+ @indice ||= chaves_valores.to_h { [_1.first, _1] }
151
151
  end
152
152
  end
153
153
 
@@ -1,3 +1,3 @@
1
1
  module Teodoro
2
- VERSION = '0.59.0'.freeze
2
+ VERSION = '0.59.1'.freeze
3
3
  end
data/lib/teodoro.rb CHANGED
@@ -18,8 +18,7 @@ module Teodoro
18
18
  .then { File.join(_1, 'CBOs.json') }
19
19
  .then { File.read(_1) }
20
20
  .then { JSON.parse(_1) }
21
- .map { [_1['codigo'], _1['titulo']] }
22
- .to_h
21
+ .to_h { [_1['codigo'], _1['titulo']] }
23
22
  .freeze
24
23
 
25
24
  Municipios = __FILE__
@@ -27,8 +26,7 @@ module Teodoro
27
26
  .then { File.join(_1, 'municipios.json') }
28
27
  .then { File.read(_1) }
29
28
  .then { JSON.parse(_1) }
30
- .map { [_1['codigo'], _1['nome']] }
31
- .to_h
29
+ .to_h { [_1['codigo'], _1['nome']] }
32
30
  .freeze
33
31
 
34
32
  TiposDeLogradouro = __FILE__
@@ -36,8 +34,7 @@ module Teodoro
36
34
  .then { File.join(_1, 'tipos_de_logradouro.json') }
37
35
  .then { File.read(_1) }
38
36
  .then { JSON.parse(_1) }
39
- .map { [_1['codigo'], _1['descricao']] }
40
- .to_h
37
+ .to_h { [_1['codigo'], _1['descricao']] }
41
38
  .freeze
42
39
 
43
40
  def self.call(args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teodoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.0
4
+ version: 0.59.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fortes Tecnologia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-21 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.4.3
153
+ rubygems_version: 3.4.10
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: ''