Class: MicrosoftTeamsService

Inherits:
ChatNotificationService show all
Defined in:
app/models/project_services/microsoft_teams_service.rb

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, #event_channel_names, #execute, #fields, #global_fields, #initialize_properties

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_names, event_names, #execute, #fields, find_or_create_templates, find_or_initialize_all, find_or_initialize_integration, #global_fields, #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

.supported_eventsObject


36
37
38
39
# File 'app/models/project_services/microsoft_teams_service.rb', line 36

def self.supported_events
  %w[push issue confidential_issue merge_request note confidential_note tag_push
     pipeline wiki_page]
end

.to_paramObject


12
13
14
# File 'app/models/project_services/microsoft_teams_service.rb', line 12

def self.to_param
  'microsoft_teams'
end

Instance Method Details

#default_channel_placeholderObject


33
34
# File 'app/models/project_services/microsoft_teams_service.rb', line 33

def default_channel_placeholder
end

#default_fieldsObject


41
42
43
44
45
46
47
# File 'app/models/project_services/microsoft_teams_service.rb', line 41

def default_fields
  [
    { type: 'text', name: 'webhook', placeholder: "e.g. #{webhook_placeholder}" },
    { type: 'checkbox', name: 'notify_only_broken_pipelines' },
    { type: 'select', name: 'branches_to_be_notified', choices: branch_choices }
  ]
end

#descriptionObject


8
9
10
# File 'app/models/project_services/microsoft_teams_service.rb', line 8

def description
  'Receive event notifications in Microsoft Teams'
end

#event_field(event) ⇒ Object


30
31
# File 'app/models/project_services/microsoft_teams_service.rb', line 30

def event_field(event)
end

#helpObject


16
17
18
19
20
21
22
23
24
# File 'app/models/project_services/microsoft_teams_service.rb', line 16

def help
  'This service sends notifications about projects events to Microsoft Teams channels.<br />
  To set up this service:
  <ol>
    <li><a href="https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using#setting-up-a-custom-incoming-webhook">Setup a custom Incoming Webhook using Office 365 Connectors For Microsoft Teams</a>.</li>
    <li>Paste the <strong>Webhook URL</strong> into the field below.</li>
    <li>Select events below to enable notifications.</li>
  </ol>'
end

#titleObject


4
5
6
# File 'app/models/project_services/microsoft_teams_service.rb', line 4

def title
  'Microsoft Teams Notification'
end

#webhook_placeholderObject


26
27
28
# File 'app/models/project_services/microsoft_teams_service.rb', line 26

def webhook_placeholder
  'https://outlook.office.com/webhook/…'
end