Class: UptimeRobot::V3
- Inherits:
-
Integration
- Object
- Integration
- UptimeRobot::V3
- Defined in:
- app/models/pager_tree/integrations/uptime_robot/v3.rb
Constant Summary collapse
- OPTIONS =
[]
Instance Method Summary collapse
- #adapter_action ⇒ Object
- #adapter_incoming_can_defer? ⇒ Boolean
- #adapter_process_create ⇒ Object
- #adapter_supports_incoming? ⇒ Boolean
- #adapter_supports_outgoing? ⇒ Boolean
- #adapter_thirdparty_id ⇒ Object
-
#endpoint ⇒ Object
SPECIAL: override integration endpoint with the get endpoint and the query string starter uptime robot doesn't handle this, so we have to do it ourselves.
Instance Method Details
#adapter_action ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 43 def adapter_action case adapter_incoming_request_params.dig("alertTypeFriendlyName").to_s.downcase when "down" :create when "up" :resolve else :other end end |
#adapter_incoming_can_defer? ⇒ Boolean
23 24 25 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 23 def adapter_incoming_can_defer? true end |
#adapter_process_create ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 54 def adapter_process_create Alert.new( title: _title, description: _description, thirdparty_id: adapter_thirdparty_id, dedup_keys: [], additional_data: _additional_datums ) end |
#adapter_supports_incoming? ⇒ Boolean
15 16 17 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 15 def adapter_supports_incoming? true end |
#adapter_supports_outgoing? ⇒ Boolean
19 20 21 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 19 def adapter_supports_outgoing? false end |
#adapter_thirdparty_id ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 27 def adapter_thirdparty_id monitor_id = adapter_incoming_request_params.dig("monitorID") # LEGACY: We offerred the ability to aggregate for one of our customers # we did this through a groupSeconds parameter. Technically, with our new aggregration # this shouldn't be here, but to support our legacy customers it is. group_seconds = adapter_incoming_request_params.dig("groupSeconds").to_i return monitor_id unless group_seconds > 0 alert_datetime = Time.at(adapter_incoming_request_params.dig("alertDateTime").to_i) # return the rounded off time as the id (as so to group them together by id) _round_off(alert_datetime, group_seconds.seconds).to_i end |
#endpoint ⇒ Object
SPECIAL: override integration endpoint with the get endpoint and the query string starter uptime robot doesn't handle this, so we have to do it ourselves
11 12 13 |
# File 'app/models/pager_tree/integrations/uptime_robot/v3.rb', line 11 def endpoint super + "/g?" end |