Class: RakeNotifier::Slack::Client
- Inherits:
-
Object
- Object
- RakeNotifier::Slack::Client
- Defined in:
- lib/rake_notifier/slack.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#token ⇒ Object
Returns the value of attribute token.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #args_to_post(msg) ⇒ Object
-
#initialize(token, channel: '#test', icon: nil, username: nil) ⇒ Client
constructor
A new instance of Client.
- #ping(msg) ⇒ Object
Constructor Details
#initialize(token, channel: '#test', icon: nil, username: nil) ⇒ Client
Returns a new instance of Client.
36 37 38 39 40 41 |
# File 'lib/rake_notifier/slack.rb', line 36 def initialize(token, channel: '#test', icon: nil, username: nil) Breacan.access_token = @token = token @channel = channel @icon = icon @username = username end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
42 43 44 |
# File 'lib/rake_notifier/slack.rb', line 42 def channel @channel end |
#icon ⇒ Object
Returns the value of attribute icon.
42 43 44 |
# File 'lib/rake_notifier/slack.rb', line 42 def icon @icon end |
#token ⇒ Object
Returns the value of attribute token.
42 43 44 |
# File 'lib/rake_notifier/slack.rb', line 42 def token @token end |
#username ⇒ Object
Returns the value of attribute username.
42 43 44 |
# File 'lib/rake_notifier/slack.rb', line 42 def username @username end |
Instance Method Details
#args_to_post(msg) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rake_notifier/slack.rb', line 44 def args_to_post(msg) arg = { channel: channel, text: msg, as_user: false, } arg[icon_key(icon)] = icon if icon arg[:username] = username if username arg end |
#ping(msg) ⇒ Object
55 56 57 |
# File 'lib/rake_notifier/slack.rb', line 55 def ping(msg) Breacan.(args_to_post(msg)) end |