Class: HeyYou::Builder::Slack
- Inherits:
-
Base
- Object
- Base
- HeyYou::Builder::Slack
- Defined in:
- lib/hey_you/builder/slack.rb
Instance Attribute Summary collapse
-
#icon_emoji ⇒ Object
readonly
Returns the value of attribute icon_emoji.
-
#icon_url ⇒ Object
readonly
Returns the value of attribute icon_url.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#webhook_name ⇒ Object
readonly
Returns the value of attribute webhook_name.
Instance Method Summary collapse
Instance Attribute Details
#icon_emoji ⇒ Object (readonly)
Returns the value of attribute icon_emoji.
4 5 6 |
# File 'lib/hey_you/builder/slack.rb', line 4 def icon_emoji @icon_emoji end |
#icon_url ⇒ Object (readonly)
Returns the value of attribute icon_url.
4 5 6 |
# File 'lib/hey_you/builder/slack.rb', line 4 def icon_url @icon_url end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
4 5 6 |
# File 'lib/hey_you/builder/slack.rb', line 4 def text @text end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
4 5 6 |
# File 'lib/hey_you/builder/slack.rb', line 4 def username @username end |
#webhook_name ⇒ Object (readonly)
Returns the value of attribute webhook_name.
4 5 6 |
# File 'lib/hey_you/builder/slack.rb', line 4 def webhook_name @webhook_name end |
Instance Method Details
#build ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/hey_you/builder/slack.rb', line 6 def build @webhook_name = ch_data.fetch('webhook_name', nil) @username = ch_data.fetch('username', nil) || Config.config.slack.slack_username @text = interpolate(ch_data.fetch('text'), ) @icon_emoji = ch_data.fetch('icon_emoji', nil) @icon_url = ch_data.fetch('icon_url', nil) end |
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/hey_you/builder/slack.rb', line 14 def to_hash excluded = [:@data, :@key, :@options] self.instance_variables.inject({}) do |memo, var| unless excluded.include?(var) memo[var.to_s.gsub('@', '')] = instance_variable_get(var) end memo end end |