class TwoFactorDevices::EmailGatewayGenerator

Generator for simple email gateway integration to project

  1. Adds mailer class with associated template

  2. Create gateway class, that uses mailer for otp code transmission

Public Instance Methods

copy_templates() click to toggle source
# File lib/generators/two_factor_devices/email_gateway_generator.rb, line 14
def copy_templates
  copy_file 'otp_email.html.erb',
            File.join('app', 'views', 'two_factor_device_authentication', 'otp_email.html.erb')
end
create_gateway() click to toggle source
# File lib/generators/two_factor_devices/email_gateway_generator.rb, line 19
def create_gateway
  template 'email_gateway.rb', File.join('lib', 'two_factor_devices', 'gateways', 'email.rb')
end
create_mailer() click to toggle source
# File lib/generators/two_factor_devices/email_gateway_generator.rb, line 10
def create_mailer
  template 'otp_mailer.rb', File.join('app', 'mailers', class_path, "#{file_name}_mailer.rb")
end

Private Instance Methods

file_name() click to toggle source
Calls superclass method
# File lib/generators/two_factor_devices/email_gateway_generator.rb, line 25
def file_name
  super.sub(/_mailer\z/i, '')
end