Class: Integrations::ChatMessage::IssueMessage
- Inherits:
-
BaseMessage
- Object
- BaseMessage
- Integrations::ChatMessage::IssueMessage
- Defined in:
- app/models/integrations/chat_message/issue_message.rb
Constant Summary
Constants inherited from BaseMessage
BaseMessage::RELATIVE_LINK_REGEX
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#issue_iid ⇒ Object
readonly
Returns the value of attribute issue_iid.
-
#issue_url ⇒ Object
readonly
Returns the value of attribute issue_url.
-
#object_kind ⇒ Object
readonly
Returns the value of attribute object_kind.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#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
- #activity ⇒ Object
- #attachments ⇒ Object
-
#initialize(params) ⇒ IssueMessage
constructor
A new instance of IssueMessage.
Methods inherited from BaseMessage
#fallback, #pretext, #summary, #user_combined_name
Constructor Details
#initialize(params) ⇒ IssueMessage
Returns a new instance of IssueMessage.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 14 def initialize(params) super obj_attr = params[:object_attributes] obj_attr = HashWithIndifferentAccess.new(obj_attr) @title = obj_attr[:title] @issue_iid = obj_attr[:iid] @issue_url = obj_attr[:url] @action = obj_attr[:action] @state = obj_attr[:state] @description = obj_attr[:description] || '' @object_kind = params[:object_kind] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 9 def action @action end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
11 12 13 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 11 def description @description end |
#issue_iid ⇒ Object (readonly)
Returns the value of attribute issue_iid.
7 8 9 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 7 def issue_iid @issue_iid end |
#issue_url ⇒ Object (readonly)
Returns the value of attribute issue_url.
8 9 10 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 8 def issue_url @issue_url end |
#object_kind ⇒ Object (readonly)
Returns the value of attribute object_kind.
12 13 14 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 12 def object_kind @object_kind end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 10 def state @state end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 6 def title @title end |
Instance Method Details
#activity ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 35 def activity { title: "#{issue_type} #{state} by #{strip_markup(user_combined_name)}", subtitle: "in #{project_link}", text: issue_link, image: user_avatar } end |
#attachments ⇒ Object
28 29 30 31 32 33 |
# File 'app/models/integrations/chat_message/issue_message.rb', line 28 def return [] unless opened_issue? return SlackMarkdownSanitizer.sanitize_slack_link(description) if markdown end |