Module: BootSlackBot
- Extended by:
- BootSlackBot
- Included in:
- BootSlackBot
- Defined in:
- lib/boot_slack_bot/api.rb,
lib/boot_slack_bot/version.rb,
lib/boot_slack_bot/configuration.rb
Defined Under Namespace
Classes: Configuration
Constant Summary collapse
- VERSION =
"0.0.6"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #configure {|config| ... } ⇒ Object
- #json_headers ⇒ Object
- #say(message, web_hook = BootSlackBot.config.slack_hook, headers = json_headers) ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
11 12 13 |
# File 'lib/boot_slack_bot/configuration.rb', line 11 def config @config end |
Instance Method Details
#configure {|config| ... } ⇒ Object
17 18 19 |
# File 'lib/boot_slack_bot/configuration.rb', line 17 def configure yield config end |
#json_headers ⇒ Object
12 13 14 |
# File 'lib/boot_slack_bot/api.rb', line 12 def json_headers { 'Content-Type' => 'application/json' } end |
#say(message, web_hook = BootSlackBot.config.slack_hook, headers = json_headers) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/boot_slack_bot/api.rb', line 4 def say(, web_hook = BootSlackBot.config.slack_hook, headers = json_headers) if web_hook.blank? raise StandardError, 'Web Hook URL is blank !' else HTTParty.post(web_hook, payload: { text: }.to_json, headers: json_headers) end end |