@fantasticfears Thanks for the writeup!
It needs a bit of tweaking to take account of the changes introduced in this commit.
-
You no longer need a
setup_method inJobs::EmitWebHookEvent. -
There’s now a
WebHooka class method for formatting custom payloads via a serializer:WebHook.enqueue_object_hooks(type, object, event, Serializer)
Also, I’m wondering about the thinking behind namespacing the payload with the event type? This makes it a little harder to use endpoints you don’t fully control, which expect certain attributes in the body.
def build_web_hook_body(args, web_hook)
....
if ping_event?(event_type)
body[:ping] = 'OK'
else
body[event_type] = args[:payload]
end
...
end