Guest User

Untitled

a guest
Feb 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. class ContactsController < ApplicationController
  2.  
  3. before_filter :get_email
  4. before_filter :get_emails
  5. before_filter :get_client
  6.  
  7. private #-------------------------------------------------------
  8.  
  9. def get_email
  10. @email = Email.find(params[:email_id]) if params[:email_id]
  11. end
  12.  
  13. def get_emails
  14. @emails = Email.where('account_id=?', current_account.id)
  15. end
  16.  
  17. def get_client
  18. @client = GData::Client::Contacts.new
  19. if @email && !@email.auth_token.blank?
  20. @client.authsub_token = @email.auth_token
  21. else
  22. session[:client] = @client
  23. @client.authsub_token = params[:token]
  24. session[:token] = @client.auth_handler.upgrade
  25. @client.authsub_token = session[:token]
  26. end
  27. end
  28.  
  29. end
Add Comment
Please, Sign In to add comment