Class: ActiveMessenger::Adapters::Slack

Inherits:
Base
  • Object
show all
Defined in:
lib/active_messenger/adapters/slack.rb

Instance Method Summary collapse

Methods inherited from Base

load_config!

Constructor Details

#initializeSlack

Returns a new instance of Slack.



11
12
13
14
15
16
17
# File 'lib/active_messenger/adapters/slack.rb', line 11

def initialize
  @client = ::Slack::Notifier.new(
    self.class.webhook_url,
    channel: self.class.channel,
    username: self.class.username
  )
end

Instance Method Details

#channnel=(ch) ⇒ Object



19
20
21
# File 'lib/active_messenger/adapters/slack.rb', line 19

def channnel=(ch)
  @client.channel = ch
end

#send!(msg) ⇒ Object



27
28
29
# File 'lib/active_messenger/adapters/slack.rb', line 27

def send!(msg)
  @client.ping(msg)
end

#username=(u_name) ⇒ Object



23
24
25
# File 'lib/active_messenger/adapters/slack.rb', line 23

def username=(u_name)
  @client.username = u_name
end