Class: SalesforceBulkAPINotifier::SlackService
- Inherits:
-
Object
- Object
- SalesforceBulkAPINotifier::SlackService
- Defined in:
- lib/salesforce_bulkapi_notifier/slack_service.rb
Instance Method Summary collapse
-
#initialize ⇒ SlackService
constructor
A new instance of SlackService.
- #notify(channels, text) ⇒ Object
Constructor Details
#initialize ⇒ SlackService
Returns a new instance of SlackService.
3 4 5 6 7 8 9 |
# File 'lib/salesforce_bulkapi_notifier/slack_service.rb', line 3 def initialize Slack.configure do |config| config.token = SalesforceBulkAPINotifier.slack_api_token end @slack ||= Slack::Web::Client.new @slack.auth_test end |
Instance Method Details
#notify(channels, text) ⇒ Object
11 12 13 14 15 |
# File 'lib/salesforce_bulkapi_notifier/slack_service.rb', line 11 def notify(channels, text) channels.split(',').each do |channel| @slack.chat_postMessage(channel: "#{channel}", text: "#{text}", as_user: true) end end |