Sha256: 534788976120fbf12388e7d4377efa5a376b6007cb2af74b9f520d245ab6b0a5

Contents?: true

Size: 860 Bytes

Versions: 1

Compression:

Stored size: 860 Bytes

Contents

module Gossiper
  class EmailConfig
    attr_reader :notification, :user

    def initialize(notification)
      @notification = notification
      @user         = notification.user
    end

    def to
      if user.respond_to?(:name)
        ["#{user.name} <#{user.email}>"]
      else
        [user.email]
      end
    end

    # TODO: Make configuration for default bcc
    def bcc
      []
    end

    # TODO: Make configuration for default from
    def from
    end

    # TODO: Make configuration for default cc
    def cc
      []
    end

    def template_name
      "#{notification.kind}_notification"
    end

    def template_path
      'notifications'
    end

    def subject
      I18n.t("gossiper.notifications.#{notification.kind}.subject")
    end

    def attachments
      {}
    end

    def instance_variables
      {}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gossiper-0.1.0 lib/gossiper/email_config.rb