Class: StatusGator::V3

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

Constant Summary collapse

OPTIONS =
[
  {key: :create_on_warn, type: :boolean, default: true},
  {key: :create_on_maintenance, type: :boolean, default: true}
]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/pager_tree/integrations/status_gator/v3.rb', line 28

def adapter_action
  state = adapter_incoming_request_params.dig("status")
  if state == "down"
    :create
  elsif state == "up"
    :resolve
  elsif state == "maintenance" && option_create_on_maintenance == true
    :create
  elsif state == "warn" && option_create_on_warn == true
    :create
  else
    :other
  end
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/models/pager_tree/integrations/status_gator/v3.rb', line 20

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



43
44
45
46
47
48
49
50
# File 'app/models/pager_tree/integrations/status_gator/v3.rb', line 43

def adapter_process_create
  Alert.new(
    title: _title,
    description: _description,
    thirdparty_id: adapter_thirdparty_id,
    additional_data: _additional_datums
  )
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/pager_tree/integrations/status_gator/v3.rb', line 12

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/pager_tree/integrations/status_gator/v3.rb', line 16

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



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

def adapter_thirdparty_id
  adapter_incoming_request_params.dig("monitor", "id")
end