portal_scraper 1.6.0 → 1.7.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 +12 -2
- 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: 720b81f1806f9e135f471667556e9cbe322bbd6cd7d3a0e52c13a4f998c0626d
|
4
|
+
data.tar.gz: e891188589e402071e65fa9dc53309ca653267167a9e5bc789426b1f8bdf430e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a486c14f993b7daef03e648df44b7f306efcf9efa0c63d39e79c43821823bf4205ee1e84a122a178c5957016c0941acb307ec07829380f00b56edf6cd9634bdf
|
7
|
+
data.tar.gz: 608fd996c6bed19039ce3bcc1d1da3d29d2bb77135063b17fd814f69bad5185e0e815d6f2d4a779edeaa983efff6781aa9be1ff607e664fe1692c6a0c9260506
|
@@ -48,8 +48,9 @@ module PortalScraper
|
|
48
48
|
form['commune'] = user[:codeInsee]
|
49
49
|
form['libCommune'] = user[:ville]
|
50
50
|
else
|
51
|
-
fill_commune(app, form, user[:codePostal], format_city_name(user[:ville]))
|
51
|
+
fill_commune(app, form, user[:codePostal], format_city_name(user[:ville]), user[:pays] || user[:libNation])
|
52
52
|
end
|
53
|
+
fill_address(form, user[:numeroVoie])
|
53
54
|
fill_birth_place(form, user[:paysNaissance])
|
54
55
|
form['modeContact'] = ''
|
55
56
|
form['creerTiers'] = 'Créer'
|
@@ -127,13 +128,22 @@ module PortalScraper
|
|
127
128
|
end
|
128
129
|
end
|
129
130
|
|
130
|
-
def fill_commune(app, form, postal_code, city)
|
131
|
+
def fill_commune(app, form, postal_code, city, country_code)
|
131
132
|
app.post(url_for('/tiersCommunes.do'), { codPos: postal_code }).tap do |mappings|
|
132
133
|
cities = mappings.search('td.t').map { |c| { code: c.parent.search('a.PL_LST').text.strip, name: c.text.strip } }
|
133
134
|
matched_city = cities.find(-> { cities.first }) { |c| c[:name].include?(city) }
|
134
135
|
form['commune'] = matched_city[:code]
|
135
136
|
form['libCommune'] = matched_city[:name]
|
136
137
|
end
|
138
|
+
form['territoireRes'] = CODE_TO_COUNTRY_MAPPING.dig(country_code, 'category')
|
139
|
+
end
|
140
|
+
|
141
|
+
def fill_address(form, address)
|
142
|
+
address, additional_information = address.split("\n")
|
143
|
+
form['numeroVoie'] = address
|
144
|
+
if additional_information
|
145
|
+
form['lieudit'] = additional_information
|
146
|
+
end
|
137
147
|
end
|
138
148
|
|
139
149
|
def fill_birth_place(form, country_code)
|
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.7.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
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|