portal_scraper 1.5.0 → 1.6.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
  SHA256:
3
- metadata.gz: 8825ed756349c40d08302537a67c019f92eacdbb9765f9e29175839216cb7a60
4
- data.tar.gz: 15a5c317d86916cdcf36d28db34060582f23ebbdbf79b36cbc82ebf02b24ac45
3
+ metadata.gz: 7a542aac9f217de2e57612d41dcea49244113a8bd5df4b4a75f68f3bbee929f3
4
+ data.tar.gz: 0a81730c139e278ec244b146262c4f20a0ab2541dbc560e6f9113641dcefafc4
5
5
  SHA512:
6
- metadata.gz: df5de7debdf23d19ae2d502fdae82c76842dea86452b70202d177bac631799199cc3d7bbebf2287b7d66897ffeb80a935b6f7b2c72b70c2607e696cff8f83979
7
- data.tar.gz: f9aeca9291c8a5c57b0cd56fc5a9879b11d18e4c2f889136711011a633f8863d9181292d6c0a3cec1e5d3495c0e1bd64bcd0d33ec1e7bde5ae0befbe43e3d355
6
+ metadata.gz: f5878b31e717280e896190b54ec68992729123466c163f6829e9553b8cab5db31a4f73d6cff3b047377cb8c8321fcfa9614cad5a85d7a6f25b894f7001b22f44
7
+ data.tar.gz: 7e55493099947d44c3a7a0d73f2cd3713c228f8cdecbffd92e5495261d752554e759649c9865c0b397ad114bea5a461b21f3c985605a31bc1e91771ef1eb734d
@@ -20,13 +20,21 @@ module PortalScraper
20
20
  def get_accounts_balance
21
21
  login
22
22
  accounts_data = { accounts: [] }
23
- results = app.post(url_for('/appRecherche.do'), { nom: '', prenom: '', chercher: 'Chercher' })
24
- results.links_with(href: /appTiersDetail.do/).each do |link|
25
- account = link.click
26
- accounts_data[:accounts] << {
27
- client_ref: find_table_value(account, 'Identifiant tiers'),
28
- balance: account.search('table#contrat th.n').text.gsub(/[[:space:]]+/, '').tr('.,', ',.').to_f
29
- }
23
+
24
+ results = app.post(url_for('/appRecherche.do'), { nom: '', prenom: '', chercher: 'Chercher' })
25
+ loop do
26
+ results.links_with(href: /appTiersDetail.do/).each do |link|
27
+ account = link.click
28
+ accounts_data[:accounts] << {
29
+ client_ref: find_table_value(account, 'Identifiant tiers'),
30
+ balance: account.search('table#contrat th.n').text.gsub(/[[:space:]]+/, '').tr('.,', ',.').to_f
31
+ }
32
+ end
33
+
34
+ break unless results.search('.pg_next').present?
35
+ # Need to fetch the first page as you cannot navigate from client back to research page
36
+ app.post(url_for('/appRecherche.do'), { nom: '', prenom: '', chercher: 'Chercher' })
37
+ results = app.get(results.search('a.pg_next').first['href'])
30
38
  end
31
39
  accounts_data
32
40
  end
@@ -1,7 +1,7 @@
1
1
  module PortalScraper
2
2
  class Version
3
3
  MAJOR = 1
4
- MINOR = 5
4
+ MINOR = 6
5
5
  PATCH = 0
6
6
 
7
7
  def self.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portal_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Armand Mégrot
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-02 00:00:00.000000000 Z
12
+ date: 2019-09-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize