Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. class NotiAuthorisationsController < ApplicationController
  2.  
  3. def new
  4. token = Noti::Token.create_request_token(noti_callback_url)
  5. session[:noti_rt] = token.request_token
  6. redirect_to token.redirect_url
  7. end
  8.  
  9. def create
  10. token = Noti::Token.get_access_token(session[:noti_rt])
  11. current_hospital_admin.update_attribute(:noti_token, token)
  12. session[:noti_rt] = nil
  13. redirect_to root_path, :flash =>{:ok=>"Noti has now been configured for your account!"}
  14. end
  15.  
  16. end
  17.  
  18. get '/noti' => 'noti_authorisations#new', :as => 'setup_noti'
  19. get 'noti/callback' => 'noti_authorisations#create', :as => 'noti_callback'
  20.  
  21. notification = Noti::Notification.new
  22. notification.title = "An example notification"
  23. notification.text = "Some further information about this notification"
  24. notification.deliver_to(user.noti_token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement