cirandas.net

ref: master

app/jobs/get_email_contacts_job.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class GetEmailContactsJob < Struct.new(:import_from, :login, :password, :contact_list_id)
  def perform
    begin
      Invitation.get_contacts(import_from, login, password, contact_list_id)
    rescue Contacts::AuthenticationError => ex
      ContactList.exists?(contact_list_id) && ContactList.find(contact_list_id).register_auth_error
    rescue Exception => ex
      ContactList.exists?(contact_list_id) && ContactList.find(contact_list_id).register_error
    end
  end
end