-
-
Save lossendae/c7f46046f85707c2882e64d7216ee3f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'net/http' | |
require 'json' | |
class UpdatesIssuesNotifierListener < Redmine::Hook::Listener | |
CALLBACK_URL = 'https://localhost:3333'.freeze | |
def controller_issues_edit_after_save(context) | |
data = { | |
'issueid' => context[:issue].id, | |
'userid' => User.current.id, | |
'datetime' => context[:issue].updated_on.strftime('%Y-%m-%d %H:%M:%S') | |
} | |
uri = URI(CALLBACK_URL) | |
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') | |
req.body = { 'data' => data }.to_json | |
Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(req) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment