teodoro 0.0.11 → 0.2.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/teodoro.rb +10 -5
  3. data/lib/teodoro/arquivo_de_evento.rb +15 -15
  4. data/lib/teodoro/{arquivo_de_evento_exceto_de_exclusao.rb → arquivo_de_evento_criador_de_arquivo_data.rb} +2 -6
  5. data/lib/teodoro/arquivo_de_evento_de_tabela.rb +2 -2
  6. data/lib/teodoro/arquivo_de_evento_nao_periodico.rb +9 -33
  7. data/lib/teodoro/arquivo_de_evento_processador_de_arquivo_data.rb +30 -0
  8. data/lib/teodoro/arquivo_de_evento_retificavel.rb +23 -0
  9. data/lib/teodoro/arquivo_xml.rb +34 -22
  10. data/lib/teodoro/empresa.rb +77 -9
  11. data/lib/teodoro/leiaute.rb +24 -0
  12. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1000.rb +7 -9
  13. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1005.rb +4 -4
  14. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1010.rb +2 -4
  15. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1020.rb +4 -4
  16. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1030.rb +4 -4
  17. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1040.rb +2 -4
  18. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1050.rb +4 -4
  19. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s1070.rb +2 -4
  20. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2190.rb +2 -2
  21. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2200.rb +121 -22
  22. data/lib/teodoro/leiaute/arquivo_s2205.rb +264 -0
  23. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2206.rb +18 -7
  24. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2230.rb +56 -12
  25. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2250.rb +24 -8
  26. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2299.rb +23 -20
  27. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2300.rb +17 -9
  28. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2306.rb +27 -7
  29. data/lib/teodoro/{leiaute_2 → leiaute}/arquivo_s2399.rb +11 -8
  30. data/lib/teodoro/leiaute/arquivo_s3000.rb +33 -0
  31. metadata +25 -23
  32. data/lib/teodoro/leiaute_2.rb +0 -24
  33. data/lib/teodoro/leiaute_2/arquivo_s2205.rb +0 -157
  34. data/lib/teodoro/leiaute_2/arquivo_s3000.rb +0 -41
@@ -0,0 +1,24 @@
1
+ require_relative 'leiaute/arquivo_s1000'
2
+ require_relative 'leiaute/arquivo_s1005'
3
+ require_relative 'leiaute/arquivo_s1010'
4
+ require_relative 'leiaute/arquivo_s1020'
5
+ require_relative 'leiaute/arquivo_s1030'
6
+ require_relative 'leiaute/arquivo_s1040'
7
+ require_relative 'leiaute/arquivo_s1050'
8
+ require_relative 'leiaute/arquivo_s1070'
9
+ require_relative 'leiaute/arquivo_s2190'
10
+ require_relative 'leiaute/arquivo_s2200'
11
+ require_relative 'leiaute/arquivo_s2205'
12
+ require_relative 'leiaute/arquivo_s2206'
13
+ require_relative 'leiaute/arquivo_s2230'
14
+ require_relative 'leiaute/arquivo_s2250'
15
+ require_relative 'leiaute/arquivo_s2299'
16
+ require_relative 'leiaute/arquivo_s2300'
17
+ require_relative 'leiaute/arquivo_s2306'
18
+ require_relative 'leiaute/arquivo_s2399'
19
+ require_relative 'leiaute/arquivo_s3000'
20
+
21
+ module Teodoro
22
+ module Leiaute
23
+ end
24
+ end
@@ -1,7 +1,6 @@
1
1
  module Teodoro
2
- module Leiaute_2
3
- # rubocop:disable Metrics/ClassLength
4
- class ArquivoS1000
2
+ module Leiaute
3
+ class ArquivoS1000 # rubocop:disable Metrics/ClassLength
5
4
  include ArquivoDeEventoDeTabela
6
5
 
7
6
  private
@@ -64,9 +63,9 @@ module Teodoro
64
63
  'idePeriodo'
65
64
  end
66
65
 
67
- # rubocop:disable Layout/LineLength, Metrics/MethodLength, Metrics/AbcSize
68
- def itens_do_conteudo_do_arquivo_data
66
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
69
67
  [
68
+ # rubocop:disable Layout/LineLength
70
69
  ['TipoInscricaoEmpregador', tipo_de_inscricao],
71
70
  ['FapBdContrib'],
72
71
  ['AlteracaoEmPeriodoExistente'],
@@ -84,8 +83,8 @@ module Teodoro
84
83
  ['ExibeModoCompleto'],
85
84
  ['InicioValidade', inicio_da_validade],
86
85
  ['FimValidade', fim_da_validade],
87
- ['NovaValidade_InicioValidade'], # FIXME: Tales
88
- ['NovaValidade_FimValidade'], # FIXME: Tales
86
+ ['NovaValidade_InicioValidade'],
87
+ ['NovaValidade_FimValidade'],
89
88
  ['NomeRazaoSocial', evento['evtInfoEmpregador/infoEmpregador/*/infoCadastro/nmRazao']],
90
89
  ['ClassificacaoTributaria', evento['evtInfoEmpregador/infoEmpregador/*/infoCadastro/classTrib']],
91
90
  ['NaturezaJuridica', evento['evtInfoEmpregador/infoEmpregador/*/infoCadastro/natJurid']],
@@ -150,14 +149,13 @@ module Teodoro
150
149
  ["ListaSoftHouses_#{seq}_Email", software_house['email']]
151
150
  ]
152
151
  end.sum([])
152
+ # rubocop:enable Layout/LineLength
153
153
  ]
154
154
  end
155
- # rubocop:enable Layout/LineLength, Metrics/MethodLength, Metrics/AbcSize
156
155
 
157
156
  def softwares_house
158
157
  evento.*('evtInfoEmpregador/infoEmpregador/*/infoCadastro/softwareHouse')
159
158
  end
160
159
  end
161
- # rubocop:enable Metrics/ClassLength
162
160
  end
163
161
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1005
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -25,9 +25,9 @@ module Teodoro
25
25
  'ideEstab'
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength
29
- def itens_do_conteudo_do_arquivo_data
28
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
29
  [
30
+ # rubocop:disable Layout/LineLength
31
31
  ['RequestVerificationToken'],
32
32
  ['SomenteVisualizacao'],
33
33
  ['BloquearCodigo'],
@@ -75,9 +75,9 @@ module Teodoro
75
75
  ['VerProc', versao_do_aplicativo_de_processamento_do_evento],
76
76
  ['idEdicaoSH'],
77
77
  ['ExibirContribuicaoPatronal']
78
+ # rubocop:enable Layout/LineLength
78
79
  ]
79
80
  end
80
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Layout/LineLength
81
81
  end
82
82
  end
83
83
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1010
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -29,8 +29,7 @@ module Teodoro
29
29
  @codigo ||= evento['evtTabRubrica/infoRubrica/*/ideRubrica/codRubr']
30
30
  end
31
31
 
32
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
33
- def itens_do_conteudo_do_arquivo_data
32
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
34
33
  [
35
34
  ['RequestVerificationToken'],
36
35
  ['SomenteVisualizacao'],
@@ -59,7 +58,6 @@ module Teodoro
59
58
  ['hd_ProcessoSindicato']
60
59
  ]
61
60
  end
62
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
63
61
  end
64
62
  end
65
63
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1020
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -25,9 +25,9 @@ module Teodoro
25
25
  @codigo_da_lotacao_tributaria ||= evento['evtTabLotacao/infoLotacao/*/ideLotacao/codLotacao']
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
29
- def itens_do_conteudo_do_arquivo_data
28
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
29
  [
30
+ # rubocop:disable Layout/LineLength
31
31
  ['RequestVerificationToken'],
32
32
  ['SomenteVisualizacao'],
33
33
  ['BloquearCodigo'],
@@ -60,9 +60,9 @@ module Teodoro
60
60
  ['VerProc', versao_do_aplicativo_de_processamento_do_evento],
61
61
  ['idEdicaoProcesso'],
62
62
  ['ExibirContribuicaoPatronal']
63
+ # rubocop:enable Layout/LineLength
63
64
  ]
64
65
  end
65
- # rubocop:enable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
66
66
  end
67
67
  end
68
68
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1030
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -25,9 +25,9 @@ module Teodoro
25
25
  @codigo_do_cargo ||= evento['evtTabCargo/infoCargo/*/ideCargo/codCargo']
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
29
- def itens_do_conteudo_do_arquivo_data
28
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
29
  [
30
+ # rubocop:disable Layout/LineLength
31
31
  ['RequestVerificationToken'],
32
32
  ['SomenteVisualizacao'],
33
33
  ['BloquearCodigo'],
@@ -51,9 +51,9 @@ module Teodoro
51
51
  ['NrReciboEventoOriginal'],
52
52
  ['DescricaoProcEmi'],
53
53
  ['VerProc', versao_do_aplicativo_de_processamento_do_evento]
54
+ # rubocop:enable Layout/LineLength
54
55
  ]
55
56
  end
56
- # rubocop:enable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
57
57
  end
58
58
  end
59
59
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1040
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -23,8 +23,7 @@ module Teodoro
23
23
  @codigo_da_funcao ||= evento['evtTabFuncao/infoFuncao/*/ideFuncao/codFuncao']
24
24
  end
25
25
 
26
- # rubocop:disable Metrics/MethodLength
27
- def itens_do_conteudo_do_arquivo_data
26
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength
28
27
  [
29
28
  ['RequestVerificationToken'],
30
29
  ['SomenteVisualizacao'],
@@ -43,7 +42,6 @@ module Teodoro
43
42
  ['VerProc', versao_do_aplicativo_de_processamento_do_evento]
44
43
  ]
45
44
  end
46
- # rubocop:enable Metrics/MethodLength
47
45
  end
48
46
  end
49
47
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1050
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -25,9 +25,9 @@ module Teodoro
25
25
  @codigo_do_horario ||= evento['evtTabHorTur/infoHorContratual/*/ideHorContratual/codHorContrat']
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
29
- def itens_do_conteudo_do_arquivo_data
28
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
29
  [
30
+ # rubocop:disable Layout/LineLength
31
31
  ['RequestVerificationToken'],
32
32
  ['SomenteVisualizacao'],
33
33
  ['BloquearCodigo'],
@@ -60,9 +60,9 @@ module Teodoro
60
60
  ["DadosHorario_ListaHorarioIntervalo_#{seq}_DuracaoIntervalo", intervalo['durInterv']]
61
61
  ]
62
62
  end.sum([])
63
+ # rubocop:enable Layout/LineLength
63
64
  ]
64
65
  end
65
- # rubocop:enable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
66
66
  end
67
67
  end
68
68
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS1070
4
4
  include ArquivoDeEventoDeTabela
5
5
 
@@ -25,8 +25,7 @@ module Teodoro
25
25
  @numero_do_processo ||= evento['evtTabProcesso/infoProcesso/*/ideProcesso/nrProc']
26
26
  end
27
27
 
28
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
29
- def itens_do_conteudo_do_arquivo_data
28
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
29
  [
31
30
  ['RequestVerificationToken'],
32
31
  ['SomenteVisualizacao'],
@@ -69,7 +68,6 @@ module Teodoro
69
68
  end.sum([])
70
69
  ]
71
70
  end
72
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
73
71
  end
74
72
  end
75
73
  end
@@ -1,5 +1,5 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS2190
4
4
  include ArquivoDeEventoNaoPeriodico
5
5
 
@@ -8,7 +8,7 @@ module Teodoro
8
8
  end
9
9
 
10
10
  def nome_do_arquivo_data
11
- "PRE[#{cpf_do_trabalhador}]"
11
+ @nome_do_arquivo_data ||= "PRE[#{cpf_do_trabalhador}]"
12
12
  end
13
13
 
14
14
  def cpf_do_trabalhador
@@ -1,25 +1,34 @@
1
1
  module Teodoro
2
- module Leiaute_2
2
+ module Leiaute
3
3
  class ArquivoS2200 # rubocop:disable Metrics/ClassLength
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
- registrar_admissao
11
+ registrar_contrato_de_emprego
10
12
  end
11
13
 
12
14
  private
13
15
 
14
- def registrar_admissao
15
- admissoes_por_matricula[matricula_do_trabalhador] = Obj.new(
16
- data: data_de_admissao,
17
- categoria_do_trabalhador: categoria_do_trabalhador
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(
22
+ matricula: matricula_do_trabalhador,
23
+ data_de_admissao: data_de_admissao,
24
+ categoria_do_trabalhador: categoria_do_trabalhador,
25
+ cpf_do_trabalhador: cpf_do_trabalhador,
26
+ recibo: numero_do_recibo
18
27
  )
19
28
  end
20
29
 
21
- def admissoes_por_matricula
22
- empresa.admissoes_por_matricula
30
+ def contratos_de_emprego
31
+ empresa.contratos_de_emprego
23
32
  end
24
33
 
25
34
  def data_de_admissao
@@ -47,9 +56,9 @@ module Teodoro
47
56
  @matricula_do_trabalhador ||= evento['evtAdmissao/vinculo/matricula']
48
57
  end
49
58
 
50
- # rubocop:disable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
51
- def itens_do_conteudo_do_arquivo_data
59
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
52
60
  [
61
+ # rubocop:disable Layout/LineLength
53
62
  ['ESX_CPF', cpf_do_trabalhador],
54
63
  ['ESX_MATRICULA', matricula_do_trabalhador],
55
64
  ['ESX_CATEGORIA', categoria_do_trabalhador],
@@ -158,7 +167,7 @@ module Teodoro
158
167
  ['EventoAdmissao_EnderecoResidencialEX_PaisResidencia_TEXT'],
159
168
  ['SemNumeroLogradouroEnderecoEX'],
160
169
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_CasadoComBrasileiro', evento['evtAdmissao/trabalhador/trabEstrangeiro/casadoBr']],
161
- ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao', evento['evtAdmissao/trabalhador/trabEstrangeiro/classTrabEstrang']],
170
+ item_do_conteudo_do_arquivo_data('EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao'),
162
171
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao_TEXT'],
163
172
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_DataChegada', evento['evtAdmissao/trabalhador/trabEstrangeiro/dtChegada']],
164
173
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_FilhosBrasileiros', evento['evtAdmissao/trabalhador/trabEstrangeiro/filhosBr']],
@@ -251,19 +260,19 @@ module Teodoro
251
260
  ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_DescricaoComplementar', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabGeral/descComp']],
252
261
  ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_NumeroInscricao', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabGeral/nrInsc']],
253
262
  ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoGeral_TipoInscricao', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabGeral/tpInsc']],
254
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Uf', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/uf']],
255
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_TipoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/tpLograd']],
263
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Uf'),
264
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_TipoLogradouro'),
256
265
  ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_TipoLogradouro_TEXT'],
257
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_NumeroLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/nrLograd']],
258
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_DescricaoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/dscLograd']],
259
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Complemento', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/complemento']],
260
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_CodigoMunicipio', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/codMunic']],
261
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Cep', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/cep']],
262
- ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Bairro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/bairro']],
266
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_NumeroLogradouro'),
267
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_DescricaoLogradouro'),
268
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Complemento'),
269
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_CodigoMunicipio'),
270
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Cep'),
271
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Bairro'),
263
272
  ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_NumeroInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/nrInsc']],
264
273
  ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_TipoInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/tpInsc']],
265
- ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_NumeroInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/ideEstabVinc/nrInsc']],
266
- ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_TipoInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/ideEstabVinc/tpInsc']],
274
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_NumeroInscricao'),
275
+ item_do_conteudo_do_arquivo_data('InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_TipoInscricao'),
267
276
  ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_HipoteseLegal', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/hipLeg']],
268
277
  ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_JustificaHipoteseLegal', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/justContr']],
269
278
  ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_TipoInclusaoContrato', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/tpInclContr']],
@@ -309,9 +318,99 @@ module Teodoro
309
318
  ["InfoVinculo_InfoContrato_FiliacaoSindical_#{seq}_CnpjSindicatoTrabalhador", filiacao['cnpjSindTrab']]
310
319
  ]
311
320
  end.sum([])
321
+ # rubocop:enable Layout/LineLength
312
322
  ]
313
323
  end
314
- # rubocop:enable Metrics/MethodLength, Layout/LineLength, Metrics/AbcSize
324
+
325
+ def item_do_conteudo_do_arquivo_data(chave)
326
+ chaves_valores_de_acordo_com_a_versao_do_leiaute[chave]
327
+ end
328
+
329
+ def chaves_valores_de_acordo_com_a_versao_do_leiaute
330
+ @chaves_valores_de_acordo_com_a_versao_do_leiaute ||=
331
+ (leiaute_simplificado? ? ChavesValoresDoLeiauteSimplificado : ChavesValoresDoLeiaute2).new(evento)
332
+ end
333
+
334
+ module ChavesValores
335
+ private
336
+
337
+ def initialize(evento)
338
+ @evento = evento
339
+ end
340
+
341
+ attr_reader :evento
342
+
343
+ public
344
+
345
+ def [](chave)
346
+ de_chave_para_chave_valor[chave]
347
+ end
348
+
349
+ private
350
+
351
+ def de_chave_para_chave_valor
352
+ @de_chave_para_chave_valor ||=
353
+ itens_do_conteudo_do_arquivo_data.map { |chave, valor| [chave, [chave, valor]] }.to_h
354
+ end
355
+ end
356
+
357
+ class ChavesValoresDoLeiaute2
358
+ include ChavesValores
359
+
360
+ private
361
+
362
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
363
+ [
364
+ # rubocop:disable Layout/LineLength
365
+ ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao', evento['evtAdmissao/trabalhador/trabEstrangeiro/classTrabEstrang']],
366
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Uf', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/uf']],
367
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_TipoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/tpLograd']],
368
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_NumeroLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/nrLograd']],
369
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_DescricaoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/dscLograd']],
370
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Complemento', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/complemento']],
371
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_CodigoMunicipio', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/codMunic']],
372
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Cep', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/cep']],
373
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Bairro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTrabDom/bairro']],
374
+ ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_NumeroInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/ideEstabVinc/nrInsc']],
375
+ ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_TipoInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideTomadorServ/ideEstabVinc/tpInsc']]
376
+ # rubocop:enable Layout/LineLength
377
+ ]
378
+ end
379
+ end
380
+
381
+ class ChavesValoresDoLeiauteSimplificado
382
+ include ChavesValores
383
+
384
+ private
385
+
386
+ def itens_do_conteudo_do_arquivo_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
387
+ [
388
+ # rubocop:disable Layout/LineLength
389
+ ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao', condicao_de_ingresso_do_trabalhador_imigrante],
390
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Uf', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/uf']],
391
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_TipoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/tpLograd']],
392
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_NumeroLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/nrLograd']],
393
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_DescricaoLogradouro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/dscLograd']],
394
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Complemento', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/complemento']],
395
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_CodigoMunicipio', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/codMunic']],
396
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Cep', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/cep']],
397
+ ['InfoVinculo_InfoContrato_LocalTrabalho_LocalTrabalhoDomestico_Bairro', evento['evtAdmissao/vinculo/infoContrato/localTrabalho/localTempDom/bairro']],
398
+ ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_NumeroInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideEstabVinc/nrInsc']],
399
+ ['InfoVinculo_InformacoesRegimeTrabalhista_InformacoesTrabalhadorCeletista_TrabalhoTemporario_EmpresaContratante_EstabelecimentoVinculadoTemporario_TipoInscricao', evento['evtAdmissao/vinculo/infoRegimeTrab/infoCeletista/trabTemporario/ideEstabVinc/tpInsc']]
400
+ # rubocop:enable Layout/LineLength
401
+ ]
402
+ end
403
+
404
+ def condicao_de_ingresso_do_trabalhador_imigrante
405
+ {
406
+ '1' => 4,
407
+ '2' => 5,
408
+ '4' => 10,
409
+ '5' => 11,
410
+ '6' => 12
411
+ }[evento['evtAdmissao/trabalhador/trabImig/condIng']] || evento['evtAdmissao/trabalhador/trabImig/tmpResid']
412
+ end
413
+ end
315
414
  end
316
415
  end
317
416
  end