Class: NimbleAuth::OmniauthAuthenticationService
- Inherits:
-
Object
- Object
- NimbleAuth::OmniauthAuthenticationService
- Defined in:
- app/services/nimble_auth/omniauth_authentication_service.rb
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#oauth ⇒ Object
readonly
Returns the value of attribute oauth.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(oauth) ⇒ OmniauthAuthenticationService
constructor
A new instance of OmniauthAuthenticationService.
Constructor Details
#initialize(oauth) ⇒ OmniauthAuthenticationService
Returns a new instance of OmniauthAuthenticationService.
8 9 10 11 |
# File 'app/services/nimble_auth/omniauth_authentication_service.rb', line 8 def initialize(oauth) @oauth = oauth @identity = resource_identity_klass.includes(:user).find_by(uid: oauth[:uid], provider: oauth[:provider]) end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
6 7 8 |
# File 'app/services/nimble_auth/omniauth_authentication_service.rb', line 6 def identity @identity end |
#oauth ⇒ Object (readonly)
Returns the value of attribute oauth.
6 7 8 |
# File 'app/services/nimble_auth/omniauth_authentication_service.rb', line 6 def oauth @oauth end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/services/nimble_auth/omniauth_authentication_service.rb', line 13 def call return signin_strategy if identity.present? signup_strategy rescue ActiveRecord::RecordInvalid => error respond_with(message: error., status: :error) end |