Module: Slack
- Defined in:
- lib/slack.rb,
lib/slack/version.rb
Defined Under Namespace
Classes: Configuration
Constant Summary collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/slack.rb', line 9 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
12 13 14 15 |
# File 'lib/slack.rb', line 12 def self.configure self.configuration ||= Configuration.new yield(configuration) end |
.post(message) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/slack.rb', line 28 def self.post() 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> #{}", "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 |