Class: Gemgento::Adapter::Sellect::Customer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/gemgento/adapter/sellect/customer.rb

Class Method Summary collapse

Class Method Details

.importObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/gemgento/adapter/sellect/customer.rb', line 5

def self.import
  self.table_name = 'sellect_users'

  stores = Gemgento::Store.all

  self.all.each do |sellect_user|
    user = Gemgento::User.find_or_initialize_by(email: sellect_user.email)
    user.email = sellect_user.email
    user.first_name = sellect_user.first_name
    user.last_name = sellect_user.last_name
    user.dob = sellect_user.bday
    user.encrypted_password = sellect_user.encrypted_password
    user.magento_password = (0...8).map { (65 + rand(26)).chr }.join
    user. = sellect_user.
    user. = sellect_user.
    user. = sellect_user.
    user. = sellect_user.
    user. = sellect_user.
    user.user_group = Gemgento::UserGroup.find_by(code: 'General')
    user.sync_needed = false
    user.save(validate: false)

    user.stores = stores

    user.sync_needed = true
    user.save(validate: false)
  end
end