Class: Honeybadger::V3
- Inherits:
-
Integration
- Object
- Integration
- Honeybadger::V3
- Defined in:
- app/models/pager_tree/integrations/honeybadger/v3.rb
Constant Summary collapse
- OPTIONS =
[ # only used if they set this up as a "webhook" from honeybadger, the native PT integration doesn't have the token option {key: :token, type: :string, default: nil} ]
Instance Method Summary collapse
- #adapter_action ⇒ Object
- #adapter_incoming_can_defer? ⇒ Boolean
- #adapter_process_create ⇒ Object
- #adapter_should_block_incoming?(request) ⇒ Boolean
- #adapter_supports_incoming? ⇒ Boolean
- #adapter_supports_outgoing? ⇒ Boolean
- #adapter_thirdparty_id ⇒ Object
Instance Method Details
#adapter_action ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 33 def adapter_action event = adapter_incoming_request_params.dig("event").to_s.downcase case event when "occurred", "down", "check_in_missing" :create when "resolved", "up", "check_in_reporting" :resolve else :other end end |
#adapter_incoming_can_defer? ⇒ Boolean
25 26 27 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 25 def adapter_incoming_can_defer? true end |
#adapter_process_create ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 45 def adapter_process_create Alert.new( title: _title, thirdparty_id: adapter_thirdparty_id, dedup_keys: [], additional_data: _additional_datums, tags: ) end |
#adapter_should_block_incoming?(request) ⇒ Boolean
13 14 15 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 13 def adapter_should_block_incoming?(request) self.option_token.present? && (request.headers["honeybadger-token"] != self.option_token) end |
#adapter_supports_incoming? ⇒ Boolean
17 18 19 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 17 def adapter_supports_incoming? true end |
#adapter_supports_outgoing? ⇒ Boolean
21 22 23 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 21 def adapter_supports_outgoing? false end |
#adapter_thirdparty_id ⇒ Object
29 30 31 |
# File 'app/models/pager_tree/integrations/honeybadger/v3.rb', line 29 def adapter_thirdparty_id adapter_incoming_request_params.dig("fault", "url") || adapter_incoming_request_params.dig("outage", "details_url") || adapter_incoming_request_params.dig("check_in", "details_url") end |