easy_siconfi 1.0.0 → 2.0.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
  SHA1:
3
- metadata.gz: 901edf2f40523fbb2bd65b318252012781b07e80
4
- data.tar.gz: c3923bb6b94960e2cfe6a88c6c7520bfe1962c1d
3
+ metadata.gz: 4c3f71a831194bc1a902c6b29362dc669a1abddb
4
+ data.tar.gz: 57053e25f4d7d675b0bff80f82dd0263d52223e3
5
5
  SHA512:
6
- metadata.gz: 55395d83d5e4b17b4e80caeafec7f1a757a1a889911b21b09ef2b79edfe26fd414079589fab7352c3f8268370ef9d0f7991ddbc8acaa3d7dec1a34ab71f2614b
7
- data.tar.gz: ca4e34639fa1cb0ed15354cbc22be126161530a076d0e4a09c593810e8440e0f4c995267add130e75510c72b1f13229df8ecd7f9fbd7b599a5146d17ec648270
6
+ metadata.gz: 9fe1225301619e0adafefb5932a010a0c2aeba6738922763914504e478c6c5b321e2b2a8d81143812da521646b7ddc1a77c8b22fd10abcb3739961b0b9deb00b
7
+ data.tar.gz: 8322271a68d7ec9008b658a5082abf14c2b51c66d979ca7d1a23245f1f8f0b1061a5fd10a2061f8f378892c2646b276f8f9686da14a72546e70e4f9de6be86d7
@@ -2,18 +2,19 @@ require "net/http"
2
2
  require "json"
3
3
 
4
4
  class SICONFI
5
- attr_accessor :available_no_anexo, :available_co_tipo_demonstrativo
5
+ attr_accessor :available_no_anexo_rreo, :available_no_anexo_rgf, :available_co_tipo_demonstrativo
6
6
 
7
7
  def initialize()
8
- @webservice_url = "http://apidatalake.tesouro.gov.br/ords/siconfi/tt/rreo?"
9
- @available_no_anexo = ['RREO-Anexo 01', 'RREO-Anexo 02', 'RREO-Anexo 03',
10
- 'RREO-Anexo 04', 'RREO-Anexo 04 - RGPS', 'RREO-Anexo 04 - RPPS',
11
- 'RREO-Anexo 04.0 - RGPS', 'RREO-Anexo 04.1', 'RREO-Anexo 04.2',
12
- 'RREO-Anexo 04.3 - RGPS', 'RREO-Anexo 05', 'RREO-Anexo 06',
13
- 'RREO-Anexo 07', 'RREO-Anexo 09', 'RREO-Anexo 10 - RGPS', 'RREO-Anexo 10 - RPPS',
14
- 'RREO-Anexo 11', 'RREO-Anexo 13', 'RREO-Anexo 14']
15
-
16
- @available_co_tipo_demonstrativo = ['RREO', 'RREO Simplificado']
8
+ @webservice_url = "http://apidatalake.tesouro.gov.br/ords/siconfi/tt/"
9
+ @available_no_anexo_rreo = ['RREO-Anexo 01', 'RREO-Anexo 02', 'RREO-Anexo 03',
10
+ 'RREO-Anexo 04', 'RREO-Anexo 04 - RGPS', 'RREO-Anexo 04 - RPPS',
11
+ 'RREO-Anexo 04.0 - RGPS', 'RREO-Anexo 04.1', 'RREO-Anexo 04.2',
12
+ 'RREO-Anexo 04.3 - RGPS', 'RREO-Anexo 05', 'RREO-Anexo 06',
13
+ 'RREO-Anexo 07', 'RREO-Anexo 09', 'RREO-Anexo 10 - RGPS',
14
+ 'RREO-Anexo 10 - RPPS', 'RREO-Anexo 11', 'RREO-Anexo 13', 'RREO-Anexo 14']
15
+ @available_no_anexo_rgf = ['RGF-Anexo 01', 'RGF-Anexo 02', 'RGF-Anexo 03', 'RGF-Anexo 04', 'RGF-Anexo 06']
16
+
17
+ @available_co_tipo_demonstrativo = ['RREO', 'RREO Simplificado', 'RGF', 'RGF Simplificado']
17
18
  end
18
19
 
19
20
  def get_to_server(str)
@@ -36,12 +37,22 @@ class SICONFI
36
37
  check_nr_periodo(hash[:nr_periodo]) && check_an_exercicio(hash[:an_exercicio]) &&
37
38
  check_id_ente(hash[:id_ente]) then
38
39
 
39
- # Builds query
40
- url = "#{@webservice_url}an_exercicio=#{hash[:an_exercicio]}"
41
- url = "#{url}&nr_periodo=#{hash[:nr_periodo]}"
42
- url = "#{url}&co_tipo_demonstrativo=#{hash[:co_tipo_demonstrativo]}"
43
- url = "#{url}&id_ente=#{hash[:id_ente]}"
44
- url = "#{url}&no_anexo=#{hash[:no_anexo]}"
40
+ url = @webservice_url
41
+
42
+ if hash[:no_anexo].index("RREO") != nil || hash[:no_anexo].match(/^\D\d+/) then
43
+ url = "#{url}rreo?"
44
+
45
+ elsif hash[:no_anexo].index("RGF") != nil then
46
+ url = "#{url}rgf?"
47
+ url = "#{url}in_periodicidade=#{hash[:in_periodicidade]}&"
48
+ url = "#{url}&co_poder=#{hash[:co_poder]}&"
49
+ end
50
+
51
+ url = "#{url}an_exercicio=#{hash[:an_exercicio]}&"
52
+ url = "#{url}nr_periodo=#{hash[:nr_periodo]}&"
53
+ url = "#{url}co_tipo_demonstrativo=#{hash[:co_tipo_demonstrativo]}&"
54
+ url = "#{url}no_anexo=#{hash[:no_anexo]}&"
55
+ url = "#{url}id_ente=#{hash[:id_ente]}"
45
56
 
46
57
  consume_json(get_to_server(url))
47
58
  else
@@ -66,9 +77,9 @@ class SICONFI
66
77
  if no_anexo == nil then
67
78
  false
68
79
  elsif no_anexo.match(/^\D\d+/) then
69
- no_anexo.to_i < @available_no_anexo.size && no_anexo.to_i >= 0
80
+ (no_anexo.to_i < @available_no_anexo_rreo.size || @available_no_anexo_rgf.size) && no_anexo.to_i >= 0
70
81
  else
71
- @available_no_anexo.index(no_anexo) != nil
82
+ @available_no_anexo_rreo.index(no_anexo) != nil || @available_no_anexo_rgf.index(no_anexo) != nil
72
83
  end
73
84
  end
74
85
 
@@ -1,6 +1,6 @@
1
1
  class SICONFIData
2
2
  attr_accessor :exercicio, :periodo, :periodicidade, :instituicao,
3
- :uf, :populacao, :rotulo, :coluna, :conta, :valor
3
+ :uf, :populacao, :rotulo, :coluna, :conta, :valor, :co_poder
4
4
 
5
5
  def initialize(hash)
6
6
  @exercicio = hash['exercicio']
@@ -13,6 +13,10 @@ class SICONFIData
13
13
  @coluna = hash['coluna']
14
14
  @conta = hash['conta']
15
15
  @valor = hash['valor']
16
+
17
+ if hash.keys.index('co_poder') != nil then
18
+ @co_poder = hash['co_poder']
19
+ end
16
20
  end
17
21
 
18
22
  def valid?()
@@ -20,10 +24,10 @@ class SICONFIData
20
24
  @periodicidade != nil && @instituicao != nil &&
21
25
  @uf != nil && @populacao != nil &&
22
26
  @rotulo != nil && @coluna != nil &&
23
- @conta != nil && @valor != nil
27
+ @conta != nil && @valor != nil
24
28
  end
25
29
 
26
30
  def to_s()
27
- "exercicio: #{@exercicio}\nperiodo: #{@periodo}\nperiodicidade: #{@periodicidade}\ninstituicao: #{@instituicao}\nuf: #{@uf}\npopulacao: #{@populacao}\nrotulo: #{@rotulo}\ncoluna: #{@coluna}\nconta: #{@conta}\nvalor: #{@valor}"
31
+ "exercicio: #{@exercicio}\nperiodo: #{@periodo}\nperiodicidade: #{@periodicidade}\ninstituicao: #{@instituicao}\nuf: #{@uf}\npopulacao: #{@populacao}\nrotulo: #{@rotulo}\ncoluna: #{@coluna}\nconta: #{@conta}\nvalor: #{@valor}#{@co_poder != nil ? '\npoder: ' : ''}#{@co_poder != nil ? @co_poder : ''}"
28
32
  end
29
33
  end
@@ -1,3 +1,3 @@
1
1
  module EasySiconfi
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_siconfi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rCamposCruz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-17 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement