Module: SlackConfiguration

Extended by:
ActiveSupport::Concern
Defined in:
lib/app/models/concerns/slack_configuration.rb

Overview

The Slack Configuration to be used inside of SystemConfiguration

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/app/models/concerns/slack_configuration.rb', line 9

def self.included(base)
  base.class_eval do
    #
    # Fields
    #
    field :slack_api_url, type: String
    field :slack_support_channel, type: String, default: 'support'
    field :slack_sales_channel, type: String, default: 'sales'
    field :slack_notification_ttl, type: Integer, default: 5
    #
    # Validations
    #
    validates :slack_api_url, url: true, allow_blank: true
    validates :slack_support_channel, presence: true
    validates :slack_sales_channel, presence: true
  end
end

Instance Method Details

#slack_configured?Boolean

Determine if Slack is configured

Examples

slack_configured??
# => true || false

Returns:

  • (Boolean)


35
36
37
# File 'lib/app/models/concerns/slack_configuration.rb', line 35

def slack_configured?
  [slack_api_url.present?, slack_support_channel.present?, slack_sales_channel.present?].all?
end