teodoro 0.7.0 → 0.11.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 +4 -4
- data/lib/teodoro.rb +8 -2
- data/lib/teodoro/arquivo_data.rb +81 -0
- data/lib/teodoro/arquivo_de_evento.rb +14 -2
- data/lib/teodoro/arquivo_de_evento_de_tabela.rb +32 -14
- data/lib/teodoro/arquivo_de_evento_nao_periodico.rb +36 -13
- data/lib/teodoro/arquivo_de_origem.rb +7 -7
- data/lib/teodoro/arquivo_xml.rb +29 -22
- data/lib/teodoro/console.rb +3 -1
- data/lib/teodoro/empresa.rb +15 -17
- data/lib/teodoro/leiaute/arquivo_s1000.rb +24 -30
- data/lib/teodoro/leiaute/arquivo_s1005.rb +14 -20
- data/lib/teodoro/leiaute/arquivo_s1010.rb +11 -15
- data/lib/teodoro/leiaute/arquivo_s1020.rb +8 -12
- data/lib/teodoro/leiaute/arquivo_s1030.rb +6 -10
- data/lib/teodoro/leiaute/arquivo_s1040.rb +5 -9
- data/lib/teodoro/leiaute/arquivo_s1050.rb +8 -14
- data/lib/teodoro/leiaute/arquivo_s1070.rb +12 -16
- data/lib/teodoro/leiaute/arquivo_s2190.rb +15 -14
- data/lib/teodoro/leiaute/arquivo_s2200.rb +152 -156
- data/lib/teodoro/leiaute/arquivo_s2205.rb +132 -166
- data/lib/teodoro/leiaute/arquivo_s2206.rb +72 -75
- data/lib/teodoro/leiaute/arquivo_s2230.rb +87 -90
- data/lib/teodoro/leiaute/arquivo_s2250.rb +36 -40
- data/lib/teodoro/leiaute/arquivo_s2299.rb +171 -169
- data/lib/teodoro/leiaute/arquivo_s2300.rb +127 -131
- data/lib/teodoro/leiaute/arquivo_s2306.rb +148 -147
- data/lib/teodoro/leiaute/arquivo_s2399.rb +123 -127
- data/lib/teodoro/leiaute/arquivo_s3000.rb +4 -8
- data/lib/teodoro/xml.rb +2 -2
- metadata +3 -5
- data/lib/teodoro/arquivo_de_evento_criador_de_arquivo_data.rb +0 -52
- data/lib/teodoro/arquivo_de_evento_processador_de_arquivo_data.rb +0 -30
- data/lib/teodoro/arquivo_de_evento_retificavel.rb +0 -23
@@ -1,7 +1,7 @@
|
|
1
1
|
module Teodoro
|
2
2
|
module Leiaute
|
3
3
|
class ArquivoS3000
|
4
|
-
include
|
4
|
+
include ArquivoDeEvento
|
5
5
|
|
6
6
|
def processar
|
7
7
|
excluir_arquivos_data if tipo_de_evento_processavel?
|
@@ -16,19 +16,15 @@ module Teodoro
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def tipo_de_evento
|
19
|
-
@tipo_de_evento ||= evento['
|
19
|
+
@tipo_de_evento ||= evento['infoExclusao/tpEvento'].delete('-')
|
20
20
|
end
|
21
21
|
|
22
22
|
def excluir_arquivos_data
|
23
|
-
arquivos_data.excluir(numero_de_recibo_do_evento_a_excluir)
|
24
|
-
end
|
25
|
-
|
26
|
-
def arquivos_data
|
27
|
-
empresa.arquivos_data
|
23
|
+
empresa.arquivos_data.excluir(numero_de_recibo_do_evento_a_excluir)
|
28
24
|
end
|
29
25
|
|
30
26
|
def numero_de_recibo_do_evento_a_excluir
|
31
|
-
@numero_de_recibo_do_evento_a_excluir ||= evento['
|
27
|
+
@numero_de_recibo_do_evento_a_excluir ||= evento['infoExclusao/nrRecEvt']
|
32
28
|
end
|
33
29
|
|
34
30
|
def exclusao_de_admissao?
|
data/lib/teodoro/xml.rb
CHANGED
@@ -13,7 +13,7 @@ module Teodoro
|
|
13
13
|
extend Forwardable
|
14
14
|
|
15
15
|
def [](*path)
|
16
|
-
node_set = xml.css("
|
16
|
+
node_set = xml.css("/*/#{path.join('/')}")
|
17
17
|
|
18
18
|
raise if node_set.size > 1
|
19
19
|
return if node_set.size.zero?
|
@@ -27,7 +27,7 @@ module Teodoro
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def *(path) # rubocop:disable Naming/BinaryOperatorParameterName
|
30
|
-
xml.css("
|
30
|
+
xml.css("/*/#{path}").map { |node| self.class.new(Nokogiri::XML(node.to_s)) }
|
31
31
|
end
|
32
32
|
|
33
33
|
def css(path)
|
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.
|
4
|
+
version: 0.11.0
|
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-04-
|
11
|
+
date: 2021-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -187,12 +187,10 @@ extra_rdoc_files: []
|
|
187
187
|
files:
|
188
188
|
- bin/teodoro
|
189
189
|
- lib/teodoro.rb
|
190
|
+
- lib/teodoro/arquivo_data.rb
|
190
191
|
- lib/teodoro/arquivo_de_evento.rb
|
191
|
-
- lib/teodoro/arquivo_de_evento_criador_de_arquivo_data.rb
|
192
192
|
- lib/teodoro/arquivo_de_evento_de_tabela.rb
|
193
193
|
- lib/teodoro/arquivo_de_evento_nao_periodico.rb
|
194
|
-
- lib/teodoro/arquivo_de_evento_processador_de_arquivo_data.rb
|
195
|
-
- lib/teodoro/arquivo_de_evento_retificavel.rb
|
196
194
|
- lib/teodoro/arquivo_de_origem.rb
|
197
195
|
- lib/teodoro/arquivo_xml.rb
|
198
196
|
- lib/teodoro/cnpj.rb
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Teodoro
|
2
|
-
module ArquivoDeEventoCriadorDeArquivoData
|
3
|
-
include ArquivoDeEventoProcessadorDeArquivoData
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def criar_arquivo_data
|
8
|
-
raise caminho_do_arquivo_data if File.exist?(caminho_do_arquivo_data)
|
9
|
-
|
10
|
-
File.write(caminho_do_arquivo_data, conteudo_do_arquivo_data)
|
11
|
-
end
|
12
|
-
|
13
|
-
def conteudo_do_arquivo_data
|
14
|
-
(itens_do_conteudo_do_arquivo_data.map { "#{_1}=#{Valor.new(_2)}" } + ['']).join("\r\n")
|
15
|
-
end
|
16
|
-
|
17
|
-
def tipo_de_inscricao_do_empregador
|
18
|
-
@tipo_de_inscricao_do_empregador ||= evento["#{noh_principal_do_evento}/ideEmpregador/tpInsc"]
|
19
|
-
end
|
20
|
-
|
21
|
-
class Valor
|
22
|
-
FORMATADORES = {
|
23
|
-
bool: proc { _1 ? 'True' : 'False' },
|
24
|
-
data: proc { "#{_1[-2..]}/#{_1[5..6]}/#{_1[0..3]}" if _1 },
|
25
|
-
data_aaaammdd: proc { _1.delete('-') if _1 },
|
26
|
-
mes_ano: proc { "#{_1[-2..]}/#{_1[0..3]}" if _1 }
|
27
|
-
}.freeze
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def initialize(arg)
|
32
|
-
@arg = arg
|
33
|
-
end
|
34
|
-
|
35
|
-
attr_reader :arg
|
36
|
-
|
37
|
-
public
|
38
|
-
|
39
|
-
def to_s
|
40
|
-
@to_s ||= (tipo ? FORMATADORES[tipo].call(valor) : valor).to_s
|
41
|
-
end
|
42
|
-
|
43
|
-
def tipo
|
44
|
-
@tipo ||= arg[1] if arg.is_a?(Array)
|
45
|
-
end
|
46
|
-
|
47
|
-
def valor
|
48
|
-
@valor ||= arg.is_a?(Array) ? arg[0] : arg
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Teodoro
|
2
|
-
module ArquivoDeEventoProcessadorDeArquivoData
|
3
|
-
include ArquivoDeEvento
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def id_do_evento
|
8
|
-
evento.css(noh_principal_do_evento).first.attributes['Id'].value
|
9
|
-
end
|
10
|
-
|
11
|
-
def processo_de_emissao_do_evento
|
12
|
-
evento["#{noh_principal_do_evento}/ideEvento/procEmi"]
|
13
|
-
end
|
14
|
-
|
15
|
-
def criar_caminho_do_arquivo_data(nome_do_arquivo)
|
16
|
-
File.join(
|
17
|
-
destino_dos_arquivos_data,
|
18
|
-
"#{windows? ? nome_do_arquivo.gsub(%r{[<|>:"/\\?*]}, '_') : nome_do_arquivo}.data"
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
def destino_dos_arquivos_data
|
23
|
-
empresa.destino_dos_arquivos_data
|
24
|
-
end
|
25
|
-
|
26
|
-
def windows?
|
27
|
-
OS.windows?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Teodoro
|
2
|
-
module ArquivoDeEventoRetificavel
|
3
|
-
include ArquivoDeEvento
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def retificado?
|
8
|
-
arquivo_xml_de_retificacao
|
9
|
-
end
|
10
|
-
|
11
|
-
def arquivo_xml_de_retificacao
|
12
|
-
@arquivo_xml_de_retificacao ||= arquivos_xml_por_recibo_a_retificar[numero_do_recibo]
|
13
|
-
end
|
14
|
-
|
15
|
-
def arquivos_xml_por_recibo_a_retificar
|
16
|
-
empresa.arquivos_xml_por_recibo_a_retificar
|
17
|
-
end
|
18
|
-
|
19
|
-
def processar_retificacao
|
20
|
-
arquivo_xml_de_retificacao.processar
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|