Class: SlackMessaging::NotifyDiscord
- Inherits:
-
Object
- Object
- SlackMessaging::NotifyDiscord
- Defined in:
- lib/slack_messaging/notify_discord.rb
Instance Attribute Summary collapse
-
#avatar_url ⇒ Object
Returns the value of attribute avatar_url.
-
#text ⇒ Object
Returns the value of attribute text.
-
#username ⇒ Object
Returns the value of attribute username.
-
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
Instance Method Summary collapse
-
#initialize(text) ⇒ NotifyDiscord
constructor
A new instance of NotifyDiscord.
- #perform ⇒ Object
Constructor Details
#initialize(text) ⇒ NotifyDiscord
Returns a new instance of NotifyDiscord.
7 8 9 10 11 12 |
# File 'lib/slack_messaging/notify_discord.rb', line 7 def initialize(text) self.avatar_url = SlackMessaging::Config.discord[:avatar_url] || 'https://i.imgur.com/9ZTbiSF.jpg' self.text = text self.username = SlackMessaging::Config.discord[:username] || 'Slack Messaging' self.webhook_url = SlackMessaging::Config.discord[:webhook_url] end |
Instance Attribute Details
#avatar_url ⇒ Object
Returns the value of attribute avatar_url.
5 6 7 |
# File 'lib/slack_messaging/notify_discord.rb', line 5 def avatar_url @avatar_url end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/slack_messaging/notify_discord.rb', line 5 def text @text end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/slack_messaging/notify_discord.rb', line 5 def username @username end |
#webhook_url ⇒ Object
Returns the value of attribute webhook_url.
5 6 7 |
# File 'lib/slack_messaging/notify_discord.rb', line 5 def webhook_url @webhook_url end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/slack_messaging/notify_discord.rb', line 14 def perform = { avatar_url: avatar_url, content: text, username: username } `curl -s -H "Content-Type: application/json" -d '#{options.to_json.gsub("'", "'\\\\''")}' '#{webhook_url}'` end |