module Slack
Constants
- VERSION
Attributes
configuration[RW]
Public Class Methods
configure() { |configuration| ... }
click to toggle source
# File lib/slack.rb, line 12 def self.configure self.configuration ||= Configuration.new yield(configuration) end
post(message)
click to toggle source
# File lib/slack.rb, line 28 def self.post(message) channel = Slack.configuration.channel icon_emoji = Slack.configuration.icon_emoji url = Slack.configuration.url username = Slack.configuration.username uri = URI(url) req = Net::HTTP::Post.new uri.path req.body = {"channel" => channel, "username" => username, "text" => "<!channel> #{message}", "icon_emoji" => icon_emoji}.to_json res = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http| http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.ssl_version = :SSLv3 http.request req end end