akam_roadmap/lib/tasks/slack.rake

26 lines
560 B
Ruby
Raw Normal View History

2014-12-17 15:26:46 +00:00
require "uri"
require "net/http"
namespace :slack do
desc "TODO"
task webhook: :environment do
out = {}
out[:text] = "Hello World"
out[:color] = "good"
out[:pretext] = "pretext!"
uri = URI.parse('https://hooks.slack.com/services/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')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'})
request.body = out.to_json
response = http.request(request)
puts response.body
end
end