portal_scraper 1.2.3 → 1.3.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 +20 -1
- data/lib/portal_scraper/version.rb +2 -2
- data/portal-scraper.gemspec +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4df187d3c6821bbb51afe75a0b0facff3e37789221ef19f5916ff365ae5c513
|
4
|
+
data.tar.gz: 741723003ad4428b8219d6eeda4fdd8471bf1b0977fdcd494e105f3de79e4776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 040bacec63c67e59b5ac8aef874bb90557a8e4f19ec9ff16f9ef4f4bdedd270df67ae2d72c23b02aca6deaabfba9f63fc074c9ba8d4bc37b79e26bf711bdfcdc
|
7
|
+
data.tar.gz: 3ae49e0387465e4208dbcb67d9c530f8209d30198098ca9a9d2cd9ef6d9b70f1e091d2e450c9267b5f8ff1cdc5c786fa9074eb4b60239d3414bf278d9b3131bb
|
@@ -6,6 +6,7 @@ module PortalScraper
|
|
6
6
|
attr_accessor :app_id, :secret
|
7
7
|
|
8
8
|
CODE_TO_COUNTRY_MAPPING = JSON.parse(File.read(File.join( File.dirname(__FILE__), 'code_to_country.json')))
|
9
|
+
MINIMUM_AMOUNT = 10
|
9
10
|
|
10
11
|
def initialize(app_id = nil, secret = nil)
|
11
12
|
@app_id = app_id || config.app_id
|
@@ -41,7 +42,9 @@ module PortalScraper
|
|
41
42
|
if result_page.uri.path =~ /error.do/
|
42
43
|
return { error: 'Missing data' }
|
43
44
|
else
|
44
|
-
|
45
|
+
ref = result_page.search('td.ZMSG').text.split(':')[1].strip
|
46
|
+
proposition result_page
|
47
|
+
return { client_ref: ref }
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
@@ -69,6 +72,22 @@ module PortalScraper
|
|
69
72
|
app.get(url_for(config.token_url)) unless config.token_url.nil?
|
70
73
|
end
|
71
74
|
|
75
|
+
def proposition(creation_page)
|
76
|
+
form = creation_page.form_with(name: /succes/i) || creation_page.forms[0]
|
77
|
+
form.click_button
|
78
|
+
proposition_page = app.get(url_for('/propositionDetail.do'), {idx: 3})
|
79
|
+
proposition_form = proposition_page.form_with(name: /proposition/i)
|
80
|
+
try_form_fields(proposition_form, %w(montant amount), MINIMUM_AMOUNT)
|
81
|
+
proposition_form['regimeFiscal'] = 'I'
|
82
|
+
proposition_form.click_button
|
83
|
+
app.get(url_for('/propositionCreate.do'))
|
84
|
+
confirmation_page = app.get(url_for('/propositionConfirm.do'))
|
85
|
+
if confirmation_page.uri.path =~ /error.do/
|
86
|
+
return { error: 'Missing data' }
|
87
|
+
end
|
88
|
+
app.get(url_for('/propositionImprimer.do'))
|
89
|
+
end
|
90
|
+
|
72
91
|
def try_form_fields(form, fields, value)
|
73
92
|
fields.each do |field|
|
74
93
|
if form.has_field?(field)
|
data/portal-scraper.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.platform = Gem::Platform::RUBY
|
9
9
|
spec.name = 'portal_scraper'
|
10
10
|
spec.version = PortalScraper::Version
|
11
|
-
spec.authors = ['Armand Mégrot']
|
12
|
-
spec.email =
|
11
|
+
spec.authors = ['Armand Mégrot', 'Thomas Burgaud']
|
12
|
+
spec.email = %w(armand.megrot@gmail.com thomasburgaud98@gmail.com)
|
13
13
|
spec.summary = 'Ruby portal scraper'
|
14
14
|
spec.description = 'Scrapping client for extranet portals.'
|
15
15
|
spec.license = 'Apache-2.0'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: portal_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armand Mégrot
|
8
|
+
- Thomas Burgaud
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2019-
|
12
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: mechanize
|
@@ -97,6 +98,7 @@ dependencies:
|
|
97
98
|
description: Scrapping client for extranet portals.
|
98
99
|
email:
|
99
100
|
- armand.megrot@gmail.com
|
101
|
+
- thomasburgaud98@gmail.com
|
100
102
|
executables: []
|
101
103
|
extensions: []
|
102
104
|
extra_rdoc_files: []
|