class UltracartClient::WebhookApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/ultracart_api/api/webhook_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end
new_using_api_key(simple_key, verify_ssl = true, debugging = false) click to toggle source
# File lib/ultracart_api/api/webhook_api.rb, line 23
def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
  api_config = Configuration.new
  api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
  api_config.api_version = '2017-03-01'
  api_config.verify_ssl = verify_ssl

  api_client = ApiClient.new(api_config)
  api_client.config.debugging = debugging

  UltracartClient::WebhookApi.new(api_client)
end

Public Instance Methods

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

Delete a webhook Delete a webhook on the UltraCart account. @param webhook_oid The webhook oid to delete. @param [Hash] opts the optional parameters @return [nil]

# File lib/ultracart_api/api/webhook_api.rb, line 40
def delete_webhook(webhook_oid, opts = {})
  delete_webhook_with_http_info(webhook_oid, opts)
  nil
end
delete_webhook_by_url(webhook, opts = {}) click to toggle source

Delete a webhook by URL Delete a webhook based upon the URL on the webhook_url matching an existing webhook. @param webhook Webhook to delete @param [Hash] opts the optional parameters @return [WebhookResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 94
def delete_webhook_by_url(webhook, opts = {})
  data, _status_code, _headers = delete_webhook_by_url_with_http_info(webhook, opts)
  data
end
delete_webhook_by_url_with_http_info(webhook, opts = {}) click to toggle source

Delete a webhook by URL Delete a webhook based upon the URL on the webhook_url matching an existing webhook. @param webhook Webhook to delete @param [Hash] opts the optional parameters @return [Array<(WebhookResponse, Fixnum, Hash)>] WebhookResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 104
def delete_webhook_by_url_with_http_info(webhook, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.delete_webhook_by_url ...'
  end
  # verify the required parameter 'webhook' is set
  if @api_client.config.client_side_validation && webhook.nil?
    fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhookApi.delete_webhook_by_url"
  end
  # resource path
  local_var_path = '/webhook/webhooks'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(webhook)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhookResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#delete_webhook_by_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_webhook_with_http_info(webhook_oid, opts = {}) click to toggle source

Delete a webhook Delete a webhook on the UltraCart account. @param webhook_oid The webhook oid to delete. @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 50
def delete_webhook_with_http_info(webhook_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.delete_webhook ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.delete_webhook"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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 = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_webhook_log(webhook_oid, request_id, opts = {}) click to toggle source

Retrieve an individual log Retrieves an individual log for a webhook given the webhook oid the request id. @param webhook_oid The webhook oid that owns the log. @param request_id The request id associated with the log to view. @param [Hash] opts the optional parameters @return [WebhookLogResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 150
def get_webhook_log(webhook_oid, request_id, opts = {})
  data, _status_code, _headers = get_webhook_log_with_http_info(webhook_oid, request_id, opts)
  data
end
get_webhook_log_summaries(webhook_oid, opts = {}) click to toggle source

Retrieve the log summaries Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed. @param webhook_oid The webhook oid to retrieve log summaries for. @param [Hash] opts the optional parameters @option opts [Integer] :_limit The maximum number of records to return on this one API call. (default to 100) @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) @option opts [String] :_since Fetch log summaries that have been delivered since this date/time. @return [WebhookLogSummariesResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 213
def get_webhook_log_summaries(webhook_oid, opts = {})
  data, _status_code, _headers = get_webhook_log_summaries_with_http_info(webhook_oid, opts)
  data
end
get_webhook_log_summaries_with_http_info(webhook_oid, opts = {}) click to toggle source

Retrieve the log summaries Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed. @param webhook_oid The webhook oid to retrieve log summaries for. @param [Hash] opts the optional parameters @option opts [Integer] :_limit The maximum number of records to return on this one API call. @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. @option opts [String] :_since Fetch log summaries that have been delivered since this date/time. @return [Array<(WebhookLogSummariesResponse, Fixnum, Hash)>] WebhookLogSummariesResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 226
def get_webhook_log_summaries_with_http_info(webhook_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log_summaries ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log_summaries"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/logs'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s)

  # query parameters
  query_params = {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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 = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhookLogSummariesResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#get_webhook_log_summaries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_webhook_log_with_http_info(webhook_oid, request_id, opts = {}) click to toggle source

Retrieve an individual log Retrieves an individual log for a webhook given the webhook oid the request id. @param webhook_oid The webhook oid that owns the log. @param request_id The request id associated with the log to view. @param [Hash] opts the optional parameters @return [Array<(WebhookLogResponse, Fixnum, Hash)>] WebhookLogResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 161
def get_webhook_log_with_http_info(webhook_oid, request_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log"
  end
  # verify the required parameter 'request_id' is set
  if @api_client.config.client_side_validation && request_id.nil?
    fail ArgumentError, "Missing the required parameter 'request_id' when calling WebhookApi.get_webhook_log"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/logs/{requestId}'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s).sub('{' + 'requestId' + '}', request_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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 = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhookLogResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#get_webhook_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_webhooks(opts = {}) click to toggle source

Retrieve webhooks Retrieves the webhooks associated with this application. @param [Hash] opts the optional parameters @option opts [Integer] :_limit The maximum number of records to return on this one API call. (default to 100) @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) @option opts [String] :_sort The sort order of the webhooks. See documentation for examples @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [WebhooksResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 277
def get_webhooks(opts = {})
  data, _status_code, _headers = get_webhooks_with_http_info(opts)
  data
end
get_webhooks_with_http_info(opts = {}) click to toggle source

Retrieve webhooks Retrieves the webhooks associated with this application. @param [Hash] opts the optional parameters @option opts [Integer] :_limit The maximum number of records to return on this one API call. @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. @option opts [String] :_sort The sort order of the webhooks. See documentation for examples @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [Array<(WebhooksResponse, Fixnum, Hash)>] WebhooksResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 290
def get_webhooks_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhooks ...'
  end
  # resource path
  local_var_path = '/webhook/webhooks'

  # query parameters
  query_params = {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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 = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhooksResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
insert_webhook(webhook, opts = {}) click to toggle source

Add a webhook Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and return them. This allows your application to have simpler logic on the setup of a secure webhook. @param webhook Webhook to create @param [Hash] opts the optional parameters @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [WebhookResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 336
def insert_webhook(webhook, opts = {})
  data, _status_code, _headers = insert_webhook_with_http_info(webhook, opts)
  data
end
insert_webhook_with_http_info(webhook, opts = {}) click to toggle source

Add a webhook Adds a new webhook on the account. If you add a new webhook with the authentication_type set to basic, but do not specify the basic_username and basic_password, UltraCart will automatically generate random ones and return them. This allows your application to have simpler logic on the setup of a secure webhook. @param webhook Webhook to create @param [Hash] opts the optional parameters @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [Array<(WebhookResponse, Fixnum, Hash)>] WebhookResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 347
def insert_webhook_with_http_info(webhook, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.insert_webhook ...'
  end
  # verify the required parameter 'webhook' is set
  if @api_client.config.client_side_validation && webhook.nil?
    fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhookApi.insert_webhook"
  end
  # resource path
  local_var_path = '/webhook/webhooks'

  # query parameters
  query_params = {}
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(webhook)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  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 => 'WebhookResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#insert_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
resend_event(webhook_oid, event_name, opts = {}) click to toggle source

Resend events to the webhook endpoint. This method will resend events to the webhook endpoint. This method can be used for example to send all the existing items on an account to a webhook. @param webhook_oid The webhook oid that is receiving the reflowed events. @param event_name The event to reflow. @param [Hash] opts the optional parameters @return [WebhookSampleRequestResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 394
def resend_event(webhook_oid, event_name, opts = {})
  data, _status_code, _headers = resend_event_with_http_info(webhook_oid, event_name, opts)
  data
end
resend_event_with_http_info(webhook_oid, event_name, opts = {}) click to toggle source

Resend events to the webhook endpoint. This method will resend events to the webhook endpoint. This method can be used for example to send all the existing items on an account to a webhook. @param webhook_oid The webhook oid that is receiving the reflowed events. @param event_name The event to reflow. @param [Hash] opts the optional parameters @return [Array<(WebhookSampleRequestResponse, Fixnum, Hash)>] WebhookSampleRequestResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 405
def resend_event_with_http_info(webhook_oid, event_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.resend_event ...'
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.resend_event"
  end
  # verify the required parameter 'event_name' is set
  if @api_client.config.client_side_validation && event_name.nil?
    fail ArgumentError, "Missing the required parameter 'event_name' when calling WebhookApi.resend_event"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}/reflow/{eventName}'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s).sub('{' + 'eventName' + '}', event_name.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  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 => 'WebhookSampleRequestResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#resend_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_webhook(webhook, webhook_oid, opts = {}) click to toggle source

Update a webhook Update a webhook on the account @param webhook Webhook to update @param webhook_oid The webhook oid to update. @param [Hash] opts the optional parameters @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [WebhookResponse]

# File lib/ultracart_api/api/webhook_api.rb, line 456
def update_webhook(webhook, webhook_oid, opts = {})
  data, _status_code, _headers = update_webhook_with_http_info(webhook, webhook_oid, opts)
  data
end
update_webhook_with_http_info(webhook, webhook_oid, opts = {}) click to toggle source

Update a webhook Update a webhook on the account @param webhook Webhook to update @param webhook_oid The webhook oid to update. @param [Hash] opts the optional parameters @option opts [BOOLEAN] :_placeholders Whether or not placeholder values should be returned in the result. Useful for UIs that consume this REST API. @return [Array<(WebhookResponse, Fixnum, Hash)>] WebhookResponse data, response status code and response headers

# File lib/ultracart_api/api/webhook_api.rb, line 468
def update_webhook_with_http_info(webhook, webhook_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.update_webhook ...'
  end
  # verify the required parameter 'webhook' is set
  if @api_client.config.client_side_validation && webhook.nil?
    fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhookApi.update_webhook"
  end
  # verify the required parameter 'webhook_oid' is set
  if @api_client.config.client_side_validation && webhook_oid.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_oid' when calling WebhookApi.update_webhook"
  end
  # resource path
  local_var_path = '/webhook/webhooks/{webhookOid}'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s)

  # query parameters
  query_params = {}
  query_params[:'_placeholders'] = opts[:'_placeholders'] if !opts[:'_placeholders'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # 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; charset=UTF-8'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(webhook)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'WebhookResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end