Class: Integrations::ChatMessage::AlertMessage
- Inherits:
-
BaseMessage
- Object
- BaseMessage
- Integrations::ChatMessage::AlertMessage
- Defined in:
- app/models/integrations/chat_message/alert_message.rb
Constant Summary
Constants inherited from BaseMessage
BaseMessage::RELATIVE_LINK_REGEX
Instance Attribute Summary collapse
-
#alert_url ⇒ Object
readonly
Returns the value of attribute alert_url.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from BaseMessage
#markdown, #project_name, #project_url, #user_avatar, #user_full_name, #user_name
Instance Method Summary collapse
- #attachment_color ⇒ Object
- #attachments ⇒ Object
-
#initialize(params) ⇒ AlertMessage
constructor
A new instance of AlertMessage.
- #message ⇒ Object
Methods inherited from BaseMessage
#activity, #fallback, #pretext, #summary, #user_combined_name
Constructor Details
#initialize(params) ⇒ AlertMessage
Returns a new instance of AlertMessage.
13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 13 def initialize(params) @project_name = params[:project_name] || params.dig(:project, :path_with_namespace) @project_url = params.dig(:project, :web_url) || params[:project_url] @title = params.dig(:object_attributes, :title) @alert_url = params.dig(:object_attributes, :url) @severity = params.dig(:object_attributes, :severity) @events = params.dig(:object_attributes, :events) @status = params.dig(:object_attributes, :status) @started_at = params.dig(:object_attributes, :started_at) end |
Instance Attribute Details
#alert_url ⇒ Object (readonly)
Returns the value of attribute alert_url.
7 8 9 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 7 def alert_url @alert_url end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
9 10 11 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 9 def events @events end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
8 9 10 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 8 def severity @severity end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
11 12 13 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 11 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 10 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 6 def title @title end |
Instance Method Details
#attachment_color ⇒ Object
37 38 39 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 37 def "#C95823" end |
#attachments ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 24 def [{ title: strip_markup(title), title_link: alert_url, color: , fields: }] end |
#message ⇒ Object
33 34 35 |
# File 'app/models/integrations/chat_message/alert_message.rb', line 33 def "Alert firing in #{strip_markup(project_name)}" end |