Class: InfinumAzure::Api::WebhooksController

Inherits:
BaseController show all
Defined in:
app/controllers/infinum_azure/api/webhooks_controller.rb

Instance Method Summary collapse

Methods inherited from InfinumAzure::ApplicationController

#current_resource

Instance Method Details

#upsert_resource_callbackObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/infinum_azure/api/webhooks_controller.rb', line 6

def upsert_resource_callback
  if resource
    resource.update(user_params)
    action = 'updated'
  else
    @resource = resource_class.create(user_params)
    action = 'created'
  end

  InfinumAzure::AfterUpsertResource.call(resource, normalized_azure_params)

  render json: { resource_name.underscore => action }
end