Method: TransferZero::WebhooksApi#post_webhooks_with_http_info

Defined in:
lib/transferzero-sdk/api/webhooks_api.rb

#post_webhooks_with_http_info(webhook_definition_request, opts = {}) ⇒ Array<(WebhookDefinitionResponse, Fixnum, Hash)>

Creating a webhook Creates a new webhook, subscribing the provided endpoint to the specified event(s)

Parameters:

  • webhook_definition_request
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(WebhookDefinitionResponse, Fixnum, Hash)>)

    WebhookDefinitionResponse data, response status code and response headers



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/transferzero-sdk/api/webhooks_api.rb', line 259

def post_webhooks_with_http_info(webhook_definition_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.post_webhooks ...'
  end
  # verify the required parameter 'webhook_definition_request' is set
  if @api_client.config.client_side_validation && webhook_definition_request.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_definition_request' when calling WebhooksApi.post_webhooks"
  end
  # resource path
  local_var_path = '/webhooks'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(webhook_definition_request)
  auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhookDefinitionResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#post_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end