2020-02-14 17:49:17 +00:00
|
|
|
class Webhooks::Trigger
|
|
|
|
def self.execute(url, payload)
|
2021-03-31 11:09:57 +00:00
|
|
|
RestClient::Request.execute(
|
|
|
|
method: :post,
|
|
|
|
url: url, payload: payload.to_json,
|
|
|
|
headers: { content_type: :json, accept: :json },
|
|
|
|
timeout: 5
|
|
|
|
)
|
2021-08-11 11:10:28 +00:00
|
|
|
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS => e
|
2020-09-18 13:20:53 +00:00
|
|
|
Rails.logger.info "Exception: invalid webhook url #{url} : #{e.message}"
|
2020-02-14 17:49:17 +00:00
|
|
|
rescue StandardError => e
|
2021-08-03 14:41:52 +00:00
|
|
|
Sentry.capture_exception(e)
|
2020-02-14 17:49:17 +00:00
|
|
|
end
|
|
|
|
end
|