teodoro 0.1.0 → 0.5.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 +10 -4
- data/lib/teodoro/arquivo_de_evento.rb +0 -4
- data/lib/teodoro/arquivo_de_evento_criador_de_arquivo_data.rb +32 -1
- data/lib/teodoro/arquivo_de_evento_processador_de_arquivo_data.rb +2 -2
- data/lib/teodoro/arquivo_xml.rb +1 -1
- data/lib/teodoro/empresa.rb +84 -17
- data/lib/teodoro/leiaute/arquivo_s1000.rb +20 -40
- data/lib/teodoro/leiaute/arquivo_s1005.rb +6 -20
- data/lib/teodoro/leiaute/arquivo_s1010.rb +2 -2
- data/lib/teodoro/leiaute/arquivo_s1020.rb +7 -22
- data/lib/teodoro/leiaute/arquivo_s1030.rb +7 -16
- data/lib/teodoro/leiaute/arquivo_s1040.rb +2 -2
- data/lib/teodoro/leiaute/arquivo_s1050.rb +5 -8
- data/lib/teodoro/leiaute/arquivo_s1070.rb +3 -3
- data/lib/teodoro/leiaute/arquivo_s2190.rb +2 -2
- data/lib/teodoro/leiaute/arquivo_s2200.rb +76 -259
- data/lib/teodoro/leiaute/arquivo_s2205.rb +16 -42
- data/lib/teodoro/leiaute/arquivo_s2206.rb +20 -108
- data/lib/teodoro/leiaute/arquivo_s2230.rb +97 -90
- data/lib/teodoro/leiaute/arquivo_s2250.rb +4 -4
- data/lib/teodoro/leiaute/arquivo_s2299.rb +25 -122
- data/lib/teodoro/leiaute/arquivo_s2300.rb +62 -38
- data/lib/teodoro/leiaute/arquivo_s2306.rb +8 -8
- data/lib/teodoro/leiaute/arquivo_s2399.rb +25 -17
- data/lib/teodoro/leiaute/arquivo_s3000.rb +28 -2
- data/lib/teodoro/xml.rb +6 -0
- metadata +16 -2
@@ -19,11 +19,11 @@ module Teodoro
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def cpf_do_trabalhador
|
22
|
-
evento['evtTSVAltContr/ideTrabSemVinculo/cpfTrab']
|
22
|
+
@cpf_do_trabalhador ||= evento['evtTSVAltContr/ideTrabSemVinculo/cpfTrab']
|
23
23
|
end
|
24
24
|
|
25
25
|
def categoria_do_trabalhador
|
26
|
-
evento['evtTSVAltContr/ideTrabSemVinculo/codCateg']
|
26
|
+
@categoria_do_trabalhador ||= evento['evtTSVAltContr/ideTrabSemVinculo/codCateg']
|
27
27
|
end
|
28
28
|
|
29
29
|
def data_de_inicio
|
@@ -43,18 +43,18 @@ module Teodoro
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def data_da_alteracao
|
46
|
-
evento['evtTSVAltContr/infoTSVAlteracao/dtAlteracao']
|
46
|
+
@data_da_alteracao ||= evento['evtTSVAltContr/infoTSVAlteracao/dtAlteracao']
|
47
47
|
end
|
48
48
|
|
49
49
|
def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
50
50
|
[
|
51
51
|
# rubocop:disable Layout/LineLength
|
52
|
-
['ESX_CPF',
|
52
|
+
['ESX_CPF', cpf_do_trabalhador],
|
53
53
|
['ESX_MATRICULA'],
|
54
|
-
['ESX_CATEGORIA',
|
54
|
+
['ESX_CATEGORIA', categoria_do_trabalhador],
|
55
55
|
%w[ESX_SEMVINCULO 1],
|
56
|
-
['ESX_DATAADMISSAO', data_de_inicio],
|
57
|
-
['ESX_DATAALTERACAO',
|
56
|
+
['ESX_DATAADMISSAO', [data_de_inicio, :data]],
|
57
|
+
['ESX_DATAALTERACAO', [data_da_alteracao, :data]],
|
58
58
|
['cpfTrabalhador'],
|
59
59
|
['nomeTrabalhador'],
|
60
60
|
['TipoInscricaoEmpregador', recibo['retornoEvento/ideEmpregador/tpInsc']],
|
@@ -156,7 +156,7 @@ module Teodoro
|
|
156
156
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoTrabalhadorCedido_TipoRegimePrevidenciario'],
|
157
157
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoTrabalhadorCedido_TipoRegimeTrabalhista'],
|
158
158
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_AreaAtuacao', evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/areaAtuacao']],
|
159
|
-
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_DtPrevistaTermino', evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/dtPrevTerm']],
|
159
|
+
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_DtPrevistaTermino', [evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/dtPrevTerm'], :data]],
|
160
160
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_InfoAgenteIntegracao_Bairro', evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/ageIntegracao/bairro']],
|
161
161
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_InfoAgenteIntegracao_Cep', evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/ageIntegracao/cep']],
|
162
162
|
['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoEstagiario_InfoAgenteIntegracao_Cnpj', evento['evtTSVAltContr/infoTSVAlteracao/infoComplementares/infoEstagiario/ageIntegracao/cnpjAgntInteg']],
|
@@ -3,10 +3,34 @@ module Teodoro
|
|
3
3
|
class ArquivoS2399 # rubocop:disable Metrics/ClassLength
|
4
4
|
include ArquivoDeEventoNaoPeriodico
|
5
5
|
|
6
|
-
|
6
|
+
def processar
|
7
|
+
super
|
8
|
+
|
9
|
+
registrar_termino_do_contrato
|
10
|
+
end
|
7
11
|
|
8
12
|
private
|
9
13
|
|
14
|
+
def registrar_termino_do_contrato
|
15
|
+
contrato_de_trabalho.data_do_termino = data_do_termino
|
16
|
+
end
|
17
|
+
|
18
|
+
def contrato_de_trabalho
|
19
|
+
contratos_de_trabalho_sem_vinculo[
|
20
|
+
cpf_do_trabalhador: cpf_do_trabalhador,
|
21
|
+
categoria_do_trabalhador: categoria_do_trabalhador,
|
22
|
+
data: data_do_termino
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def contratos_de_trabalho_sem_vinculo
|
27
|
+
empresa.contratos_de_trabalho_sem_vinculo
|
28
|
+
end
|
29
|
+
|
30
|
+
def data_do_termino
|
31
|
+
@data_do_termino ||= evento['evtTSVTermino/infoTSVTermino/dtTerm']
|
32
|
+
end
|
33
|
+
|
10
34
|
def noh_principal_do_evento
|
11
35
|
'evtTSVTermino'
|
12
36
|
end
|
@@ -28,22 +52,6 @@ module Teodoro
|
|
28
52
|
contrato_de_trabalho.data_de_inicio
|
29
53
|
end
|
30
54
|
|
31
|
-
def contrato_de_trabalho
|
32
|
-
contratos_de_trabalho_sem_vinculo[
|
33
|
-
cpf_do_trabalhador: cpf_do_trabalhador,
|
34
|
-
categoria_do_trabalhador: categoria_do_trabalhador,
|
35
|
-
data: data_do_termino
|
36
|
-
]
|
37
|
-
end
|
38
|
-
|
39
|
-
def contratos_de_trabalho_sem_vinculo
|
40
|
-
empresa.contratos_de_trabalho_sem_vinculo
|
41
|
-
end
|
42
|
-
|
43
|
-
def data_do_termino
|
44
|
-
@data_do_termino ||= evento['evtTSVTermino/infoTSVTermino/dtTerm']
|
45
|
-
end
|
46
|
-
|
47
55
|
def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength
|
48
56
|
[
|
49
57
|
# rubocop:disable Layout/LineLength
|
@@ -5,6 +5,8 @@ module Teodoro
|
|
5
5
|
|
6
6
|
def processar
|
7
7
|
excluir_arquivos_data if tipo_de_evento_processavel?
|
8
|
+
excluir_admissao if exclusao_de_admissao?
|
9
|
+
excluir_inicio_de_tsv if exclusao_de_inicio_de_tsv?
|
8
10
|
end
|
9
11
|
|
10
12
|
private
|
@@ -14,7 +16,7 @@ module Teodoro
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def tipo_de_evento
|
17
|
-
evento['evtExclusao/infoExclusao/tpEvento'].delete('-')
|
19
|
+
@tipo_de_evento ||= evento['evtExclusao/infoExclusao/tpEvento'].delete('-')
|
18
20
|
end
|
19
21
|
|
20
22
|
def excluir_arquivos_data
|
@@ -26,7 +28,31 @@ module Teodoro
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def numero_de_recibo_do_evento_a_excluir
|
29
|
-
evento['evtExclusao/infoExclusao/nrRecEvt']
|
31
|
+
@numero_de_recibo_do_evento_a_excluir ||= evento['evtExclusao/infoExclusao/nrRecEvt']
|
32
|
+
end
|
33
|
+
|
34
|
+
def exclusao_de_admissao?
|
35
|
+
tipo_de_evento == 'S2200'
|
36
|
+
end
|
37
|
+
|
38
|
+
def excluir_admissao
|
39
|
+
contratos_de_emprego.remover(numero_de_recibo_do_evento_a_excluir)
|
40
|
+
end
|
41
|
+
|
42
|
+
def contratos_de_emprego
|
43
|
+
empresa.contratos_de_emprego
|
44
|
+
end
|
45
|
+
|
46
|
+
def exclusao_de_inicio_de_tsv?
|
47
|
+
tipo_de_evento == 'S2300'
|
48
|
+
end
|
49
|
+
|
50
|
+
def excluir_inicio_de_tsv
|
51
|
+
contratos_de_trabalho_sem_vinculo.remover(numero_de_recibo_do_evento_a_excluir)
|
52
|
+
end
|
53
|
+
|
54
|
+
def contratos_de_trabalho_sem_vinculo
|
55
|
+
empresa.contratos_de_trabalho_sem_vinculo
|
30
56
|
end
|
31
57
|
end
|
32
58
|
end
|
data/lib/teodoro/xml.rb
CHANGED
@@ -10,6 +10,8 @@ module Teodoro
|
|
10
10
|
|
11
11
|
public
|
12
12
|
|
13
|
+
extend Forwardable
|
14
|
+
|
13
15
|
def [](*path)
|
14
16
|
node_set = xml.css("*/#{path.join('/')}")
|
15
17
|
|
@@ -27,5 +29,9 @@ module Teodoro
|
|
27
29
|
def *(path) # rubocop:disable Naming/BinaryOperatorParameterName
|
28
30
|
xml.css("*/#{path}").map { |node| self.class.new(Nokogiri::XML(node.to_s)) }
|
29
31
|
end
|
32
|
+
|
33
|
+
def css(path)
|
34
|
+
xml.css(path)
|
35
|
+
end
|
30
36
|
end
|
31
37
|
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.
|
4
|
+
version: 0.5.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rainbow
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rubyzip
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|