Class: Slack::Webhook::V3

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

Constant Summary collapse

OPTIONS =
[
  {key: :token, type: :string, default: nil}
]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



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

def adapter_action
  :create
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


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

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



35
36
37
38
39
40
41
42
43
# File 'app/models/pager_tree/integrations/slack/webhook/v3.rb', line 35

def adapter_process_create
  Alert.new(
    title: _title,
    urgency: _urgency,
    thirdparty_id: adapter_thirdparty_id,
    dedup_keys: [],
    additional_data: _additional_datums
  )
end

#adapter_should_block_incoming?(request) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/pager_tree/integrations/slack/webhook/v3.rb', line 11

def adapter_should_block_incoming?(request)
  option_token.present? && (request.params["token"] != option_token)
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/pager_tree/integrations/slack/webhook/v3.rb', line 15

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/models/pager_tree/integrations/slack/webhook/v3.rb', line 19

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



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

def adapter_thirdparty_id
  [adapter_incoming_request_params.dig("channel_id"), adapter_incoming_request_params.dig("timestamp")].join(".")
end