class LaunchDarklyApi::WebhooksApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/webhooks_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_webhook(id, opts = {}) click to toggle source

Delete webhook Delete a webhook by ID. @param id [String] The ID of the webhook to delete @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/webhooks_api.rb, line 27
def delete_webhook(id, opts = {})
  delete_webhook_with_http_info(id, opts)
  nil
end
delete_webhook_with_http_info(id, opts = {}) click to toggle source

Delete webhook Delete a webhook by ID. @param id [String] The ID of the webhook to delete @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/webhooks_api.rb, line 37
def delete_webhook_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.delete_webhook"
  end
  # resource path
  local_var_path = '/api/v2/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WebhooksApi.delete_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_all_webhooks(opts = {}) click to toggle source

List webhooks Fetch a list of all webhooks. @param [Hash] opts the optional parameters @return [Webhooks]

# File lib/launchdarkly_api/api/webhooks_api.rb, line 87
def get_all_webhooks(opts = {})
  data, _status_code, _headers = get_all_webhooks_with_http_info(opts)
  data
end
get_all_webhooks_with_http_info(opts = {}) click to toggle source

List webhooks Fetch a list of all webhooks. @param [Hash] opts the optional parameters @return [Array<(Webhooks, Integer, Hash)>] Webhooks data, response status code and response headers

# File lib/launchdarkly_api/api/webhooks_api.rb, line 96
def get_all_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.get_all_webhooks ...'
  end
  # resource path
  local_var_path = '/api/v2/webhooks'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Webhooks'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WebhooksApi.get_all_webhooks",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#get_all_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_webhook(id, opts = {}) click to toggle source

Get webhook Get a single webhook by ID. @param id [String] The ID of the webhook @param [Hash] opts the optional parameters @return [Webhook]

# File lib/launchdarkly_api/api/webhooks_api.rb, line 145
def get_webhook(id, opts = {})
  data, _status_code, _headers = get_webhook_with_http_info(id, opts)
  data
end
get_webhook_with_http_info(id, opts = {}) click to toggle source

Get webhook Get a single webhook by ID. @param id [String] The ID of the webhook @param [Hash] opts the optional parameters @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers

# File lib/launchdarkly_api/api/webhooks_api.rb, line 155
def get_webhook_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook"
  end
  # resource path
  local_var_path = '/api/v2/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Webhook'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WebhooksApi.get_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_webhook(id, patch_operation, opts = {}) click to toggle source

Update webhook Update a webhook's settings. The request should be a valid JSON Patch document describing the changes to be made to the webhook. @param id [String] The ID of the webhook to update @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Webhook]

# File lib/launchdarkly_api/api/webhooks_api.rb, line 209
def patch_webhook(id, patch_operation, opts = {})
  data, _status_code, _headers = patch_webhook_with_http_info(id, patch_operation, opts)
  data
end
patch_webhook_with_http_info(id, patch_operation, opts = {}) click to toggle source

Update webhook Update a webhook&#39;s settings. The request should be a valid JSON Patch document describing the changes to be made to the webhook. @param id [String] The ID of the webhook to update @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers

# File lib/launchdarkly_api/api/webhooks_api.rb, line 220
def patch_webhook_with_http_info(id, patch_operation, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.patch_webhook ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.patch_webhook"
  end
  # verify the required parameter 'patch_operation' is set
  if @api_client.config.client_side_validation && patch_operation.nil?
    fail ArgumentError, "Missing the required parameter 'patch_operation' when calling WebhooksApi.patch_webhook"
  end
  # resource path
  local_var_path = '/api/v2/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_operation)

  # return_type
  return_type = opts[:debug_return_type] || 'Webhook'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WebhooksApi.patch_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#patch_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_webhook(webhook_post, opts = {}) click to toggle source

Creates a webhook Create a new webhook @param webhook_post [WebhookPost] @param [Hash] opts the optional parameters @return [Webhook]

# File lib/launchdarkly_api/api/webhooks_api.rb, line 279
def post_webhook(webhook_post, opts = {})
  data, _status_code, _headers = post_webhook_with_http_info(webhook_post, opts)
  data
end
post_webhook_with_http_info(webhook_post, opts = {}) click to toggle source

Creates a webhook Create a new webhook @param webhook_post [WebhookPost] @param [Hash] opts the optional parameters @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers

# File lib/launchdarkly_api/api/webhooks_api.rb, line 289
def post_webhook_with_http_info(webhook_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.post_webhook ...'
  end
  # verify the required parameter 'webhook_post' is set
  if @api_client.config.client_side_validation && webhook_post.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_post' when calling WebhooksApi.post_webhook"
  end
  # resource path
  local_var_path = '/api/v2/webhooks'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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 = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_post)

  # return_type
  return_type = opts[:debug_return_type] || 'Webhook'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"WebhooksApi.post_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#post_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end