teodoro 0.40.2 → 0.40.3
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/lib/teodoro.rb +1 -1
- data/lib/teodoro/arquivo_xml.rb +22 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29ec7f364493911d10565a2501b275843a19f6bd18a345d96ad595a2c02fa615
|
|
4
|
+
data.tar.gz: 1962eedd713cf5d5d0402fecfd675ee95f93047914625e358d578396320555ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c850788fc616fc813fbdd3659026cdfb057afa316c21bc61e4d32b0a79e03bf2b50d0a258cfad904ba6a2c1cb8dc02b53552c8a102dc2320bfd8dea41c83f614
|
|
7
|
+
data.tar.gz: a822530efec002f1147d9313801dfb1aa657e1b269e924e70dfd6c5ce01dacab147a4472044b6043fa78df7a6274ea7313d60f5d9bd707ce84429291b5cda100
|
data/lib/teodoro.rb
CHANGED
data/lib/teodoro/arquivo_xml.rb
CHANGED
|
@@ -80,10 +80,14 @@ module Teodoro
|
|
|
80
80
|
Console.print "carregando #{nome}.xml..." do
|
|
81
81
|
evento, recibo = carregar_evento_e_recibo
|
|
82
82
|
|
|
83
|
-
@retificacao =
|
|
83
|
+
@retificacao = evento_retificavel? && evento['ideEvento/indRetif'] == '2'
|
|
84
84
|
@numero_do_recibo_a_retificar = evento['ideEvento/nrRecibo'] if retificacao?
|
|
85
85
|
@momento_de_processamento_pelo_e_social = recibo['processamento/dhProcessamento']
|
|
86
|
+
|
|
87
|
+
validar_carregamento
|
|
86
88
|
end
|
|
89
|
+
rescue StandardError => e
|
|
90
|
+
tratar_excecao(e)
|
|
87
91
|
end
|
|
88
92
|
|
|
89
93
|
def retificacao?
|
|
@@ -104,9 +108,7 @@ module Teodoro
|
|
|
104
108
|
processar_arquivo
|
|
105
109
|
end
|
|
106
110
|
rescue StandardError => e
|
|
107
|
-
|
|
108
|
-
puts e.message
|
|
109
|
-
raise e
|
|
111
|
+
tratar_excecao(e)
|
|
110
112
|
end
|
|
111
113
|
|
|
112
114
|
private
|
|
@@ -127,10 +129,20 @@ module Teodoro
|
|
|
127
129
|
File.read(caminho)
|
|
128
130
|
end
|
|
129
131
|
|
|
132
|
+
def evento_retificavel?
|
|
133
|
+
TIPOS_DE_EVENTO_RETIFICAVEIS.include?(tipo_de_evento)
|
|
134
|
+
end
|
|
135
|
+
|
|
130
136
|
def tipo_de_evento
|
|
131
137
|
@tipo_de_evento ||= nome[-6..].delete('-')
|
|
132
138
|
end
|
|
133
139
|
|
|
140
|
+
def validar_carregamento
|
|
141
|
+
return if momento_de_processamento_pelo_e_social
|
|
142
|
+
|
|
143
|
+
raise 'arquivo corrompido (sem data e horário do processamento do evento)'
|
|
144
|
+
end
|
|
145
|
+
|
|
134
146
|
def validar_versao_do_leiaute
|
|
135
147
|
raise unless %w[
|
|
136
148
|
02_04_01
|
|
@@ -186,5 +198,11 @@ module Teodoro
|
|
|
186
198
|
def xml_do_recibo
|
|
187
199
|
Nokogiri::XML(xml.css('/eSocial/retornoProcessamentoDownload/recibo/*/*').to_s)
|
|
188
200
|
end
|
|
201
|
+
|
|
202
|
+
def tratar_excecao(excecao)
|
|
203
|
+
puts caminho
|
|
204
|
+
puts excecao.message
|
|
205
|
+
raise excecao
|
|
206
|
+
end
|
|
189
207
|
end
|
|
190
208
|
end
|
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.40.
|
|
4
|
+
version: 0.40.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Clavius Tales
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-08-
|
|
11
|
+
date: 2021-08-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|