Class: FDE::Slack::Message
- Inherits:
-
Object
- Object
- FDE::Slack::Message
- Defined in:
- lib/slack/message.rb
Constant Summary collapse
- BLUE =
'#BDE5F8'.freeze
- GREEN =
'#DFF2BF'.freeze
- YELLOW =
'#FEEFB3'.freeze
- RED =
'#FFBABA'.freeze
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#color ⇒ Object
Returns the value of attribute color.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#title ⇒ Object
Returns the value of attribute title.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #add_field(field) ⇒ Object
- #error(channel) ⇒ Object
- #info(channel) ⇒ Object
-
#initialize(title, fields, author = nil, footer = nil, username = nil) ⇒ Message
constructor
A new instance of Message.
- #success(channel) ⇒ Object
- #warning(channel) ⇒ Object
Constructor Details
#initialize(title, fields, author = nil, footer = nil, username = nil) ⇒ Message
Returns a new instance of Message.
16 17 18 19 20 21 22 |
# File 'lib/slack/message.rb', line 16 def initialize(title, fields, = nil, = nil, username = nil) @username = username || 'FDE Slack Notifier' @title = title @author = @fields = fields @footer = end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def @author end |
#color ⇒ Object
Returns the value of attribute color.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def color @color end |
#fields ⇒ Object
Returns the value of attribute fields.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def fields @fields end |
#footer ⇒ Object
Returns the value of attribute footer.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def @footer end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def title @title end |
#username ⇒ Object
Returns the value of attribute username.
9 10 11 |
# File 'lib/slack/message.rb', line 9 def username @username end |
Instance Method Details
#add_field(field) ⇒ Object
44 45 46 |
# File 'lib/slack/message.rb', line 44 def add_field(field) @fields << field.to_h end |
#error(channel) ⇒ Object
39 40 41 42 |
# File 'lib/slack/message.rb', line 39 def error(channel) @color = RED send(channel) end |
#info(channel) ⇒ Object
24 25 26 27 |
# File 'lib/slack/message.rb', line 24 def info(channel) @color = BLUE send(channel) end |
#success(channel) ⇒ Object
29 30 31 32 |
# File 'lib/slack/message.rb', line 29 def success(channel) @color = GREEN send(channel) end |
#warning(channel) ⇒ Object
34 35 36 37 |
# File 'lib/slack/message.rb', line 34 def warning(channel) @color = YELLOW send(channel) end |