AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Module: Aws::Rails

Defined in:
lib/aws-sdk-rails.rb,
lib/aws/rails/mailer.rb

Overview

Use the Rails namespace.

Defined Under Namespace

Classes: Mailer

Class Method Summary collapse

Class Method Details

.add_action_mailer_delivery_method(name = :ses, options = {}) ⇒ Object

This is called automatically from the SDK's Railtie, but can be manually called if you want to specify options for building the Aws::SES::Client.

Parameters:

  • name (Symbol) (defaults to: :ses)

    The name of the ActionMailer delivery method to register.

  • options (Hash) (defaults to: {})

    The options you wish to pass on to the Aws::SES::Client initialization method.



26
27
28
29
30
# File 'lib/aws-sdk-rails.rb', line 26

def self.add_action_mailer_delivery_method(name = :ses, options = {})
  ActiveSupport.on_load(:action_mailer) do
    add_delivery_method(name, Aws::Rails::Mailer, options)
  end
end

.log_to_rails_loggerObject

Configures the AWS SDK for Ruby's logger to use the Rails logger.



33
34
35
36
# File 'lib/aws-sdk-rails.rb', line 33

def self.log_to_rails_logger
  Aws.config[:logger] = ::Rails.logger
  nil
end

.use_rails_encrypted_credentialsObject

Configures the AWS SDK with credentials from Rails encrypted credentials.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/aws-sdk-rails.rb', line 39

def self.use_rails_encrypted_credentials
  # limit the config keys we merge to credentials only
  aws_credential_keys = %i[access_key_id secret_access_key session_token]

  Aws.config.merge!(
    ::Rails.application
      .try(:credentials)
      .try(:aws)
      .to_h.slice(*aws_credential_keys)
  )
end