teodoro 0.13.0 → 0.15.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.
@@ -98,7 +98,7 @@ module Teodoro
98
98
  ['ResideExterior'],
99
99
  ['SemNumeroLogradouroEnderecoEX'],
100
100
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_CasadoComBrasileiro', evento['trabalhador/trabEstrangeiro/casadoBr']],
101
- ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao', evento['trabalhador/trabEstrangeiro/classTrabEstrang']],
101
+ de_acordo_com_a_versao_do_leiaute['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao'],
102
102
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao_TEXT'],
103
103
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_DataChegada', evento['trabalhador/trabEstrangeiro/dtChegada'], :data],
104
104
  ['EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_FilhosBrasileiros', evento['trabalhador/trabEstrangeiro/filhosBr']],
@@ -175,9 +175,9 @@ module Teodoro
175
175
  ['EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_NumeroLogradouro', evento['trabalhador/endereco/brasil/nrLograd']],
176
176
  ['EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_TipoLogradouro', evento['trabalhador/endereco/brasil/tpLograd']],
177
177
  ['EventoAdmissao_InfoTrabalhador_InfoEndereco_EnderecoResidencialBR_Uf', evento['trabalhador/endereco/brasil/uf']],
178
- ['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoCargoFuncao_CodigoCargo', evento['infoTSVInicio/infoComplementares/cargoFuncao/codCargo']],
179
- ['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_OptanteFGTS', evento['infoTSVInicio/infoComplementares/fgts/opcFGTS']],
180
- ['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_DataOpcaoFGTS', evento['infoTSVInicio/infoComplementares/fgts/dtOpcFGTS'], :data],
178
+ de_acordo_com_a_versao_do_leiaute['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoCargoFuncao_CodigoCargo'],
179
+ de_acordo_com_a_versao_do_leiaute['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_OptanteFGTS'],
180
+ de_acordo_com_a_versao_do_leiaute['EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_DataOpcaoFGTS'],
181
181
  ['EventoAdmissao_InformacoesInicio_InformacoesComplementares_Remuneracao_UnidadeSalarioFixo', evento['infoTSVInicio/infoComplementares/remuneracao/undSalFixo']],
182
182
  ['EventoAdmissao_InformacoesInicio_InformacoesComplementares_Remuneracao_ValorSalarioFixo', evento['infoTSVInicio/infoComplementares/remuneracao/vrSalFx'], :decimal],
183
183
  ['EventoAdmissao_InformacoesInicio_NaturezaAtividade', evento['infoTSVInicio/natAtividade']]
@@ -186,6 +186,119 @@ module Teodoro
186
186
  )
187
187
  ]
188
188
  end
189
+
190
+ def de_acordo_com_a_versao_do_leiaute
191
+ @de_acordo_com_a_versao_do_leiaute ||=
192
+ if leiaute_simplificado?
193
+ LeiauteSimplificado.new(empresa: empresa, evento: evento)
194
+ else
195
+ Leiaute2.new(evento)
196
+ end
197
+ end
198
+
199
+ module Leiaute
200
+ private
201
+
202
+ attr_reader :evento
203
+
204
+ public
205
+
206
+ def [](chave)
207
+ indice[chave]
208
+ end
209
+
210
+ private
211
+
212
+ def indice
213
+ @indice ||= chaves_valores.map { [_1.first, _1] }.to_h
214
+ end
215
+ end
216
+
217
+ class Leiaute2
218
+ include Leiaute
219
+
220
+ private
221
+
222
+ def initialize(evento)
223
+ @evento = evento
224
+ end
225
+
226
+ def chaves_valores # rubocop:disable Metrics/MethodLength
227
+ [
228
+ [
229
+ 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao',
230
+ evento['trabalhador/trabEstrangeiro/classTrabEstrang']
231
+ ],
232
+ [
233
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_OptanteFGTS',
234
+ evento['infoTSVInicio/infoComplementares/fgts/opcFGTS']
235
+ ],
236
+ [
237
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_DataOpcaoFGTS',
238
+ evento['infoTSVInicio/infoComplementares/fgts/dtOpcFGTS'],
239
+ :data
240
+ ],
241
+ [
242
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoCargoFuncao_CodigoCargo',
243
+ evento['infoTSVInicio/infoComplementares/cargoFuncao/codCargo']
244
+ ]
245
+ ]
246
+ end
247
+ end
248
+
249
+ class LeiauteSimplificado
250
+ include Leiaute
251
+
252
+ private
253
+
254
+ def initialize(empresa:, evento:)
255
+ @empresa = empresa
256
+ @evento = evento
257
+ end
258
+
259
+ attr_reader :empresa
260
+
261
+ def chaves_valores # rubocop:disable Metrics/MethodLength
262
+ [
263
+ [
264
+ 'EventoAdmissao_InfoTrabalhador_TrabalhadorEstrangeiro_ClassificacaoCondicao',
265
+ {
266
+ '1' => 4,
267
+ '2' => 5,
268
+ '3' => 9,
269
+ '4' => 10,
270
+ '5' => 11,
271
+ '6' => 12,
272
+ '7' => evento['trabalhador/trabImig/tmpResid']
273
+ }[evento['trabalhador/trabImig/condIng']]
274
+ ],
275
+ [
276
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_OptanteFGTS',
277
+ (1 if evento['infoTSVInicio/infoComplementares/FGTS'])
278
+ ],
279
+ [
280
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoFgts_DataOpcaoFGTS',
281
+ evento['infoTSVInicio/infoComplementares/FGTS/dtOpcFGTS'],
282
+ :data
283
+ ],
284
+ [
285
+ 'EventoAdmissao_InformacoesInicio_InformacoesComplementares_InfoCargoFuncao_CodigoCargo',
286
+ codigo_do_cargo
287
+ ]
288
+ ]
289
+ end
290
+
291
+ def codigo_do_cargo
292
+ cargo&.codigo
293
+ end
294
+
295
+ def cargo
296
+ empresa.cargos_gerados[
297
+ nome: evento['infoTSVInicio/infoComplementares/cargoFuncao/nmCargo'],
298
+ cbo: evento['infoTSVInicio/infoComplementares/cargoFuncao/CBOCargo']
299
+ ]
300
+ end
301
+ end
189
302
  end
190
303
  end
191
304
  end
@@ -66,7 +66,7 @@ module Teodoro
66
66
  ['InfoVinculo_TipoRegimeTrabalhista'],
67
67
  ['InfoVinculo_TipoRegimePrevidenciario'],
68
68
  ['InfoVinculo_InfoContrato_CodigoCategoria'],
69
- ['InfoVinculo_InfoContrato_CodigoCargo', evento['infoTSVAlteracao/infoComplementares/cargoFuncao/codCargo']],
69
+ de_acordo_com_a_versao_do_leiaute['InfoVinculo_InfoContrato_CodigoCargo'],
70
70
  ['InfoVinculo_InfoContrato_CodigoFuncao', evento['infoTSVAlteracao/infoComplementares/cargoFuncao/codFuncao']],
71
71
  ['InfoVinculo_InfoContrato_CodigoCarreira'],
72
72
  ['InfoVinculo_InfoContrato_DataIngressoCarreira'],
@@ -179,6 +179,85 @@ module Teodoro
179
179
  def data_da_alteracao
180
180
  @data_da_alteracao ||= evento['infoTSVAlteracao/dtAlteracao']
181
181
  end
182
+
183
+ def de_acordo_com_a_versao_do_leiaute
184
+ @de_acordo_com_a_versao_do_leiaute ||=
185
+ if leiaute_simplificado?
186
+ LeiauteSimplificado.new(empresa: empresa, evento: evento)
187
+ else
188
+ Leiaute2.new(evento)
189
+ end
190
+ end
191
+
192
+ module Leiaute
193
+ private
194
+
195
+ attr_reader :evento
196
+
197
+ public
198
+
199
+ def [](chave)
200
+ indice[chave]
201
+ end
202
+
203
+ private
204
+
205
+ def indice
206
+ @indice ||= chaves_valores.map { [_1.first, _1] }.to_h
207
+ end
208
+ end
209
+
210
+ class Leiaute2
211
+ include Leiaute
212
+
213
+ private
214
+
215
+ def initialize(evento)
216
+ @evento = evento
217
+ end
218
+
219
+ def chaves_valores
220
+ [
221
+ [
222
+ 'InfoVinculo_InfoContrato_CodigoCargo',
223
+ evento['infoTSVAlteracao/infoComplementares/cargoFuncao/codCargo']
224
+ ]
225
+ ]
226
+ end
227
+ end
228
+
229
+ class LeiauteSimplificado
230
+ include Leiaute
231
+
232
+ private
233
+
234
+ def initialize(empresa:, evento:)
235
+ @empresa = empresa
236
+ @evento = evento
237
+ end
238
+
239
+ attr_reader :empresa
240
+
241
+ def chaves_valores
242
+ [
243
+ [
244
+ 'InfoVinculo_InfoContrato_CodigoCargo',
245
+ codigo_do_cargo
246
+ ]
247
+ ]
248
+ end
249
+
250
+ def codigo_do_cargo
251
+ cargo&.codigo
252
+ end
253
+
254
+ def cargo
255
+ empresa.cargos_gerados[
256
+ nome: evento['infoTSVAlteracao/infoComplementares/cargoFuncao/nmCargo'],
257
+ cbo: evento['infoTSVAlteracao/infoComplementares/cargoFuncao/CBOCargo']
258
+ ]
259
+ end
260
+ end
182
261
  end
183
262
  end
184
263
  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.13.0
4
+ version: 0.15.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-23 00:00:00.000000000 Z
11
+ date: 2021-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -188,6 +188,8 @@ files:
188
188
  - bin/teodoro
189
189
  - lib/teodoro.rb
190
190
  - lib/teodoro/arquivo_data.rb
191
+ - lib/teodoro/arquivo_data/car.rb
192
+ - lib/teodoro/arquivo_data/tra_epg_avi.rb
191
193
  - lib/teodoro/arquivo_de_evento.rb
192
194
  - lib/teodoro/arquivo_de_evento_de_tabela.rb
193
195
  - lib/teodoro/arquivo_de_evento_nao_periodico.rb
@@ -196,7 +198,10 @@ files:
196
198
  - lib/teodoro/cnpj.rb
197
199
  - lib/teodoro/console.rb
198
200
  - lib/teodoro/empresa.rb
199
- - lib/teodoro/leiaute.rb
201
+ - lib/teodoro/empresa/arquivos_data.rb
202
+ - lib/teodoro/empresa/cargos_gerados.rb
203
+ - lib/teodoro/empresa/contratos_de_emprego.rb
204
+ - lib/teodoro/empresa/contratos_de_trabalho_sem_vinculo.rb
200
205
  - lib/teodoro/leiaute/arquivo_s1000.rb
201
206
  - lib/teodoro/leiaute/arquivo_s1005.rb
202
207
  - lib/teodoro/leiaute/arquivo_s1010.rb
@@ -1,24 +0,0 @@
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