Class: Integrations::ChatMessage::MergeMessage
- Inherits:
-
BaseMessage
- Object
- BaseMessage
- Integrations::ChatMessage::MergeMessage
- Defined in:
- app/models/integrations/chat_message/merge_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.
-
#merge_request_iid ⇒ Object
readonly
Returns the value of attribute merge_request_iid.
-
#source_branch ⇒ Object
readonly
Returns the value of attribute source_branch.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#target_branch ⇒ Object
readonly
Returns the value of attribute target_branch.
-
#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) ⇒ MergeMessage
constructor
A new instance of MergeMessage.
Methods inherited from BaseMessage
#fallback, #pretext, #summary, #user_combined_name
Constructor Details
#initialize(params) ⇒ MergeMessage
Returns a new instance of MergeMessage.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 13 def initialize(params) super obj_attr = params[:object_attributes] obj_attr = HashWithIndifferentAccess.new(obj_attr) @merge_request_iid = obj_attr[:iid] @source_branch = obj_attr[:source_branch] @target_branch = obj_attr[:target_branch] @action = obj_attr[:action] @state = obj_attr[:state] @title = format_title(obj_attr[:title]) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 9 def action @action end |
#merge_request_iid ⇒ Object (readonly)
Returns the value of attribute merge_request_iid.
6 7 8 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 6 def merge_request_iid @merge_request_iid end |
#source_branch ⇒ Object (readonly)
Returns the value of attribute source_branch.
7 8 9 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 7 def source_branch @source_branch end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 10 def state @state end |
#target_branch ⇒ Object (readonly)
Returns the value of attribute target_branch.
8 9 10 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 8 def target_branch @target_branch end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
11 12 13 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 11 def title @title end |
Instance Method Details
#activity ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 30 def activity { title: "Merge request #{state_or_action_text} by #{strip_markup(user_combined_name)}", subtitle: "in #{project_link}", text: merge_request_link, image: user_avatar } end |
#attachments ⇒ Object
26 27 28 |
# File 'app/models/integrations/chat_message/merge_message.rb', line 26 def [] end |