portal_scraper 1.4.3 → 1.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8825ed756349c40d08302537a67c019f92eacdbb9765f9e29175839216cb7a60
|
4
|
+
data.tar.gz: 15a5c317d86916cdcf36d28db34060582f23ebbdbf79b36cbc82ebf02b24ac45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5de7debdf23d19ae2d502fdae82c76842dea86452b70202d177bac631799199cc3d7bbebf2287b7d66897ffeb80a935b6f7b2c72b70c2607e696cff8f83979
|
7
|
+
data.tar.gz: f9aeca9291c8a5c57b0cd56fc5a9879b11d18e4c2f889136711011a633f8863d9181292d6c0a3cec1e5d3495c0e1bd64bcd0d33ec1e7bde5ae0befbe43e3d355
|
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'mechanize'
|
2
|
+
require 'active_support/all'
|
3
|
+
require_relative '../city_names_helper'
|
2
4
|
|
3
5
|
module PortalScraper
|
4
6
|
module Accounts
|
5
7
|
class Client
|
8
|
+
include CityNamesHelper
|
6
9
|
attr_accessor :app_id, :secret
|
7
10
|
|
8
11
|
CODE_TO_COUNTRY_MAPPING = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'code_to_country.json')))
|
@@ -37,7 +40,7 @@ module PortalScraper
|
|
37
40
|
form['commune'] = user[:codeInsee]
|
38
41
|
form['libCommune'] = user[:ville]
|
39
42
|
else
|
40
|
-
fill_commune(app, form, user[:codePostal], user[:ville]
|
43
|
+
fill_commune(app, form, user[:codePostal], format_city_name(user[:ville]))
|
41
44
|
end
|
42
45
|
fill_birth_place(form, user[:paysNaissance])
|
43
46
|
form['modeContact'] = ''
|
@@ -118,10 +121,10 @@ module PortalScraper
|
|
118
121
|
|
119
122
|
def fill_commune(app, form, postal_code, city)
|
120
123
|
app.post(url_for('/tiersCommunes.do'), { codPos: postal_code }).tap do |mappings|
|
121
|
-
|
122
|
-
|
123
|
-
form['commune'] = code
|
124
|
-
form['libCommune'] =
|
124
|
+
cities = mappings.search('td.t').map { |c| { code: c.parent.search('a.PL_LST').text.strip, name: c.text.strip } }
|
125
|
+
matched_city = cities.find(-> { cities.first }) { |c| c[:name].include?(city) }
|
126
|
+
form['commune'] = matched_city[:code]
|
127
|
+
form['libCommune'] = matched_city[:name]
|
125
128
|
end
|
126
129
|
end
|
127
130
|
|
data/portal-scraper.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.required_ruby_version = '>= 2.5.3'
|
24
24
|
|
25
25
|
spec.add_dependency 'mechanize', '~> 2.7'
|
26
|
+
spec.add_dependency 'activesupport', '~> 5.2'
|
26
27
|
|
27
28
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
28
29
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
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.5.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-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '2.7'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activesupport
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '5.2'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '5.2'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rspec
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,7 @@ files:
|
|
108
122
|
- lib/portal_scraper/accounts/code_to_country.json
|
109
123
|
- lib/portal_scraper/bad_login_url.rb
|
110
124
|
- lib/portal_scraper/bad_root_url.rb
|
125
|
+
- lib/portal_scraper/city_names_helper.rb
|
111
126
|
- lib/portal_scraper/portal_scraper_error.rb
|
112
127
|
- lib/portal_scraper/version.rb
|
113
128
|
- portal-scraper.gemspec
|