Class: SlackCliWebhook
- Inherits:
-
Object
- Object
- SlackCliWebhook
- Defined in:
- lib/slack-cli-webhook.rb
Class Method Summary collapse
Class Method Details
.send_message(message, webhook) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/slack-cli-webhook.rb', line 7 def self.(, webhook) begin .gsub! "\\n", "\n" puts uri = URI.parse(webhook) header = {'Content-Type' => 'application/json'} data = {text: } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri, header) request.body = data.to_json response = http.request(request) return response.code == '200' rescue return false end end |