2017-04-27 06:08:57 -04:00
|
|
|
module HooksExecution
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2017-07-20 11:12:06 -04:00
|
|
|
def set_hook_execution_notice(result)
|
|
|
|
http_status = result[:http_status]
|
|
|
|
message = result[:message]
|
|
|
|
|
|
|
|
if http_status && http_status >= 200 && http_status < 400
|
|
|
|
flash[:notice] = "Hook executed successfully: HTTP #{http_status}"
|
|
|
|
elsif http_status
|
|
|
|
flash[:alert] = "Hook executed successfully but returned HTTP #{http_status} #{message}"
|
2017-04-27 06:08:57 -04:00
|
|
|
else
|
|
|
|
flash[:alert] = "Hook execution failed: #{message}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|