class RoboPigeon::Dsl::SlackAttachment

Attributes

attachment[RW]

Public Class Methods

new() click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 5
def initialize
  self.attachment = { actions: [] }
end
run(&block) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 9
def self.run(&block)
  attachment = RoboPigeon::Dsl::SlackAttachment.new
  attachment.instance_eval(&block)
  attachment.attachment
end

Private Instance Methods

action(type, text, url, style=nil) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 53
def action(type, text, url, style=nil)
  attachment[:actions].push(
    type: type,
    text: text,
    url: url,
    style: style
  )
end
color(color) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 38
def color(color)
  attachment[:color] = color
end
fallback(text) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 18
def fallback(text)
  attachment[:fallback] = text
end
pretext(text) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 33
def pretext(text)
  attachment[:pretext] = text
end
title(title) click to toggle source
# File lib/robopigeon/slack/attachments_dsl.rb, line 23
def title(title)
  attachment[:title] = title
end