portal_scraper 2.0.1 → 2.0.2
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 +4 -4
- data/lib/portal_scraper/accounts/client.rb +28 -27
- data/lib/portal_scraper/parsing_helper.rb +1 -1
- data/lib/portal_scraper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4da909bd4c96e2f086b1c3d829c27a1ed6be1fc2dd2a071d1b0c95aaf062f60a
|
4
|
+
data.tar.gz: dd4c79ee59b02dc544b54507cb74a67203f17f661c39add242024a82c52dd837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8b34815e11e7eea8cfd7278b0fe5ad9342567855fdef8faba6a274ca0731f3976aed8804372889f742f6d8f10b72730e55f4e6ce3b18de4b24d8c6f48fa1c9
|
7
|
+
data.tar.gz: ca74f2b24e0acf074795028ed4b84a0190197743d3c30b96f6b8b13873f6cf0938b775f403c4fc878f99600cede3f39db0f3a288a9f08e5d7a473a0df6969d93
|
@@ -25,23 +25,28 @@ module PortalScraper
|
|
25
25
|
loop do
|
26
26
|
user_page.links_with(href: /appTiersDetail.do/).each do |link|
|
27
27
|
account = link.click
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
account.links_with(css: 'table#contrat td a').each do |
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
selected_link = nil
|
29
|
+
opened_on, balance = nil, 0.to_d
|
30
|
+
|
31
|
+
account.links_with(css: 'table#contrat td a').each do |account_link|
|
32
|
+
row = account_link.node.ancestors('tr')
|
33
|
+
next unless row.at('td[1]').text.strip == 'Compte épargne rémunéré'
|
34
|
+
|
35
|
+
row_date = parse_date(row.at('td[2]'))
|
36
|
+
next unless opened_on.nil? || opened_on < row_date
|
37
|
+
|
38
|
+
selected_link = account_link
|
39
|
+
opened_on = row_date
|
40
|
+
balance = parse_number(row.at('td[4]'))
|
37
41
|
end
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
next unless selected_link
|
44
|
+
|
45
|
+
transfers = scrap_transfers(selected_link)
|
41
46
|
accounts_data[:accounts] << {
|
42
47
|
client_ref: find_table_value(account, 'Identifiant tiers'),
|
43
|
-
balance: balance
|
44
|
-
opened_on:
|
48
|
+
balance: balance,
|
49
|
+
opened_on: opened_on,
|
45
50
|
transfers: transfers,
|
46
51
|
}
|
47
52
|
end
|
@@ -175,21 +180,17 @@ module PortalScraper
|
|
175
180
|
PortalScraper.config
|
176
181
|
end
|
177
182
|
|
178
|
-
def scrap_transfers(
|
179
|
-
|
180
|
-
transfers_page
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
credit: parse_number(row.search('td[5]')),
|
189
|
-
}
|
190
|
-
end
|
183
|
+
def scrap_transfers(account_link)
|
184
|
+
transfers_page = account_link.click
|
185
|
+
transfers_page.search('table#operation tbody tr').map do |transfer_row|
|
186
|
+
{
|
187
|
+
operation_date: parse_date(transfer_row.search('td[1]')),
|
188
|
+
nature: transfer_row.search('td[2]').text.strip.gsub(/[\n,\t,'']/, ''),
|
189
|
+
value_date: parse_date(transfer_row.search('td[3]')),
|
190
|
+
debit: parse_number(transfer_row.search('td[4]')),
|
191
|
+
credit: parse_number(transfer_row.search('td[5]')),
|
192
|
+
}
|
191
193
|
end
|
192
|
-
transfers
|
193
194
|
end
|
194
195
|
end
|
195
196
|
end
|
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: 2.0.
|
4
|
+
version: 2.0.2
|
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: 2020-01-
|
12
|
+
date: 2020-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|