twitter_worker.rb 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. class LinkedinWorker
  2. include Sidekiq::Worker
  3. sidekiq_options :retry => false, :backtrace => true
  4. def perform(id)
  5. record = SocialLead.find(id)
  6. if record
  7. profile = Linkedin::Profile.new(record.profile_url) # , { company_details: true, open_timeout: 30, proxy_ip: '127.0.0.1', proxy_port: '3128', username: 'user', password: 'pass' })
  8. if profile
  9. record.first_name = profile.first_name # The first name of the contact
  10. record.last_name = profile.last_name # The last name of the contact
  11. record.description = profile.summary # The summary of the profile
  12. record.location = profile.location # The location of the contact
  13. record.country = profile.country # The country of the contact
  14. record.image_url = profile.picture # The profile picture link of profile
  15. record.name = profile.name
  16. # record.title = profile.title # The full name of the profile
  17. # record.industry = profile.industry # The domain for which the contact belongs
  18. # record.skills = profile.skills.to_s # Array of skills of the profile
  19. # record.organization = profile.organizations.to_s # Array organizations of the profile
  20. # record.education = profile.education.to_s # Array of hashes for education
  21. # record.websites = profile.websites.to_s # Array of websites
  22. # record.interests = profile.groups.to_s # Array of groups
  23. # record.followers = profile.number_of_connections # The number of connections as a string
  24. record.save
  25. end
  26. end
  27. end
  28. end