Class: CodeBuildNotifier::SlackMessage
- Inherits:
-
Object
- Object
- CodeBuildNotifier::SlackMessage
- Defined in:
- lib/codebuild-notifier/slack_message.rb
Instance Attribute Summary collapse
-
#author_email ⇒ Object
readonly
Returns the value of attribute author_email.
-
#author_name ⇒ Object
readonly
Returns the value of attribute author_name.
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#commit_message_subject ⇒ Object
readonly
Returns the value of attribute commit_message_subject.
-
#committer_email ⇒ Object
readonly
Returns the value of attribute committer_email.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#short_hash ⇒ Object
readonly
Returns the value of attribute short_hash.
-
#source_ref ⇒ Object
readonly
Returns the value of attribute source_ref.
Instance Method Summary collapse
- #additional_channel ⇒ Object
-
#initialize(build, config, source_ref) ⇒ SlackMessage
constructor
A new instance of SlackMessage.
- #payload ⇒ Object
- #recipients ⇒ Object
Constructor Details
#initialize(build, config, source_ref) ⇒ SlackMessage
Returns a new instance of SlackMessage.
23 24 25 26 27 28 29 |
# File 'lib/codebuild-notifier/slack_message.rb', line 23 def initialize(build, config, source_ref) @build = build @config = config @source_ref = source_ref @short_hash, @author_name, @author_email, @committer_email, @commit_message_subject = git_info end |
Instance Attribute Details
#author_email ⇒ Object (readonly)
Returns the value of attribute author_email.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def @author_email end |
#author_name ⇒ Object (readonly)
Returns the value of attribute author_name.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def @author_name end |
#build ⇒ Object (readonly)
Returns the value of attribute build.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def build @build end |
#commit_message_subject ⇒ Object (readonly)
Returns the value of attribute commit_message_subject.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def @commit_message_subject end |
#committer_email ⇒ Object (readonly)
Returns the value of attribute committer_email.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def committer_email @committer_email end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def config @config end |
#short_hash ⇒ Object (readonly)
Returns the value of attribute short_hash.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def short_hash @short_hash end |
#source_ref ⇒ Object (readonly)
Returns the value of attribute source_ref.
20 21 22 |
# File 'lib/codebuild-notifier/slack_message.rb', line 20 def source_ref @source_ref end |
Instance Method Details
#additional_channel ⇒ Object
44 45 46 |
# File 'lib/codebuild-notifier/slack_message.rb', line 44 def additional_channel !build.for_pr? && config.additional_channel end |
#payload ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/codebuild-notifier/slack_message.rb', line 31 def payload { color: slack_color, fallback: [title, body].join("\n"), title: title, text: body } end |
#recipients ⇒ Object
40 41 42 |
# File 'lib/codebuild-notifier/slack_message.rb', line 40 def recipients [, committer_email].uniq end |