portal_scraper 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/portal_scraper/accounts/client.rb +19 -3
- data/lib/portal_scraper/number_helper.rb +8 -0
- data/lib/portal_scraper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1645a898b4d02cea25387829c4aa64cbba4079548e4a3071c2dd36e38890e3a8
|
4
|
+
data.tar.gz: 8d5ef9cc5da93c985773a63de9fcfdf196909357bcd69db414ccec45daab864d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd9db17c4112d4247fe21cd37d71acde3da046ec54be8fd91d2977a14f55312ff1117b2f20c12eb20be5caa6dffc4c31f3e4d0ef2863bbc4e0336a2606700736
|
7
|
+
data.tar.gz: 276da5c4531e01f87149e8e703658a9a0140c2808ec4c27e112445dd91e0556a88f3250048499c73d37bc012bc2b00d0fc6709d0f8360cf08eaa708478c1e571
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
require 'active_support/all'
|
3
3
|
require_relative '../city_names_helper'
|
4
|
+
require_relative '../number_helper'
|
4
5
|
|
5
6
|
module PortalScraper
|
6
7
|
module Accounts
|
7
8
|
class Client
|
8
9
|
include CityNamesHelper
|
10
|
+
include NumberHelper
|
9
11
|
attr_accessor :app_id, :secret
|
10
12
|
|
11
13
|
CODE_TO_COUNTRY_MAPPING = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'code_to_country.json')))
|
@@ -24,11 +26,25 @@ module PortalScraper
|
|
24
26
|
results = app.post(url_for('/appRecherche.do'), { nom: '', prenom: '', chercher: 'Chercher' })
|
25
27
|
loop do
|
26
28
|
results.links_with(href: /appTiersDetail.do/).each do |link|
|
27
|
-
account
|
29
|
+
account = link.click
|
30
|
+
transfers = []
|
31
|
+
account.links_with(css: 'table#contrat td a').each do |transfer|
|
32
|
+
result = transfer.click
|
33
|
+
result.search('table#operation tbody tr').each do |row|
|
34
|
+
transfers << {
|
35
|
+
operation_date: row.search('td[1]').text.strip.match(/\d{2}\/\d{2}\/\d{4}/).to_s,
|
36
|
+
nature: row.search('td[2]').text.strip.gsub(/[\n,\t,'']/, ''),
|
37
|
+
value_date: row.search('td[3]').text.strip.match(/\d{2}\/\d{2}\/\d{4}/).to_s,
|
38
|
+
debit: format_number(row.search('td[4]')),
|
39
|
+
credit: format_number(row.search('td[5]')),
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
28
43
|
accounts_data[:accounts] << {
|
29
44
|
client_ref: find_table_value(account, 'Identifiant tiers'),
|
30
|
-
balance: account.search('table#contrat th.n')
|
31
|
-
opened_on: account.search('table#contrat td').text.gsub(/\d{2}\/\d{2}\/\d{4}/)&.max
|
45
|
+
balance: format_number(account.search('table#contrat th.n')),
|
46
|
+
opened_on: account.search('table#contrat td').text.gsub(/\d{2}\/\d{2}\/\d{4}/)&.max,
|
47
|
+
transfers: transfers
|
32
48
|
}
|
33
49
|
end
|
34
50
|
|
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.
|
4
|
+
version: 1.9.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-12-
|
12
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/portal_scraper/bad_login_url.rb
|
124
124
|
- lib/portal_scraper/bad_root_url.rb
|
125
125
|
- lib/portal_scraper/city_names_helper.rb
|
126
|
+
- lib/portal_scraper/number_helper.rb
|
126
127
|
- lib/portal_scraper/portal_scraper_error.rb
|
127
128
|
- lib/portal_scraper/version.rb
|
128
129
|
- portal-scraper.gemspec
|