class VoucherifySdk::ExportsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_export(opts = {}) click to toggle source

Create Export Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions

@param [Hash] opts the optional parameters @option opts [ExportsCreateRequestBody] :exports_create_request_body Specify the details of the export that you would like to create. @return [ExportsCreateResponseBody]

# File lib/VoucherifySdk/api/exports_api.rb, line 27
def create_export(opts = {})
  data, _status_code, _headers = create_export_with_http_info(opts)
  data
end
delete_export(export_id, opts = {}) click to toggle source

Delete Export This method deletes a previously created export object. @param export_id [String] Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. @param [Hash] opts the optional parameters @return [nil]

# File lib/VoucherifySdk/api/exports_api.rb, line 91
def delete_export(export_id, opts = {})
  delete_export_with_http_info(export_id, opts)
  nil
end
download_export(export_id, opts = {}) click to toggle source

Download Export Download the contents of the exported CSV file. 📘 Important notes **Base URL:** - download.voucherify.io (Europe) - us1.download.voucherify.io (US) - as1.download.voucherify.io (Asia) Token: Can be found within the result parameter of the Get Export method response. @param export_id [String] Unique export object ID. @param [Hash] opts the optional parameters @option opts [String] :token Token that was issued to the export, to get this token, get the export first @return [String]

# File lib/VoucherifySdk/api/exports_api.rb, line 149
def download_export(export_id, opts = {})
  data, _status_code, _headers = download_export_with_http_info(export_id, opts)
  data
end
get_export(export_id, opts = {}) click to toggle source

Get Export Retrieves the URL of the downloadable file, which was generated via the Create Export method. @param export_id [String] Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. @param [Hash] opts the optional parameters @return [ExportsGetResponseBody]

# File lib/VoucherifySdk/api/exports_api.rb, line 210
def get_export(export_id, opts = {})
  data, _status_code, _headers = get_export_with_http_info(export_id, opts)
  data
end
list_exports(opts = {}) click to toggle source

List Exports List all exports. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListExports] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [ExportsListResponseBody]

# File lib/VoucherifySdk/api/exports_api.rb, line 271
def list_exports(opts = {})
  data, _status_code, _headers = list_exports_with_http_info(opts)
  data
end

Private Instance Methods

create_export_with_http_info(opts = {}) click to toggle source

Create Export Create export object. The export can be any of the following types: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. # Defaults If you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object: # Fetching particular data sets Using the parameters body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combination of any of the following available fields: # Orders # Vouchers # Publications # Redemptions # Customers # Points Expirations # Gift Card Transactions # Loyalty Card Transactions

@param [Hash] opts the optional parameters @option opts [ExportsCreateRequestBody] :exports_create_request_body Specify the details of the export that you would like to create. @return [Array<(ExportsCreateResponseBody, Integer, Hash)>] ExportsCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/exports_api.rb, line 37
        def create_export_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExportsApi.create_export ...'
  end
  # resource path
  local_var_path = '/v1/exports'

  # 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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

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

Delete Export This method deletes a previously created export object. @param export_id [String] Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/exports_api.rb, line 101
        def delete_export_with_http_info(export_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExportsApi.delete_export ...'
  end
  # resource path
  local_var_path = '/v1/exports/{exportId}'.sub('{' + 'exportId' + '}', CGI.escape(export_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] || ['X-App-Id', 'X-App-Token']

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

Download Export Download the contents of the exported CSV file. 📘 Important notes **Base URL:** - download.voucherify.io (Europe) - us1.download.voucherify.io (US) - as1.download.voucherify.io (Asia) Token: Can be found within the result parameter of the Get Export method response. @param export_id [String] Unique export object ID. @param [Hash] opts the optional parameters @option opts [String] :token Token that was issued to the export, to get this token, get the export first @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/VoucherifySdk/api/exports_api.rb, line 160
        def download_export_with_http_info(export_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExportsApi.download_export ...'
  end
  # resource path
  local_var_path = '/v1/exports/{export_Id}'.sub('{' + 'export_Id' + '}', CGI.escape(export_id.to_s))

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

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

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

Get Export Retrieves the URL of the downloadable file, which was generated via the Create Export method. @param export_id [String] Unique export object ID of previously created export. This object can be a: voucher, redemption, publication, customer, order, points_expiration, or voucher_transactions. @param [Hash] opts the optional parameters @return [Array<(ExportsGetResponseBody, Integer, Hash)>] ExportsGetResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/exports_api.rb, line 220
        def get_export_with_http_info(export_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExportsApi.get_export ...'
  end
  # resource path
  local_var_path = '/v1/exports/{exportId}'.sub('{' + 'exportId' + '}', CGI.escape(export_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] || 'ExportsGetResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

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

List Exports List all exports. @param [Hash] opts the optional parameters @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. @option opts [Integer] :page Which page of results to return. The lowest value is 1. @option opts [ParameterOrderListExports] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @return [Array<(ExportsListResponseBody, Integer, Hash)>] ExportsListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/exports_api.rb, line 283
        def list_exports_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExportsApi.list_exports ...'
  end
  # resource path
  local_var_path = '/v1/exports'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?

  # 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] || 'ExportsListResponseBody'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token']

  new_options = opts.merge(
    :operation => :"ExportsApi.list_exports",
    :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: ExportsApi#list_exports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end