Class: Ravelin::AuthenticationMechanisms::Social
- Inherits:
-
RavelinObject
- Object
- RavelinObject
- Ravelin::AuthenticationMechanisms::Social
- Defined in:
- lib/ravelin/authentication_mechanisms/social.rb
Constant Summary collapse
- PROVIDERS =
%w(apple azure facebook google linkedin microsoft okta onelogin ping twitter)
- FAILURE_REASONS =
%w(TIMEOUT UNKNOWN_USERNAME INTERNAL_ERROR RATE_LIMIT SOCIAL_FAILURE BANNED_USER)
Instance Attribute Summary collapse
-
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
-
#social_provider ⇒ Object
Returns the value of attribute social_provider.
-
#success ⇒ Object
Returns the value of attribute success.
Instance Method Summary collapse
Methods inherited from RavelinObject
attr_accessor, attr_required, #initialize, required_attributes, #serializable_hash
Constructor Details
This class inherits a constructor from Ravelin::RavelinObject
Instance Attribute Details
#failure_reason ⇒ Object
Returns the value of attribute failure_reason.
7 8 9 |
# File 'lib/ravelin/authentication_mechanisms/social.rb', line 7 def failure_reason @failure_reason end |
#social_provider ⇒ Object
Returns the value of attribute social_provider.
7 8 9 |
# File 'lib/ravelin/authentication_mechanisms/social.rb', line 7 def @social_provider end |
#success ⇒ Object
Returns the value of attribute success.
7 8 9 |
# File 'lib/ravelin/authentication_mechanisms/social.rb', line 7 def success @success end |
Instance Method Details
#validate ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ravelin/authentication_mechanisms/social.rb', line 18 def validate super if !success && !FAILURE_REASONS.include?(failure_reason) raise ArgumentError.new("Failure reason value must be one of #{FAILURE_REASONS.join(', ')}") end if !PROVIDERS.include?() raise ArgumentError.new("Social provider value must be one of #{PROVIDERS.join(', ')}") end end |