Sha256: dda4b9651152474acfab214ad2c62e9e8031f930dd32f27bfee3c52ac508dccf

Contents?: true

Size: 683 Bytes

Versions: 12

Compression:

Stored size: 683 Bytes

Contents

module MnoEnterprise
  # Abstract the email sending logic
  #
  class MailClient
    cattr_reader(:adapter)

    # Specify the mail adapter. The default email adapter is the :mandrill adapter.
    def self.adapter=(name_or_adapter)
      @@adapter = \
        case name_or_adapter
        when Symbol, String
          load_adapter(name_or_adapter)
        else
          name_or_adapter if name_or_adapter.respond_to?(:deliver)
        end
    end

    # @see Adapter#deliver
    def self.deliver(*args)
      adapter.deliver(*args)
    end

    private
    def self.load_adapter(name)
      "MnoEnterprise::MailAdapters::#{name.to_s.camelize}Adapter".constantize
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mno-enterprise-core-3.4.0 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.3.3 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.3.2 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.2.1 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.3.1 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.3.0 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.2.0 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.1.4 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.1.3 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.1.2 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.1.1 lib/mno_enterprise/mail_client.rb
mno-enterprise-core-3.1.0 lib/mno_enterprise/mail_client.rb