Class: Pingdom::V3

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

Constant Summary collapse

OPTIONS =
[]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 25

def adapter_action
  previous_state = adapter_incoming_request_params.dig("previous_state")
  current_state = adapter_incoming_request_params.dig("current_state")

  if (previous_state == "UP" && current_state == "DOWN") || (previous_state == "SUCCESS" && current_state == "FAILING")
    :create
  elsif (previous_state == "DOWN" && current_state == "UP") || (previous_state == "FAILING" && current_state == "SUCCESS")
    :resolve
  else
    :other
  end
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 17

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



38
39
40
41
42
43
44
45
46
47
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 38

def adapter_process_create
  Alert.new(
    title: _title,
    description: _description,
    thirdparty_id: adapter_thirdparty_id,
    dedup_keys: [],
    additional_data: _additional_datums,
    tags: _tags
  )
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 9

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 13

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



21
22
23
# File 'app/models/pager_tree/integrations/pingdom/v3.rb', line 21

def adapter_thirdparty_id
  adapter_incoming_request_params.dig("check_id")
end