Class: SlackNotify::Client
- Inherits:
-
Object
- Object
- SlackNotify::Client
- Includes:
- Connection
- Defined in:
- lib/slack-notify/client.rb
Instance Method Summary collapse
-
#initialize(team, token, options = {}) ⇒ Client
constructor
A new instance of Client.
- #notify(text, channel = nil) ⇒ Object
- #test ⇒ Object
Methods included from Connection
#base_url, #handle_response, #hook_url, #send_payload
Constructor Details
#initialize(team, token, options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/slack-notify/client.rb', line 8 def initialize(team, token, = {}) @team = team @token = token @username = [:username] @channel = [:channel] @icon_url = [:icon_url] @icon_emoji = [:icon_emoji] validate_arguments end |
Instance Method Details
#notify(text, channel = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/slack-notify/client.rb', line 23 def notify(text, channel = nil) delivery_channels(channel).each do |chan| payload = SlackNotify::Payload.new( text: text, channel: chan, username: @username, icon_url: @icon_url, icon_emoji: @icon_emoji ) send_payload(payload) end true end |
#test ⇒ Object
19 20 21 |
# File 'lib/slack-notify/client.rb', line 19 def test notify("Test Message") end |