Class: SlackService::BuildMessage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params, commit = true) ⇒ BuildMessage

Returns a new instance of BuildMessage


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

def initialize(params, commit = true)
  @sha = params[:sha]
  @ref_type = params[:tag] ? 'tag' : 'branch'
  @ref = params[:ref]
  @project_name = params[:project_name]
  @project_url = params[:project_url]
  @status = params[:commit][:status]
  @user_name = params[:commit][:author_name]
  @duration = params[:commit][:duration]
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration


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

def duration
  @duration
end

#project_nameObject (readonly)

Returns the value of attribute project_name


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

def project_name
  @project_name
end

#project_urlObject (readonly)

Returns the value of attribute project_url


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

def project_url
  @project_url
end

#refObject (readonly)

Returns the value of attribute ref


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

def ref
  @ref
end

#ref_typeObject (readonly)

Returns the value of attribute ref_type


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

def ref_type
  @ref_type
end

#shaObject (readonly)

Returns the value of attribute sha


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

def sha
  @sha
end

#statusObject (readonly)

Returns the value of attribute status


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

def status
  @status
end

#user_nameObject (readonly)

Returns the value of attribute user_name


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

def user_name
  @user_name
end

Instance Method Details

#attachmentsObject


31
32
33
# File 'app/models/project_services/slack_service/build_message.rb', line 31

def attachments
  [{ text: format(message), color: attachment_color }]
end

#fallbackObject


27
28
29
# File 'app/models/project_services/slack_service/build_message.rb', line 27

def fallback
  format(message)
end

#pretextObject


23
24
25
# File 'app/models/project_services/slack_service/build_message.rb', line 23

def pretext
  ''
end