Class: PubsubNotifier::SlackClient
- Inherits:
-
Client::Base
- Object
- Client::Base
- PubsubNotifier::SlackClient
- Defined in:
- lib/pubsub_notifier/slack_client.rb
Defined Under Namespace
Classes: Config
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#icon_emoji ⇒ Object
readonly
Returns the value of attribute icon_emoji.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SlackClient
constructor
A new instance of SlackClient.
- #notify_failure(message) ⇒ Object
- #notify_success(message) ⇒ Object
Methods inherited from Client::Base
Constructor Details
#initialize(options = {}) ⇒ SlackClient
Returns a new instance of SlackClient.
9 10 11 12 13 |
# File 'lib/pubsub_notifier/slack_client.rb', line 9 def initialize( = {}) @channel = .delete(:channel) || default_channel @username = .delete(:username) || default_username @icon_emoji = .delete(:icon_emoji) || default_icon_emoji end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
7 8 9 |
# File 'lib/pubsub_notifier/slack_client.rb', line 7 def channel @channel end |
#icon_emoji ⇒ Object (readonly)
Returns the value of attribute icon_emoji.
7 8 9 |
# File 'lib/pubsub_notifier/slack_client.rb', line 7 def icon_emoji @icon_emoji end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/pubsub_notifier/slack_client.rb', line 7 def username @username end |
Instance Method Details
#notify_failure(message) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/pubsub_notifier/slack_client.rb', line 25 def notify_failure() post_slack( attachments: [{ text: , color: "danger", mrkdwn_in: ["text"], }], ) end |
#notify_success(message) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/pubsub_notifier/slack_client.rb', line 15 def notify_success() post_slack( attachments: [{ text: , color: "good", mrkdwn_in: ["text"], }], ) end |