class OpenapiClient::WebhooksApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_webhook(create_webhook_request_body, opts = {}) click to toggle source

Create a Webhook Create a webook for specific events in the environment. @param create_webhook_request_body [CreateWebhookRequestBody] @param [Hash] opts the optional parameters @return [CreateWebhookResponseBody]

# File lib/openapi_client/api/webhooks_api.rb, line 27
def create_webhook(create_webhook_request_body, opts = {})
  data, _status_code, _headers = create_webhook_with_http_info(create_webhook_request_body, opts)
  data
end
create_webhook_with_http_info(create_webhook_request_body, opts = {}) click to toggle source

Create a Webhook Create a webook for specific events in the environment. @param create_webhook_request_body [CreateWebhookRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateWebhookResponseBody, Integer, Hash)>] CreateWebhookResponseBody data, response status code and response headers

# File lib/openapi_client/api/webhooks_api.rb, line 37
def create_webhook_with_http_info(create_webhook_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
  end
  # verify the required parameter 'create_webhook_request_body' is set
  if @api_client.config.client_side_validation && create_webhook_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'create_webhook_request_body' when calling WebhooksApi.create_webhook"
  end
  # resource path
  local_var_path = '/v1/environment/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[:body] || @api_client.object_to_http_body(create_webhook_request_body) 

  # return_type
  return_type = opts[:return_type] || 'CreateWebhookResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_webhook(webhook_id, opts = {}) click to toggle source

Delete Webhook By ID Delete a webhook @param webhook_id [String] Webhook ID @param [Hash] opts the optional parameters @return [String]

# File lib/openapi_client/api/webhooks_api.rb, line 91
def delete_webhook(webhook_id, opts = {})
  data, _status_code, _headers = delete_webhook_with_http_info(webhook_id, opts)
  data
end
delete_webhook_with_http_info(webhook_id, opts = {}) click to toggle source

Delete Webhook By ID Delete a webhook @param webhook_id [String] Webhook ID @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/openapi_client/api/webhooks_api.rb, line 101
def delete_webhook_with_http_info(webhook_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.delete_webhook"
  end
  if @api_client.config.client_side_validation && webhook_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.delete_webhook, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && webhook_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.delete_webhook, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)
  if @api_client.config.client_side_validation && webhook_id !~ pattern
    fail ArgumentError, "invalid value for 'webhook_id' when calling WebhooksApi.delete_webhook, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/environment/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_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(['text/plain', 'application/json'])

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

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

  # return_type
  return_type = opts[:return_type] || 'String' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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_webhook_by_id(webhook_id, opts = {}) click to toggle source

Get Webhook By ID Retrieve individual webhook by an ID @param webhook_id [String] Webhook ID @param [Hash] opts the optional parameters @return [GetWebhookByIdResponseBody]

# File lib/openapi_client/api/webhooks_api.rb, line 166
def get_webhook_by_id(webhook_id, opts = {})
  data, _status_code, _headers = get_webhook_by_id_with_http_info(webhook_id, opts)
  data
end
get_webhook_by_id_with_http_info(webhook_id, opts = {}) click to toggle source

Get Webhook By ID Retrieve individual webhook by an ID @param webhook_id [String] Webhook ID @param [Hash] opts the optional parameters @return [Array<(GetWebhookByIdResponseBody, Integer, Hash)>] GetWebhookByIdResponseBody data, response status code and response headers

# File lib/openapi_client/api/webhooks_api.rb, line 176
def get_webhook_by_id_with_http_info(webhook_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook_by_id ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.get_webhook_by_id"
  end
  if @api_client.config.client_side_validation && webhook_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.get_webhook_by_id, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && webhook_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.get_webhook_by_id, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)
  if @api_client.config.client_side_validation && webhook_id !~ pattern
    fail ArgumentError, "invalid value for 'webhook_id' when calling WebhooksApi.get_webhook_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/environment/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_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[:body] 

  # return_type
  return_type = opts[:return_type] || 'GetWebhookByIdResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_webhooks(opts = {}) click to toggle source

List Webhooks List all webhooks currently enabled for the account. @param [Hash] opts the optional parameters @return [Array<Webhook>]

# File lib/openapi_client/api/webhooks_api.rb, line 240
def list_webhooks(opts = {})
  data, _status_code, _headers = list_webhooks_with_http_info(opts)
  data
end
list_webhooks_with_http_info(opts = {}) click to toggle source

List Webhooks List all webhooks currently enabled for the account. @param [Hash] opts the optional parameters @return [Array<(Array<Webhook>, Integer, Hash)>] Array<Webhook> data, response status code and response headers

# File lib/openapi_client/api/webhooks_api.rb, line 249
def list_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
  end
  # resource path
  local_var_path = '/v1/environment/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[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<Webhook>' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_webhook(webhook_id, update_webhook_request_body, opts = {}) click to toggle source

Update a Webhook Update the webhook url property @param webhook_id [String] Webhook ID @param update_webhook_request_body [UpdateWebhookRequestBody] @param [Hash] opts the optional parameters @return [String]

# File lib/openapi_client/api/webhooks_api.rb, line 298
def update_webhook(webhook_id, update_webhook_request_body, opts = {})
  data, _status_code, _headers = update_webhook_with_http_info(webhook_id, update_webhook_request_body, opts)
  data
end
update_webhook_with_http_info(webhook_id, update_webhook_request_body, opts = {}) click to toggle source

Update a Webhook Update the webhook url property @param webhook_id [String] Webhook ID @param update_webhook_request_body [UpdateWebhookRequestBody] @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/openapi_client/api/webhooks_api.rb, line 309
def update_webhook_with_http_info(webhook_id, update_webhook_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
  end
  # verify the required parameter 'webhook_id' is set
  if @api_client.config.client_side_validation && webhook_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.update_webhook"
  end
  if @api_client.config.client_side_validation && webhook_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.update_webhook, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && webhook_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "webhook_id" when calling WebhooksApi.update_webhook, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)
  if @api_client.config.client_side_validation && webhook_id !~ pattern
    fail ArgumentError, "invalid value for 'webhook_id' when calling WebhooksApi.update_webhook, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'update_webhook_request_body' is set
  if @api_client.config.client_side_validation && update_webhook_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'update_webhook_request_body' when calling WebhooksApi.update_webhook"
  end
  # resource path
  local_var_path = '/v1/environment/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_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(['text/plain', '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[:body] || @api_client.object_to_http_body(update_webhook_request_body) 

  # return_type
  return_type = opts[:return_type] || 'String' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end