Class: Ravelin::AuthenticationMechanisms::SmsCode

Inherits:
RavelinObject
  • Object
show all
Defined in:
lib/ravelin/authentication_mechanisms/sms_code.rb

Constant Summary collapse

FAILURE_REASONS =
%w(INVALID_CODE CODE_TIMEOUT INTERNAL_ERROR RATE_LIMIT BANNED_USER AUTHENTICATION_FAILURE)

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.



6
7
8
# File 'lib/ravelin/authentication_mechanisms/sms_code.rb', line 6

def failure_reason
  @failure_reason
end

#phone_numberObject

Returns the value of attribute phone_number.



6
7
8
# File 'lib/ravelin/authentication_mechanisms/sms_code.rb', line 6

def phone_number
  @phone_number
end

#successObject

Returns the value of attribute success.



6
7
8
# File 'lib/ravelin/authentication_mechanisms/sms_code.rb', line 6

def success
  @success
end

Instance Method Details

#validateObject



13
14
15
16
17
18
19
# File 'lib/ravelin/authentication_mechanisms/sms_code.rb', line 13

def validate
  super

  if !success && !FAILURE_REASONS.include?(failure_reason)
    raise ArgumentError.new("Failure reason value must be one of #{FAILURE_REASONS.join(', ')}")
  end
end