class DockerHouston::Slack::Message

Public Class Methods

new(channel, text) click to toggle source
# File lib/docker_houston/slack/message.rb, line 4
def initialize(channel, text)
  @uri = URI.parse(ENV['SLACK_WEBHOOK_URL'])
  @channel = channel
  @channel = '#' + @channel unless @channel.include? '#'
  @text = text
end

Public Instance Methods

notify() click to toggle source
# File lib/docker_houston/slack/message.rb, line 11
def notify
  response = Net::HTTP.post_form(@uri, {'payload' => {
                                         "channel" => @channel,
                                         "text" => @text,
                                         "username" => "Docker Houston",
                                         "icon_emoji" => ":rocket:"
                                     }.to_json }
  )
end