Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NotiAuthorisationsController < ApplicationController
- def new
- token = Noti::Token.create_request_token(noti_callback_url)
- session[:noti_rt] = token.request_token
- redirect_to token.redirect_url
- end
- def create
- token = Noti::Token.get_access_token(session[:noti_rt])
- current_hospital_admin.update_attribute(:noti_token, token)
- session[:noti_rt] = nil
- redirect_to root_path, :flash =>{:ok=>"Noti has now been configured for your account!"}
- end
- end
- get '/noti' => 'noti_authorisations#new', :as => 'setup_noti'
- get 'noti/callback' => 'noti_authorisations#create', :as => 'noti_callback'
- notification = Noti::Notification.new
- notification.title = "An example notification"
- notification.text = "Some further information about this notification"
- notification.deliver_to(user.noti_token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement