class Ravelin::AuthenticationMechanisms::MagicLink
Constants
- FAILURE_REASONS
- TRANSPORTATION_MECHANISM
Attributes
email[RW]
failure_reason[RW]
phone_number[RW]
success[RW]
transport[RW]
Public Instance Methods
failure_reason=(reason)
click to toggle source
# File lib/ravelin/authentication_mechanisms/magic_link.rb, line 10 def failure_reason=(reason) @failure_reason = reason.to_s.upcase end
validate()
click to toggle source
Calls superclass method
# File lib/ravelin/authentication_mechanisms/magic_link.rb, line 14 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 !TRANSPORTATION_MECHANISM.include?(transport) raise ArgumentError.new("Transportation mechanism value must be one of #{TRANSPORTATION_MECHANISM.join(', ')}") end if transport == 'email' && email.nil? raise ArgumentError.new("email must be present for email transportation mechanism") end if transport == 'sms' && phone_number.nil? raise ArgumentError.new("phone_number must be present for sms transportation mechanism") end end