Module: Slackpost

Defined in:
lib/slackpost.rb,
lib/slackpost/version.rb,
lib/slackpost/exceptions.rb,
lib/slackpost/configuration.rb

Overview

docs

Defined Under Namespace

Classes: Configuration, SlackpostError

Constant Summary collapse

VERSION =
'0.1.3'.freeze

Class Method Summary collapse

Class Method Details

.configObject



13
14
15
# File 'lib/slackpost.rb', line 13

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



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

def configure
  yield(config)
end

.send_attachment(msg, channel, attachments) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/slackpost.rb', line 28

def send_attachment(msg, channel, attachments)
  body = { channel: channel,
           link_names: 1,
           text: msg,
           attachments: [attachments].flatten }
  send_slack(body)
end

.send_message(msg, channel) ⇒ Object



21
22
23
24
25
26
# File 'lib/slackpost.rb', line 21

def send_message(msg, channel)
  body = { channel: channel,
           link_names: 1,
           text: msg }
  send_slack(body)
end