Class: SlackService

Inherits:
ChatNotificationService show all
Includes:
Notifier
Defined in:
app/models/project_services/slack_service.rb

Defined Under Namespace

Modules: Notifier

Constant Summary

Constants inherited from ChatNotificationService

ChatNotificationService::EVENT_CHANNEL, ChatNotificationService::SUPPORTED_EVENTS

Constants inherited from Service

Service::DEV_SERVICE_NAMES, Service::SERVICE_NAMES

Instance Attribute Summary

Attributes included from Importable

#imported, #importing

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ChatNotificationService

#confidential_issue_channel, #confidential_note_channel, #default_fields, #event_channel_names, #event_field, #execute, #fields, #global_fields, #initialize_properties, supported_events

Methods included from NotificationBranchSelection

#branch_choices, #notify_for_branch?

Methods inherited from Service

#activated?, #api_field_names, #async_execute, available_services_names, available_services_types, boolean_accessor, build_from_integration, #can_test?, #category, #configurable_event_actions, #configurable_events, default_integration, dev_services_names, #editable?, #event_channel_names, event_description, #event_field, event_names, #event_names, #execute, #fields, find_or_create_templates, find_or_initialize_all, find_or_initialize_integration, #global_fields, #help, #initialize_properties, instance_exists_for?, #issue_tracker?, #json_fields, #operating?, prop_accessor, #reset_updated_properties, services_names, services_types, #show_active_box?, supported_event_actions, supported_events, #supports_data_fields?, #test, #to_data_fields_hash, #to_param, #to_service_hash, #updated_properties

Methods included from ProjectServicesLoggable

#build_message, #log_error, #log_info, #logger

Methods inherited from ApplicationRecord

at_most, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, underscore, without_order

Class Method Details

.to_paramObject


14
15
16
# File 'app/models/project_services/slack_service.rb', line 14

def self.to_param
  'slack'
end

Instance Method Details

#default_channel_placeholderObject


18
19
20
# File 'app/models/project_services/slack_service.rb', line 18

def default_channel_placeholder
  _('Slack channels (e.g. general, development)')
end

#descriptionObject


10
11
12
# File 'app/models/project_services/slack_service.rb', line 10

def description
  'Receive event notifications in Slack'
end

#get_message(object_kind, data) ⇒ Object


33
34
35
36
37
# File 'app/models/project_services/slack_service.rb', line 33

def get_message(object_kind, data)
  return ChatMessage::AlertMessage.new(data) if object_kind == 'alert'

  super
end

#supported_eventsObject


26
27
28
29
30
31
# File 'app/models/project_services/slack_service.rb', line 26

def supported_events
  additional = []
  additional << 'alert'

  super + additional
end

#titleObject


6
7
8
# File 'app/models/project_services/slack_service.rb', line 6

def title
  'Slack notifications'
end

#webhook_placeholderObject


22
23
24
# File 'app/models/project_services/slack_service.rb', line 22

def webhook_placeholder
  'https://hooks.slack.com/services/…'
end