portal_scraper 1.2.1 → 1.2.2

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: bda292894076f02d59473052af9ae3daa5e05e62bba31b453d86581abd809877
4
- data.tar.gz: f5ae9d449f2ff4b868e1984eee05e949182b2a4c800dce15edecfcd3dd86ddc3
3
+ metadata.gz: 5d1aefa65524b70deab578ff2dd0c69bf9144f4ce41432d31660f0c8252c95e9
4
+ data.tar.gz: 4d385ee736b9bf2ff9c6b9d8c85012af9d2774e511023788a8a48ee52c11621d
5
5
  SHA512:
6
- metadata.gz: 4520278d5064e24b6b8850d02289ee75299db9c6b84b098f4b3b654fd7e81594e687830510feec6d98a6192aa88a519816987c89e8fb7c0f5b4990dcde53b513
7
- data.tar.gz: e135e07774135f0a319e2575d334ad3c3c3f6ba6f8395cd380e776f288f43b223e4552306502043b03a66a886a1d1c1fa0d5968e3028fd4850918d9e4fbe0b5e
6
+ metadata.gz: eac8cc9a0ad42ed44bd4867429c4890d5a0904b24f569e5e8911823225730f13a2752d50c215b278ec9869eca875887ecfaeb08b309ea094a7cbc484920528b6
7
+ data.tar.gz: e78838016196e07f5b06b8e0214f34d123fc3b3857ac11c48f6c6ca6e648aed2c64ae01e7c76c409ea5c23e5e72da8b659598929627264f2fa57baa9cdcb5460
@@ -5,6 +5,8 @@ module PortalScraper
5
5
  class Client
6
6
  attr_accessor :app_id, :secret
7
7
 
8
+ CODE_TO_COUNTRY_MAPPING = JSON.parse(File.read(File.join( File.dirname(__FILE__), 'code_to_country.json')))
9
+
8
10
  def initialize(app_id = nil, secret = nil)
9
11
  @app_id = app_id || config.app_id
10
12
  @secret = secret || config.secret
@@ -31,6 +33,7 @@ module PortalScraper
31
33
  create_page.form_with(name: /(create|creation)/i) do |form|
32
34
  form.fields.each { |f| try_form_fields(form, [f.name], user[f.name.to_sym]) }
33
35
  fill_commune(app, form, user[:codePostal], user[:ville])
36
+ fill_birth_place(form, user[:paysNaissance])
34
37
  form['modeContact'] = ''
35
38
  form['creerTiers'] = 'Créer'
36
39
  form.submit
@@ -84,6 +87,12 @@ module PortalScraper
84
87
  end
85
88
  end
86
89
 
90
+ def fill_birth_place(form, country_code)
91
+ form['paysNaissance'] = country_code
92
+ form['libPaysNaissance'] = CODE_TO_COUNTRY_MAPPING[country_code]['name']
93
+ form['territoireNaissance'] = CODE_TO_COUNTRY_MAPPING[country_code]['category']
94
+ end
95
+
87
96
  def find_table_value(node, column_name)
88
97
  node.search('td.CA_LABEL').find { |column| column.text.strip == column_name }.parent.search('td.CA_LIB').text.strip
89
98
  end
@@ -0,0 +1 @@
1
+ {"FR":{"name":"FRANCE","category":0},"GP":{"name":"GUADELOUPE","category":1},"GF":{"name":"GUYANE FRANCAISE","category":1},"MQ":{"name":"MARTINIQUE","category":1},"RE":{"name":"REUNION","category":1},"CP":{"name":"ILE CLIPPERTON","category":2},"YT":{"name":"MAYOTTE","category":2},"NC":{"name":"NELLE CALEDONIE","category":2},"PF":{"name":"POLYNESIE FRANC","category":2},"BL":{"name":"ST BARTHELEMY","category":2},"MF":{"name":"ST MARTIN","category":2},"PM":{"name":"ST PIERRE MIQUEL","category":2},"TF":{"name":"TERRES AUS FRANC","category":2},"WF":{"name":"WALLIS ET FUTUNA","category":2},"MC":{"name":"MONACO","category":3},"AF":{"name":"AFGHANISTAN","category":9},"ZA":{"name":"AFRIQUE DU SUD","category":9},"AL":{"name":"ALBANIE","category":9},"DZ":{"name":"ALGERIE","category":9},"DE":{"name":"ALLEMAGNE","category":9},"AD":{"name":"ANDORRE","category":9},"AO":{"name":"ANGOLA","category":9},"AI":{"name":"ANGUILLA","category":9},"AG":{"name":"ANTIGUA ET BARBU","category":9},"AN":{"name":"ANTILLES NEERLAN","category":9},"SA":{"name":"ARABIE SAOUDITE","category":9},"AR":{"name":"ARGENTINE","category":9},"AM":{"name":"ARMENIE","category":9},"AW":{"name":"ARUBA","category":9},"AU":{"name":"AUSTRALIE","category":9},"AT":{"name":"AUTRICHE","category":9},"AZ":{"name":"AZERBAIDJAN","category":9},"BS":{"name":"BAHAMAS","category":9},"BH":{"name":"BAHREIN","category":9},"BD":{"name":"BANGLADESH","category":9},"BB":{"name":"BARBADE LA","category":9},"BE":{"name":"BELGIQUE","category":9},"BZ":{"name":"BELIZE","category":9},"BJ":{"name":"BENIN","category":9},"BM":{"name":"BERMUDES","category":9},"BT":{"name":"BHOUTAN","category":9},"BY":{"name":"BIELORUSSIE","category":9},"BO":{"name":"BOLIVIE","category":9},"BA":{"name":"BOSNIE-HERZEGOVI","category":9},"BW":{"name":"BOTSWANA","category":9},"BR":{"name":"BRESIL","category":9},"BN":{"name":"BRUNEI","category":9},"BG":{"name":"BULGARIE","category":9},"BF":{"name":"BURKINA-FASO","category":9},"BI":{"name":"BURUNDI","category":9},"KH":{"name":"CAMBODGE","category":9},"CM":{"name":"CAMEROUN","category":9},"CA":{"name":"CANADA","category":9},"CV":{"name":"CAP VERT","category":9},"KY":{"name":"CAYMANES ILES","category":9},"CF":{"name":"CENTRAFRIQUE","category":9},"CL":{"name":"CHILI","category":9},"CN":{"name":"CHINE","category":9},"CY":{"name":"CHYPRE","category":9},"CO":{"name":"COLOMBIE","category":9},"KM":{"name":"COMORES","category":9},"CG":{"name":"CONGO","category":9},"KP":{"name":"COREE DU NORD","category":9},"KR":{"name":"COREE REPUBLIQUE","category":9},"CR":{"name":"COSTA-RICA","category":9},"CI":{"name":"COTE D'IVOIRE","category":9},"HR":{"name":"CROATIE","category":9},"CU":{"name":"CUBA","category":9},"DK":{"name":"DANEMARK","category":9},"DJ":{"name":"DJIBOUTI","category":9},"DO":{"name":"DOMINICAINE REPU","category":9},"DM":{"name":"DOMINIQUE","category":9},"EG":{"name":"EGYPTE","category":9},"AE":{"name":"EMIRATS ARABES U","category":9},"EC":{"name":"EQUATEUR","category":9},"ER":{"name":"ERYTHREE","category":9},"ES":{"name":"ESPAGNE","category":9},"EE":{"name":"ESTONIE","category":9},"US":{"name":"ETATS-UNIS","category":9},"ET":{"name":"ETHIOPIE","category":9},"FK":{"name":"FALKLAND","category":9},"FO":{"name":"FEROE ILES","category":9},"FJ":{"name":"FIDJI","category":9},"FI":{"name":"FINLANDE","category":9},"GA":{"name":"GABON","category":9},"GM":{"name":"GAMBIE","category":9},"GE":{"name":"GEORGIE","category":9},"GS":{"name":"GEORGIE SUD SAND","category":9},"GH":{"name":"GHANA","category":9},"GI":{"name":"GIBRALTAR","category":9},"GR":{"name":"GRECE","category":9},"GD":{"name":"GRENADE","category":9},"GL":{"name":"GROENLAND","category":9},"GU":{"name":"GUAM","category":9},"GT":{"name":"GUATEMALA","category":9},"GG":{"name":"GUERNESEY","category":9},"GN":{"name":"GUINEE","category":9},"GQ":{"name":"GUINEE EQUATORIA","category":9},"GW":{"name":"GUINEE-BISSAO","category":9},"GY":{"name":"GUYANE","category":9},"HT":{"name":"HAITI","category":9},"HN":{"name":"HONDURAS","category":9},"HK":{"name":"HONG KONG","category":9},"HU":{"name":"HONGRIE","category":9},"IM":{"name":"ILE DE MAN","category":9},"CK":{"name":"ILES COOK","category":9},"AX":{"name":"ILES D'ALAND","category":9},"IN":{"name":"INDE","category":9},"ID":{"name":"INDONESIE","category":9},"IQ":{"name":"IRAK","category":9},"IR":{"name":"IRAN","category":9},"IE":{"name":"IRLANDE","category":9},"IS":{"name":"ISLANDE","category":9},"IL":{"name":"ISRAEL","category":9},"IT":{"name":"ITALIE","category":9},"JM":{"name":"JAMAIQUE","category":9},"JP":{"name":"JAPON","category":9},"JE":{"name":"JERSEY","category":9},"JO":{"name":"JORDANIE","category":9},"KZ":{"name":"KAZAKHSTAN","category":9},"KE":{"name":"KENYA","category":9},"KG":{"name":"KIRGHISTAN","category":9},"KI":{"name":"KIRIBATI","category":9},"KW":{"name":"KOWEIT","category":9},"LA":{"name":"LAOS","category":9},"LS":{"name":"LESOTHO","category":9},"LV":{"name":"LETTONIE","category":9},"LB":{"name":"LIBAN","category":9},"LR":{"name":"LIBERIA","category":9},"LY":{"name":"LIBYE","category":9},"LI":{"name":"LIECHTENSTEIN","category":9},"LT":{"name":"LITUANIE","category":9},"LU":{"name":"LUXEMBOURG","category":9},"MO":{"name":"MACAO","category":9},"MK":{"name":"MACEDOINE TERR A","category":9},"MG":{"name":"MADAGASCAR","category":9},"MY":{"name":"MALAISIE","category":9},"MW":{"name":"MALAWI","category":9},"MV":{"name":"MALDIVES ILES","category":9},"ML":{"name":"MALI","category":9},"MT":{"name":"MALTE","category":9},"MA":{"name":"MAROC","category":9},"MH":{"name":"MARSHALL ILES","category":9},"MU":{"name":"MAURICE ILES","category":9},"MR":{"name":"MAURITANIE","category":9},"MX":{"name":"MEXIQUE","category":9},"FM":{"name":"MICRONESIE","category":9},"MD":{"name":"MOLDAVIE","category":9},"MN":{"name":"MONGOLIE","category":9},"ME":{"name":"MONTENEGRO","category":9},"MS":{"name":"MONTSERRAT","category":9},"MZ":{"name":"MOZAMBIQUE","category":9},"MM":{"name":"MYANMAR","category":9},"NA":{"name":"NAMIBIE","category":9},"NR":{"name":"NAURU","category":9},"NP":{"name":"NEPAL","category":9},"NI":{"name":"NICARAGUA","category":9},"NE":{"name":"NIGER","category":9},"NG":{"name":"NIGERIA","category":9},"NU":{"name":"NIUE","category":9},"NO":{"name":"NORVEGE","category":9},"NZ":{"name":"NOUVELLE ZELANDE","category":9},"UM":{"name":"OCEANIE AMERICAI","category":9},"CC":{"name":"OCEANIE AUSTRALI","category":9},"CX":{"name":"OCEANIE AUSTRALI","category":9},"HM":{"name":"OCEANIE AUSTRALI","category":9},"NF":{"name":"OCEANIE AUSTRALI","category":9},"OM":{"name":"OMAN","category":9},"UG":{"name":"OUGANDA","category":9},"UZ":{"name":"OUZBEKISTAN","category":9},"PK":{"name":"PAKISTAN","category":9},"PA":{"name":"PANAMA","category":9},"PG":{"name":"PAPOUASIE-NOUVEL","category":9},"PY":{"name":"PARAGUAY","category":9},"NL":{"name":"PAYS-BAS","category":9},"PE":{"name":"PEROU","category":9},"PH":{"name":"PHILIPPINES","category":9},"PN":{"name":"PITCAIRN","category":9},"PL":{"name":"POLOGNE","category":9},"PR":{"name":"PORTO RICO","category":9},"PT":{"name":"PORTUGAL","category":9},"QA":{"name":"QATAR","category":9},"CD":{"name":"R. D. DU CONGO","category":9},"YU":{"name":"R. F. YOUGOSLAVE","category":9},"RO":{"name":"ROUMANIE","category":9},"GB":{"name":"ROYAUME-UNI","category":9},"RU":{"name":"RUSSIE","category":9},"RW":{"name":"RWANDA","category":9},"SM":{"name":"SAINT MARIN","category":9},"SB":{"name":"SALOMON ILES","category":9},"SV":{"name":"SALVADOR LE","category":9},"AS":{"name":"SAMOA AMERICAINE","category":9},"WS":{"name":"SAMOA OCCIDENTAL","category":9},"ST":{"name":"SAO TOME ET PRIN","category":9},"SN":{"name":"SENEGAL","category":9},"RS":{"name":"SERBIE","category":9},"SC":{"name":"SEYCHELLES ET DE","category":9},"SL":{"name":"SIERRA LEONE","category":9},"SG":{"name":"SINGAPOUR","category":9},"SK":{"name":"SLOVAQUIE","category":9},"SI":{"name":"SLOVENIE","category":9},"SO":{"name":"SOMALIE","category":9},"SD":{"name":"SOUDAN","category":9},"LK":{"name":"SRI LANKA","category":9},"KN":{"name":"ST CHRISTOPHE ET","category":9},"VC":{"name":"ST VINCENT","category":9},"SH":{"name":"STE HELENE ET DE","category":9},"LC":{"name":"STE LUCIE","category":9},"SE":{"name":"SUEDE","category":9},"CH":{"name":"SUISSE","category":9},"SR":{"name":"SURINAM","category":9},"SZ":{"name":"SWAZILAND","category":9},"SY":{"name":"SYRIE","category":9},"TJ":{"name":"TADJIKISTAN","category":9},"TW":{"name":"TAIWAN","category":9},"TZ":{"name":"TANZANIE","category":9},"TD":{"name":"TCHAD","category":9},"CZ":{"name":"TCHEQUE REPUBLIQ","category":9},"PS":{"name":"TER. PALESTINIEN","category":9},"IO":{"name":"TERRIT BRIT OC I","category":9},"TH":{"name":"THAILANDE","category":9},"TL":{"name":"TIMOR ORIENTAL","category":9},"TG":{"name":"TOGO","category":9},"TK":{"name":"TOKELAU","category":9},"TO":{"name":"TONGA ILE","category":9},"TT":{"name":"TRINIDAD ET TOBA","category":9},"TN":{"name":"TUNISIE","category":9},"TM":{"name":"TURKMENISTAN","category":9},"TC":{"name":"TURKS ET CAICOS","category":9},"TR":{"name":"TURQUIE","category":9},"TV":{"name":"TUVALU","category":9},"UA":{"name":"UKRAINE","category":9},"UY":{"name":"URUGUAY","category":9},"VU":{"name":"VANUATU","category":9},"VA":{"name":"VATICAN LE","category":9},"VE":{"name":"VENEZUELA","category":9},"VG":{"name":"VIERGES BRITANNI","category":9},"VI":{"name":"VIERGES DES ETAT","category":9},"VN":{"name":"VIETNAM","category":9},"YE":{"name":"YEMEN","category":9},"ZM":{"name":"ZAMBIE","category":9},"ZW":{"name":"ZIMBABWE","category":9}}
@@ -2,7 +2,7 @@ module PortalScraper
2
2
  class Version
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- PATCH = 1
5
+ PATCH = 2
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portal_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Armand Mégrot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2019-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - lib/portal_scraper.rb
105
105
  - lib/portal_scraper/accounts/client.rb
106
+ - lib/portal_scraper/accounts/code_to_country.json
106
107
  - lib/portal_scraper/bad_login_url.rb
107
108
  - lib/portal_scraper/bad_root_url.rb
108
109
  - lib/portal_scraper/portal_scraper_error.rb
@@ -127,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  - !ruby/object:Gem::Version
128
129
  version: '0'
129
130
  requirements: []
130
- rubyforge_project:
131
- rubygems_version: 2.7.8
131
+ rubygems_version: 3.0.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Ruby portal scraper