ifqar 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5da6aeac0267d3a95b2b002fa02d906b3a2dfda5
4
- data.tar.gz: 44ddcc3ae1c60e8c5b982e6e7dc35773d5c167ed
3
+ metadata.gz: a34ebc71e5e71a64a28399d0c281295071b72827
4
+ data.tar.gz: b2ac29a91dc705f3dbdfb418867fe5287aa481b2
5
5
  SHA512:
6
- metadata.gz: 18853eb92f28454cfef648554abb96ed5a9c6843aa68847feb19966973095e720b66250615ff32ecaa89580504cc15478c7d979e0168ca7e32919e63b00cc3fc
7
- data.tar.gz: 2652a0a28e730ba2287874e6fb4e0c7edd9b175396da7670a33b2febd804ab2f77391689e9705a1c49ab46a26b30dc4118863f146ebb9fffbc897c7a03792435
6
+ metadata.gz: 784e74e76ae0cd96ec94c8de06d3174aaacd6f3de54b6792aa9db2c7b2c7756e076d507b6a87c81da688d4f93448162762dda8966b620569801aa673b79f0390
7
+ data.tar.gz: 0ca467887985f74f3a735a6b819dd6cf9844acca7f43fe6658167d0034f347d24c9565167d47fed82b0cb9615b6c3d6cdfeb6c1b804cb3920152825ad36b1991
@@ -17,6 +17,8 @@ module Ifqar
17
17
  :referer => 'http://www.cafci.org.ar/scripts/cfn_EstadisticasVCP.html'
18
18
  }.freeze
19
19
 
20
+ MAX_RETRIES = 3
21
+
20
22
  SET_PARAMS_URL = 'http://www.cafci.org.ar/Scripts/cfn_EstadisticaVCPXMLSet.asp'.freeze
21
23
  QUERY_URL = 'http://www.cafci.org.ar/Scripts/cfn_PlanillaDiariaXMLList.asp'.freeze
22
24
 
@@ -37,8 +39,19 @@ module Ifqar
37
39
 
38
40
  def query_service(date, type)
39
41
  payload = payload_builder(date, type)
40
- response = RestClient.post(SET_PARAMS_URL, { :query => payload }, HEADERS)
41
- response = RestClient.post(QUERY_URL, nil, HEADERS.merge(:cookies => response.cookies))
42
+
43
+ retries = 0
44
+ begin
45
+ response = RestClient.post(SET_PARAMS_URL, { :query => payload }, HEADERS)
46
+ response = RestClient.post(QUERY_URL, nil, HEADERS.merge(:cookies => response.cookies))
47
+ rescue RestClient::ExceptionWithResponse => error
48
+ if retries < MAX_RETRIES
49
+ retries += 1
50
+ retry
51
+ else
52
+ raise error
53
+ end
54
+ end
42
55
 
43
56
  StatsDeserializer.deserialze(date, FUND_TYPE[type][:name], response.body)
44
57
  end
@@ -1,3 +1,3 @@
1
1
  module Ifqar
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifqar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Hein
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client