teodoro 0.15.1 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ddbdacc1dbd483710560887957da7f6c00f35e61947eb681fbb570b67dc5912
4
- data.tar.gz: f06f09ba02f715ad8e78d04448359c1c9febdf5fe88a47b29ba982a37dccb1b6
3
+ metadata.gz: f341fed6ea7a5070e4abf7e28517c4bdc380d4b416911df29be0aeaa10dd63ec
4
+ data.tar.gz: bb82b0556bc58101136ae7c92351ab273a5a80ea5122fa44e314ad68678709ff
5
5
  SHA512:
6
- metadata.gz: e211db70d66a127299a10b32ae1f9cfb15c9184a782019f4daa8706cecaeafa9a18faa78d8b2d81fdd08ed7fcfd07667f5da317e324ebf3085e7c1e1c1c8ea27
7
- data.tar.gz: b5d0d8790fa395b92f02cc42e89184221517344017dbc9e64d0a053d5d2696a08c467048bab91d3d5728ab1e44cf4effeb037fbc1544743b25399ff948c39fbf
6
+ metadata.gz: be0f3f4feae90ee3b59ca1053971572dfbcc848855d99457169b77e2017d5b1216cecbe7f38d84a448586e1b81899d29f520181eaf493ffd0a019c03e102d7c4
7
+ data.tar.gz: daec189dc224a65acd9e8969eef7939269832429b0c9252e1f08518d502c1ababc81cbb10fda22753c42f108cadf14fd2638b57f4dd43f86b3a902b2198c9b5c
@@ -21,8 +21,6 @@ module Teodoro
21
21
  raise caminho if File.exist?(caminho)
22
22
 
23
23
  File.open(caminho, 'w') { |f| f.puts(itens_do_conteudo.map { "#{_1}=#{Valor.new(_2, formato: _3)}" }) }
24
- # FIXME: Tales
25
- # File.write(caminho, (itens_do_conteudo.map { "#{_1}=#{Valor.new(_2, formato: _3)}" } + ['']).join("\n"))
26
24
  end
27
25
 
28
26
  private
@@ -41,7 +41,7 @@ module Teodoro
41
41
  ['DadosRubrica_Natureza', evento['infoRubrica/*/dadosRubrica/natRubr']],
42
42
  ['DadosRubrica_TipoRubrica', evento['infoRubrica/*/dadosRubrica/tpRubr']],
43
43
  ['DadosRubrica_CodigoIncidenciaPrevidencia', evento['infoRubrica/*/dadosRubrica/codIncCP']],
44
- ['DadosRubrica_CodigoIncidenciaIR', evento['infoRubrica/*/dadosRubrica/codIncIRRF']],
44
+ de_acordo_com_a_versao_do_leiaute['DadosRubrica_CodigoIncidenciaIR'],
45
45
  ['DadosRubrica_CodigoIncidenciaFGTS', evento['infoRubrica/*/dadosRubrica/codIncFGTS']],
46
46
  ['DadosRubrica_CodigoIncidenciaSindical', evento['infoRubrica/*/dadosRubrica/codIncSIND']],
47
47
  ['IdEventoXml'],
@@ -54,6 +54,33 @@ module Teodoro
54
54
  ['hd_ProcessoSindicato']
55
55
  ]
56
56
  end
57
+
58
+ def de_acordo_com_a_versao_do_leiaute # rubocop:disable Metrics/MethodLength
59
+ @de_acordo_com_a_versao_do_leiaute ||=
60
+ (
61
+ if leiaute_simplificado?
62
+ [
63
+ [
64
+ 'DadosRubrica_CodigoIncidenciaIR',
65
+ evento['infoRubrica/*/dadosRubrica/codIncIRRF'].then { {
66
+ '0' => '00',
67
+ '1' => '01',
68
+ '9' => '09',
69
+ '700' => '79',
70
+ '701' => '79'
71
+ }[_1] || _1 }
72
+ ]
73
+ ]
74
+ else
75
+ [
76
+ [
77
+ 'DadosRubrica_CodigoIncidenciaIR',
78
+ evento['infoRubrica/*/dadosRubrica/codIncIRRF']
79
+ ]
80
+ ]
81
+ end
82
+ ).map { [_1.first, _1] }.to_h
83
+ end
57
84
  end
58
85
  end
59
86
  end
@@ -180,83 +180,28 @@ module Teodoro
180
180
  @data_da_alteracao ||= evento['infoTSVAlteracao/dtAlteracao']
181
181
  end
182
182
 
183
- def de_acordo_com_a_versao_do_leiaute
183
+ def de_acordo_com_a_versao_do_leiaute # rubocop:disable Metrics/MethodLength
184
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
185
+ (
186
+ if leiaute_simplificado?
187
+ [
188
+ [
189
+ 'InfoVinculo_InfoContrato_CodigoCargo',
190
+ empresa.cargos_gerados[
191
+ nome: evento['infoTSVAlteracao/infoComplementares/cargoFuncao/nmCargo'],
192
+ cbo: evento['infoTSVAlteracao/infoComplementares/cargoFuncao/CBOCargo']
193
+ ]&.codigo
194
+ ]
195
+ ]
196
+ else
197
+ [
198
+ [
199
+ 'InfoVinculo_InfoContrato_CodigoCargo',
200
+ evento['infoTSVAlteracao/infoComplementares/cargoFuncao/codCargo']
201
+ ]
202
+ ]
203
+ end
204
+ ).map { [_1.first, _1] }.to_h
260
205
  end
261
206
  end
262
207
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teodoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clavius Tales