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

Instance Method Summary collapse

Instance Attribute Details

#configObject

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

Yields:



17
18
19
# File 'lib/boot_slack_bot/configuration.rb', line 17

def configure
  yield config
end

#json_headersObject



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(message, 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: message }.to_json, headers: json_headers)
  end
end