Class: Easyhooks::PostProcessor

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/easyhooks/post_processor.rb

Instance Method Summary collapse

Instance Method Details

#perform(klass_name, object_id, payload, action_name, action_trigger) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/easyhooks/post_processor.rb', line 8

def perform(klass_name, object_id, payload, action_name, action_trigger)
  init_data(klass_name, object_id, payload, action_name, action_trigger)
  begin
    request = create_http_request
    make_request(request)
    trigger_event
  rescue => e
    if @action.on_fail.present? && @object.respond_to?(@action.on_fail_callable)
      @object.send(@action.on_fail_callable, e)
    else
      raise e
    end
  end
end