Class: LbcApi::User

Inherits:
Object
  • Object
show all
Defined in:
lib/lbc_api/user.rb

Class Method Summary collapse

Class Method Details

.create(email, password, data) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lbc_api/user.rb', line 3

def self.create(email, password, data)
  page = Agent.mecha.get('https://compteperso.leboncoin.fr/account/index.html')
  page = page.form_with(id: 'createform') do |f|
    f['username_create'] = email
  end.submit
  params = Sanitize.params(data)
  page.form_with(id: 'account_create') do |f|
    params.each do |k, v|
      f[k] = v
    end
    f['st_passwd'] = password
    f['verify_passwd'] = password
    f.checkbox_with('cgv').check
  end.submit
end