Class: SlackService::MergeMessage

Inherits:
BaseMessage show all
Defined in:
app/models/project_services/slack_service/merge_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseMessage

#fallback

Constructor Details

#initialize(params) ⇒ MergeMessage

Returns a new instance of MergeMessage


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/project_services/slack_service/merge_message.rb', line 12

def initialize(params)
  @user_name = params[:user][:name]
  @project_name = params[:project_name]
  @project_url = params[:project_url]

  obj_attr = params[:object_attributes]
  obj_attr = HashWithIndifferentAccess.new(obj_attr)
  @merge_request_id = obj_attr[:iid]
  @source_branch = obj_attr[:source_branch]
  @target_branch = obj_attr[:target_branch]
  @state = obj_attr[:state]
  @title = format_title(obj_attr[:title])
end

Instance Attribute Details

#merge_request_idObject (readonly)

Returns the value of attribute merge_request_id


6
7
8
# File 'app/models/project_services/slack_service/merge_message.rb', line 6

def merge_request_id
  @merge_request_id
end

#project_nameObject (readonly)

Returns the value of attribute project_name


4
5
6
# File 'app/models/project_services/slack_service/merge_message.rb', line 4

def project_name
  @project_name
end

#project_urlObject (readonly)

Returns the value of attribute project_url


5
6
7
# File 'app/models/project_services/slack_service/merge_message.rb', line 5

def project_url
  @project_url
end

#source_branchObject (readonly)

Returns the value of attribute source_branch


7
8
9
# File 'app/models/project_services/slack_service/merge_message.rb', line 7

def source_branch
  @source_branch
end

#stateObject (readonly)

Returns the value of attribute state


9
10
11
# File 'app/models/project_services/slack_service/merge_message.rb', line 9

def state
  @state
end

#target_branchObject (readonly)

Returns the value of attribute target_branch


8
9
10
# File 'app/models/project_services/slack_service/merge_message.rb', line 8

def target_branch
  @target_branch
end

#titleObject (readonly)

Returns the value of attribute title


10
11
12
# File 'app/models/project_services/slack_service/merge_message.rb', line 10

def title
  @title
end

#user_nameObject (readonly)

Returns the value of attribute user_name


3
4
5
# File 'app/models/project_services/slack_service/merge_message.rb', line 3

def user_name
  @user_name
end

Instance Method Details

#attachmentsObject


30
31
32
# File 'app/models/project_services/slack_service/merge_message.rb', line 30

def attachments
  []
end

#pretextObject


26
27
28
# File 'app/models/project_services/slack_service/merge_message.rb', line 26

def pretext
  format(message)
end