Method: Unit::Webhook::CreateWebhookRequest#to_json_api

Defined in:
lib/unit/models/webhook/create_webhook_request.rb

#to_json_apiObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/unit/models/webhook/create_webhook_request.rb', line 29

def to_json_api
  payload = {
    data: {
      type: "webhook",
      attributes: {
        label: label,
        url: url,
        token: token,
        contentType: content_type,
        deliveryMode: delivery_mode,
        includeResources: include_resources,
        subscriptionType: subscription_type
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end