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.
42 43 44 45 46 47 |
# File 'lib/rake_notifier/slack.rb', line 42 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.
48 49 50 |
# File 'lib/rake_notifier/slack.rb', line 48 def channel @channel end |
#icon ⇒ Object
Returns the value of attribute icon.
48 49 50 |
# File 'lib/rake_notifier/slack.rb', line 48 def icon @icon end |
#token ⇒ Object
Returns the value of attribute token.
48 49 50 |
# File 'lib/rake_notifier/slack.rb', line 48 def token @token end |
#username ⇒ Object
Returns the value of attribute username.
48 49 50 |
# File 'lib/rake_notifier/slack.rb', line 48 def username @username end |
Instance Method Details
#args_to_post(msg) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rake_notifier/slack.rb', line 50 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
61 62 63 |
# File 'lib/rake_notifier/slack.rb', line 61 def ping(msg) Breacan.(args_to_post(msg)) end |