Class: Closeio::Rails::WebhooksController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/closeio/rails/webhooks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

def closeio

if params[:model] == 'lead'
  SyncUsersJob.perform_later params[:data][:id]
end
head :ok

end



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/closeio/rails/webhooks_controller.rb', line 13

def create
  request.format = :json
  ActiveSupport::Notifications.instrument("closeio.#{params[:action]}", params)

  #must return an ok - check Rails version to determine whether to return nothing or head response.
  if ::Rails.version =~ /^4/
    render nothing: true
  else
    head :ok
  end
end

#debugObject



25
26
27
# File 'app/controllers/closeio/rails/webhooks_controller.rb', line 25

def debug
  render json: {response: "It works - this is the debug method in Closeio::Rails::WebhooksController"}
end