Module: Devise::Models::G5Authenticatable::ClassMethods
- Defined in:
- lib/devise_g5_authenticatable/models/g5_authenticatable.rb
Instance Method Summary collapse
- #find_and_update_for_g5_oauth(oauth_data) ⇒ Object
- #find_for_g5_oauth(oauth_data) ⇒ Object
- #new_with_session(params, session) ⇒ Object
Instance Method Details
#find_and_update_for_g5_oauth(oauth_data) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/devise_g5_authenticatable/models/g5_authenticatable.rb', line 78 def find_and_update_for_g5_oauth(oauth_data) resource = find_for_g5_oauth(oauth_data) if resource resource.update_g5_credentials(oauth_data) resource.save! end resource end |
#find_for_g5_oauth(oauth_data) ⇒ Object
74 75 76 |
# File 'lib/devise_g5_authenticatable/models/g5_authenticatable.rb', line 74 def find_for_g5_oauth(oauth_data) find_by_provider_and_uid(oauth_data.provider.to_s, oauth_data.uid.to_s) end |
#new_with_session(params, session) ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/devise_g5_authenticatable/models/g5_authenticatable.rb', line 87 def new_with_session(params, session) defaults = ActiveSupport::HashWithIndifferentAccess.new if auth_data = session && session['omniauth.auth'] defaults[:email] = auth_data.info.email defaults[:provider] = auth_data.provider defaults[:uid] = auth_data.uid end new(defaults.merge(params)) end |