Class: Slack::Notifier
- Inherits:
-
Object
- Object
- Slack::Notifier
- Defined in:
- lib/slack-notifier.rb,
lib/slack-notifier/version.rb,
lib/slack-notifier/http_post.rb,
lib/slack-notifier/link_formatter.rb
Defined Under Namespace
Classes: HTTPPost, LinkFormatter
Constant Summary collapse
- VERSION =
"0.3.2"
Instance Attribute Summary collapse
-
#channel ⇒ Object
these act as defaults if they are set.
-
#hook_name ⇒ Object
readonly
Returns the value of attribute hook_name.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#username ⇒ Object
these act as defaults if they are set.
Instance Method Summary collapse
-
#initialize(team, token, hook_name = default_hook_name) ⇒ Notifier
constructor
A new instance of Notifier.
- #ping(message, options = {}) ⇒ Object
Constructor Details
#initialize(team, token, hook_name = default_hook_name) ⇒ Notifier
Returns a new instance of Notifier.
17 18 19 20 21 |
# File 'lib/slack-notifier.rb', line 17 def initialize team, token, hook_name = default_hook_name @team = team @token = token @hook_name = hook_name end |
Instance Attribute Details
#channel ⇒ Object
these act as defaults if they are set
13 14 15 |
# File 'lib/slack-notifier.rb', line 13 def channel @channel end |
#hook_name ⇒ Object (readonly)
Returns the value of attribute hook_name.
15 16 17 |
# File 'lib/slack-notifier.rb', line 15 def hook_name @hook_name end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
15 16 17 |
# File 'lib/slack-notifier.rb', line 15 def team @team end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
15 16 17 |
# File 'lib/slack-notifier.rb', line 15 def token @token end |
#username ⇒ Object
these act as defaults if they are set
13 14 15 |
# File 'lib/slack-notifier.rb', line 13 def username @username end |
Instance Method Details
#ping(message, options = {}) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/slack-notifier.rb', line 23 def ping , ={} = LinkFormatter.format() payload = { text: }.merge(default_payload).merge() HTTPPost.to endpoint, payload: payload.to_json end |