module TwoFactorDevices
mail module
Constants
- DEVICE_TYPES
- EMAIL_TYPE
- PHONE_TYPE
- VERSION
Public Class Methods
available_types()
click to toggle source
# File lib/two_factor_devices.rb, line 44 def self.available_types DEVICE_TYPES.keys.select { |k| gateway(k).present? } end
configure() { |configuration| ... }
click to toggle source
Pre configuration for gateway definition
# File lib/two_factor_devices.rb, line 35 def self.configure yield configuration end
device_manager()
click to toggle source
# File lib/two_factor_devices.rb, line 54 def self.device_manager @device_manager ||= Devices::Manager.new end
device_owner_class_name()
click to toggle source
# File lib/two_factor_devices.rb, line 58 def self.device_owner_class_name raise Error, 'TwoFactorDevice owner not configured. Please set TwoFactorDevices.device_owner.' if device_owner.nil? device_owner.to_s end
gateway(device_type)
click to toggle source
# File lib/two_factor_devices.rb, line 48 def self.gateway(device_type) raise ArgumentError, "Unknown device type: #{device_type}." unless DEVICE_TYPES.key?(device_type) public_send("#{device_type}_gateway") end
Private Class Methods
configuration()
click to toggle source
Returns an existing or instantiates a new configuration object.
# File lib/two_factor_devices.rb, line 40 def self.configuration @configuration ||= Configuration.new end