Class: Ravelin::AuthenticationMechanisms::Social

Inherits:
RavelinObject show all
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

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_reasonObject

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_providerObject

Returns the value of attribute social_provider.



7
8
9
# File 'lib/ravelin/authentication_mechanisms/social.rb', line 7

def social_provider
  @social_provider
end

#successObject

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

#validateObject



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?(social_provider)
    raise ArgumentError.new("Social provider value must be one of #{PROVIDERS.join(', ')}")
  end
end