Class: RoboPigeon::Dsl::Slack
- Defined in:
- lib/robopigeon/slack/dsl.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #attachment(&block) ⇒ Object
- #channel(channel) ⇒ Object
-
#initialize ⇒ Slack
constructor
A new instance of Slack.
- #text(text) ⇒ Object
- #user(*user) ⇒ Object
Methods inherited from SlackRoot
#api_key, #emoji, #enabled, #name
Methods inherited from Base
#method_missing, #respond_to_missing?
Methods inherited from Job
#gitlab, #jenkins, #jira, #slack
Methods included from Helpers
Methods included from Helpers::Markdown
#confluence_from_md, #html_from_md, #jira_from_md, #slack_from_md
Methods included from Helpers::GitLab
#deployment_code_change_stats, #deployment_diff_link, #deployment_ref, #deployment_sha, #deployment_shortlog, #deployment_time, #environment_link, #tickets_in_log_since_deployment_to
Methods included from Helpers::Slack
#slack_name_for, #slack_user_for, #slack_user_group
Methods included from Helpers::Jira
#jira_last_created_ticket, #jira_last_created_ticket_link, #jira_last_created_ticket_slack_link, #jira_slack_link
Methods included from Helpers::Git
#changed_since?, #git_branch_merged_source, #git_branch_merged_target, #git_committer_email, #git_committer_name, #git_merger_email, #git_merger_name
Constructor Details
#initialize ⇒ Slack
Returns a new instance of Slack.
44 45 46 |
# File 'lib/robopigeon/slack/dsl.rb', line 44 def initialize self. = RoboPigeon::Slack::Message.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RoboPigeon::Dsl::Base
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
32 33 34 |
# File 'lib/robopigeon/slack/dsl.rb', line 32 def @message end |
Class Method Details
.run(&block) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/robopigeon/slack/dsl.rb', line 34 def self.run(&block) if RoboPigeon::Slack::Client.enabled slack = RoboPigeon::Dsl::Slack.new slack.instance_eval(&block) slack..send! else puts 'Slack is disabled, please remove `enabled false` from your global slack config' end end |
Instance Method Details
#attachment(&block) ⇒ Object
64 65 66 |
# File 'lib/robopigeon/slack/dsl.rb', line 64 def (&block) ..push(RoboPigeon::Dsl::SlackAttachment.run(&block)) end |
#channel(channel) ⇒ Object
54 55 56 |
# File 'lib/robopigeon/slack/dsl.rb', line 54 def channel(channel) .channels.push(channel) end |
#text(text) ⇒ Object
59 60 61 |
# File 'lib/robopigeon/slack/dsl.rb', line 59 def text(text) .text = text end |
#user(*user) ⇒ Object
49 50 51 |
# File 'lib/robopigeon/slack/dsl.rb', line 49 def user(*user) .users.push(RoboPigeon::Slack::Client.get_user(user).try(:id)) end |