teodoro 0.0.14 → 0.1.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 +2 -2
- data/lib/teodoro/{arquivo_de_evento_exceto_de_exclusao.rb → arquivo_de_evento_criador_de_arquivo_data.rb} +1 -1
- data/lib/teodoro/arquivo_de_evento_de_tabela.rb +1 -1
- data/lib/teodoro/arquivo_de_evento_nao_periodico.rb +9 -29
- data/lib/teodoro/arquivo_de_evento_retificavel.rb +23 -0
- data/lib/teodoro/arquivo_xml.rb +2 -1
- data/lib/teodoro/empresa.rb +39 -3
- data/lib/teodoro/leiaute/arquivo_s2200.rb +11 -4
- data/lib/teodoro/leiaute/arquivo_s2205.rb +12 -2
- data/lib/teodoro/leiaute/arquivo_s2300.rb +8 -1
- data/lib/teodoro/leiaute/arquivo_s3000.rb +5 -13
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbdbafcdea814fe8ee357a403df2abb2a6fa92196b7f75107e878f80492134c0
|
4
|
+
data.tar.gz: 9dd0c5a05c9b571b831a98cbc86814a172cae5fb0ae26742ea5683a7812e8a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 134d47b8565a584b86a5657cb4436020a230bf0d98544093b826680c01278f18512fff744bdb6d291b045939fbd7ead5b04aad5f77e2de1a1d40723983fdee01
|
7
|
+
data.tar.gz: fff0fd3c1e7623adf26608c59bf62bc110b6546a5fc3821a410663cfe11b4f995c5e2b95572248d4b2bc8156931d35ca9b8e9b5caafe1be2d3272e444fb4bc0d
|
data/lib/teodoro.rb
CHANGED
@@ -44,7 +44,7 @@ module Teodoro
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def origem
|
47
|
-
@origem ||= args[0]
|
47
|
+
@origem ||= args[0].tr('\\', '/')
|
48
48
|
end
|
49
49
|
|
50
50
|
def validar_que_diretorio_de_origem_nao_esta_vazio
|
@@ -56,7 +56,7 @@ module Teodoro
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def destino
|
59
|
-
@destino ||= args[1]
|
59
|
+
@destino ||= args[1].tr('\\', '/')
|
60
60
|
end
|
61
61
|
|
62
62
|
def erro(erro)
|
@@ -1,41 +1,21 @@
|
|
1
1
|
module Teodoro
|
2
2
|
module ArquivoDeEventoNaoPeriodico
|
3
|
-
include
|
3
|
+
include ArquivoDeEventoCriadorDeArquivoData
|
4
|
+
include ArquivoDeEventoRetificavel
|
4
5
|
|
5
6
|
def processar
|
6
|
-
|
7
|
-
|
7
|
+
deletar_arquivos_data_originais if retificacao?
|
8
|
+
registrar_arquivo_data
|
8
9
|
criar_arquivo_data
|
9
10
|
end
|
10
11
|
|
11
12
|
private
|
12
13
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
File.delete(caminho_do_arquivo_data_original)
|
19
|
-
end
|
20
|
-
|
21
|
-
def caminho_do_arquivo_data_original
|
22
|
-
criar_caminho_do_arquivo_data(nome_do_arquivo_original)
|
23
|
-
end
|
24
|
-
|
25
|
-
def nome_do_arquivo_original
|
26
|
-
de_recibo_para_nome_do_arquivo_data[numero_do_recibo_a_retificar]
|
27
|
-
end
|
28
|
-
|
29
|
-
def de_recibo_para_nome_do_arquivo_data
|
30
|
-
empresa.de_recibo_para_nome_do_arquivo_data
|
31
|
-
end
|
32
|
-
|
33
|
-
def numero_do_recibo_a_retificar
|
34
|
-
evento["#{noh_principal_do_evento}/ideEvento/nrRecibo"]
|
35
|
-
end
|
36
|
-
|
37
|
-
def registrar_recibo
|
38
|
-
de_recibo_para_nome_do_arquivo_data[numero_do_recibo] = nome_do_arquivo_data
|
14
|
+
def registrar_arquivo_data
|
15
|
+
arquivos_data.registrar(
|
16
|
+
nome: nome_do_arquivo_data,
|
17
|
+
recibo: numero_do_recibo
|
18
|
+
)
|
39
19
|
end
|
40
20
|
|
41
21
|
def caminho_do_arquivo_data
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Teodoro
|
2
|
+
module ArquivoDeEventoRetificavel
|
3
|
+
include ArquivoDeEvento
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
def retificacao?
|
8
|
+
@retificacao ||= evento["#{noh_principal_do_evento}/ideEvento/indRetif"] == '2'
|
9
|
+
end
|
10
|
+
|
11
|
+
def deletar_arquivos_data_originais
|
12
|
+
arquivos_data.excluir(numero_do_recibo_a_retificar)
|
13
|
+
end
|
14
|
+
|
15
|
+
def arquivos_data
|
16
|
+
empresa.arquivos_data
|
17
|
+
end
|
18
|
+
|
19
|
+
def numero_do_recibo_a_retificar
|
20
|
+
@numero_do_recibo_a_retificar ||= evento["#{noh_principal_do_evento}/ideEvento/nrRecibo"]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/teodoro/arquivo_xml.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'arquivo_de_evento'
|
2
2
|
require_relative 'arquivo_de_evento_processador_de_arquivo_data'
|
3
|
-
require_relative '
|
3
|
+
require_relative 'arquivo_de_evento_criador_de_arquivo_data'
|
4
|
+
require_relative 'arquivo_de_evento_retificavel'
|
4
5
|
require_relative 'arquivo_de_evento_de_tabela'
|
5
6
|
require_relative 'arquivo_de_evento_nao_periodico'
|
6
7
|
require_relative 'cnpj'
|
data/lib/teodoro/empresa.rb
CHANGED
@@ -83,7 +83,7 @@ module Teodoro
|
|
83
83
|
def empresa
|
84
84
|
@empresa ||= Obj.new(
|
85
85
|
destino_dos_arquivos_data: destino_dos_arquivos_data,
|
86
|
-
|
86
|
+
arquivos_data: ArquivosData.new(destino_dos_arquivos_data),
|
87
87
|
contratos_de_emprego: ContratosDeEmprego.new,
|
88
88
|
contratos_de_trabalho_sem_vinculo: ContratosDeTrabalhoSemVinculo.new
|
89
89
|
)
|
@@ -93,9 +93,37 @@ module Teodoro
|
|
93
93
|
Console.print
|
94
94
|
end
|
95
95
|
|
96
|
+
class ArquivosData
|
97
|
+
private
|
98
|
+
|
99
|
+
def initialize(destino_dos_arquivos_data)
|
100
|
+
@destino_dos_arquivos_data = destino_dos_arquivos_data
|
101
|
+
end
|
102
|
+
|
103
|
+
attr_reader :destino_dos_arquivos_data
|
104
|
+
|
105
|
+
public
|
106
|
+
|
107
|
+
def registrar(recibo:, nome:)
|
108
|
+
(nomes_por_recibo[recibo] ||= []) << nome
|
109
|
+
end
|
110
|
+
|
111
|
+
def excluir(recibo)
|
112
|
+
(nomes_por_recibo.delete(recibo) || [])
|
113
|
+
.map { |nome| File.join(destino_dos_arquivos_data, "#{nome}.data") }
|
114
|
+
.each { File.delete(_1) }
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
def nomes_por_recibo
|
120
|
+
@nomes_por_recibo ||= {}
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
96
124
|
class ContratosDeEmprego
|
97
|
-
def
|
98
|
-
contratos_por_matricula[matricula] = contrato
|
125
|
+
def <<(contrato)
|
126
|
+
contratos_por_matricula[contrato.matricula] = contrato
|
99
127
|
end
|
100
128
|
|
101
129
|
def [](matricula)
|
@@ -109,6 +137,10 @@ module Teodoro
|
|
109
137
|
.sort_by(&:data_de_admissao)
|
110
138
|
end
|
111
139
|
|
140
|
+
def remover(recibo)
|
141
|
+
contratos_por_matricula.delete_if { _2.recibo == recibo }
|
142
|
+
end
|
143
|
+
|
112
144
|
private
|
113
145
|
|
114
146
|
def contratos_por_matricula
|
@@ -140,6 +172,10 @@ module Teodoro
|
|
140
172
|
.sort_by(&:data_de_inicio)
|
141
173
|
end
|
142
174
|
|
175
|
+
def remover(recibo)
|
176
|
+
contratos.delete_if { _1.recibo == recibo }
|
177
|
+
end
|
178
|
+
|
143
179
|
private
|
144
180
|
|
145
181
|
def contratos
|
@@ -4,19 +4,26 @@ module Teodoro
|
|
4
4
|
include ArquivoDeEventoNaoPeriodico
|
5
5
|
|
6
6
|
def processar
|
7
|
+
remover_registro_do_contrato_de_emprego if retificacao?
|
8
|
+
|
7
9
|
super
|
8
10
|
|
9
|
-
|
11
|
+
registrar_contrato_de_emprego
|
10
12
|
end
|
11
13
|
|
12
14
|
private
|
13
15
|
|
14
|
-
def
|
15
|
-
contratos_de_emprego
|
16
|
+
def remover_registro_do_contrato_de_emprego
|
17
|
+
contratos_de_emprego.remover(numero_do_recibo_a_retificar)
|
18
|
+
end
|
19
|
+
|
20
|
+
def registrar_contrato_de_emprego
|
21
|
+
contratos_de_emprego << Obj.new(
|
16
22
|
matricula: matricula_do_trabalhador,
|
17
23
|
data_de_admissao: data_de_admissao,
|
18
24
|
categoria_do_trabalhador: categoria_do_trabalhador,
|
19
|
-
cpf_do_trabalhador: cpf_do_trabalhador
|
25
|
+
cpf_do_trabalhador: cpf_do_trabalhador,
|
26
|
+
recibo: numero_do_recibo
|
20
27
|
)
|
21
28
|
end
|
22
29
|
|
@@ -1,14 +1,24 @@
|
|
1
1
|
module Teodoro
|
2
2
|
module Leiaute
|
3
3
|
class ArquivoS2205
|
4
|
-
include
|
4
|
+
include ArquivoDeEventoProcessadorDeArquivoData
|
5
|
+
include ArquivoDeEventoRetificavel
|
5
6
|
|
6
7
|
def processar
|
7
|
-
|
8
|
+
deletar_arquivos_data_originais if retificacao?
|
9
|
+
processar_contratos_de_trabalho
|
8
10
|
end
|
9
11
|
|
10
12
|
private
|
11
13
|
|
14
|
+
def noh_principal_do_evento
|
15
|
+
'evtAltCadastral'
|
16
|
+
end
|
17
|
+
|
18
|
+
def processar_contratos_de_trabalho
|
19
|
+
contratos_de_trabalho.each(&:processar)
|
20
|
+
end
|
21
|
+
|
12
22
|
def contratos_de_trabalho
|
13
23
|
(contratos_de_emprego + contratos_de_trabalho_sem_vinculo)
|
14
24
|
.map { |classe, contrato| classe.new(empresa: empresa, arquivo_xml: arquivo_xml, contrato: contrato) }
|
@@ -4,6 +4,8 @@ module Teodoro
|
|
4
4
|
include ArquivoDeEventoNaoPeriodico
|
5
5
|
|
6
6
|
def processar
|
7
|
+
remover_registro_do_contrato_de_trabalhador_sem_vinculo if retificacao?
|
8
|
+
|
7
9
|
super
|
8
10
|
|
9
11
|
registrar_contrato_de_trabalhador_sem_vinculo
|
@@ -11,11 +13,16 @@ module Teodoro
|
|
11
13
|
|
12
14
|
private
|
13
15
|
|
16
|
+
def remover_registro_do_contrato_de_trabalhador_sem_vinculo
|
17
|
+
contratos_de_trabalho_sem_vinculo.remover(numero_do_recibo_a_retificar)
|
18
|
+
end
|
19
|
+
|
14
20
|
def registrar_contrato_de_trabalhador_sem_vinculo
|
15
21
|
contratos_de_trabalho_sem_vinculo << Obj.new(
|
16
22
|
cpf_do_trabalhador: cpf_do_trabalhador,
|
17
23
|
categoria_do_trabalhador: categoria_do_trabalhador,
|
18
|
-
data_de_inicio: data_de_inicio
|
24
|
+
data_de_inicio: data_de_inicio,
|
25
|
+
recibo: numero_do_recibo
|
19
26
|
)
|
20
27
|
end
|
21
28
|
|
@@ -4,7 +4,7 @@ module Teodoro
|
|
4
4
|
include ArquivoDeEventoProcessadorDeArquivoData
|
5
5
|
|
6
6
|
def processar
|
7
|
-
|
7
|
+
excluir_arquivos_data if tipo_de_evento_processavel?
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -17,20 +17,12 @@ module Teodoro
|
|
17
17
|
evento['evtExclusao/infoExclusao/tpEvento'].delete('-')
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
|
20
|
+
def excluir_arquivos_data
|
21
|
+
arquivos_data.excluir(numero_de_recibo_do_evento_a_excluir)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def nome_do_arquivo_data_original
|
29
|
-
de_recibo_para_nome_do_arquivo_data[numero_de_recibo_do_evento_a_excluir]
|
30
|
-
end
|
31
|
-
|
32
|
-
def de_recibo_para_nome_do_arquivo_data
|
33
|
-
empresa.de_recibo_para_nome_do_arquivo_data
|
24
|
+
def arquivos_data
|
25
|
+
empresa.arquivos_data
|
34
26
|
end
|
35
27
|
|
36
28
|
def numero_de_recibo_do_evento_a_excluir
|
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.0
|
4
|
+
version: 0.1.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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -174,10 +174,11 @@ files:
|
|
174
174
|
- bin/teodoro
|
175
175
|
- lib/teodoro.rb
|
176
176
|
- lib/teodoro/arquivo_de_evento.rb
|
177
|
+
- lib/teodoro/arquivo_de_evento_criador_de_arquivo_data.rb
|
177
178
|
- lib/teodoro/arquivo_de_evento_de_tabela.rb
|
178
|
-
- lib/teodoro/arquivo_de_evento_exceto_de_exclusao.rb
|
179
179
|
- lib/teodoro/arquivo_de_evento_nao_periodico.rb
|
180
180
|
- lib/teodoro/arquivo_de_evento_processador_de_arquivo_data.rb
|
181
|
+
- lib/teodoro/arquivo_de_evento_retificavel.rb
|
181
182
|
- lib/teodoro/arquivo_de_origem.rb
|
182
183
|
- lib/teodoro/arquivo_xml.rb
|
183
184
|
- lib/teodoro/cnpj.rb
|