Class: Channel::Slack::V3

Inherits:
Integration
  • Object
show all
Defined in:
app/models/pager_tree/integrations/channel/slack/v3.rb

Direct Known Subclasses

Mattermost::V3

Constant Summary collapse

OPTIONS =
[
  {key: :incoming_webhook_url, type: :string, default: nil},
  {key: :alert_open, type: :boolean, default: false},
  {key: :alert_acknowledged, type: :boolean, default: false},
  {key: :alert_resolved, type: :boolean, default: false},
  {key: :alert_dropped, type: :boolean, default: false},
  {key: :outgoing_rules, type: :string, default: nil}
]

Instance Method Summary collapse

Instance Method Details

#adapter_outgoing_interest?(event_name) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 44

def adapter_outgoing_interest?(event_name)
  try("option_#{event_name}") || false
end

#adapter_process_outgoingObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 48

def adapter_process_outgoing
  url = adapter_outgoing_event.outgoing_rules_data.dig("webhook_url") || self.option_incoming_webhook_url
  body = _blocks.merge(adapter_outgoing_event.outgoing_rules_data.except("webhook_url"))

  outgoing_webhook_delivery = OutgoingWebhookDelivery.factory(
    resource: self,
    url: url,
    body: body
  )
  outgoing_webhook_delivery.save!
  outgoing_webhook_delivery.deliver_later

  outgoing_webhook_delivery
end

#adapter_show_outgoing_webhook_delivery?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 32

def adapter_show_outgoing_webhook_delivery?
  true
end

#adapter_supports_description_template?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 40

def adapter_supports_description_template?
  false
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 24

def adapter_supports_incoming?
  false
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 28

def adapter_supports_outgoing?
  true
end

#adapter_supports_title_template?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/pager_tree/integrations/channel/slack/v3.rb', line 36

def adapter_supports_title_template?
  false
end