class VoucherifySdk::ProductsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_product(opts = {}) click to toggle source

Create Product Creates a product object. πŸ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. @param [Hash] opts the optional parameters @option opts [ProductsCreateRequestBody] :products_create_request_body Specify the product parameters. @return [ProductsCreateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 27
def create_product(opts = {})
  data, _status_code, _headers = create_product_with_http_info(opts)
  data
end
create_sku(product_id, opts = {}) click to toggle source

Create SKU This method adds product variants to a created product. πŸ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. @param product_id [String] A Voucherify product ID or product source ID. @param [Hash] opts the optional parameters @option opts [ProductsSkusCreateRequestBody] :products_skus_create_request_body Specify the SKU parameters to be created. @return [ProductsSkusCreateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 92
def create_sku(product_id, opts = {})
  data, _status_code, _headers = create_sku_with_http_info(product_id, opts)
  data
end
delete_product(product_id, opts = {}) click to toggle source

Delete Product Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @option opts [Boolean] :force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. @return [nil]

# File lib/VoucherifySdk/api/products_api.rb, line 158
def delete_product(product_id, opts = {})
  delete_product_with_http_info(product_id, opts)
  nil
end
delete_sku(product_id, sku_id, opts = {}) click to toggle source

Delete SKU Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. @param product_id [String] A unique Voucherify product ID or product source ID. @param sku_id [String] A Voucherify SKU ID or SKU source ID. @param [Hash] opts the optional parameters @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. @return [nil]

# File lib/VoucherifySdk/api/products_api.rb, line 219
def delete_sku(product_id, sku_id, opts = {})
  delete_sku_with_http_info(product_id, sku_id, opts)
  nil
end
get_product(product_id, opts = {}) click to toggle source

Get Product Retrieve product details. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @return [ProductsGetResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 279
def get_product(product_id, opts = {})
  data, _status_code, _headers = get_product_with_http_info(product_id, opts)
  data
end
get_sku(sku_id, opts = {}) click to toggle source

Get SKU Retrieve details of a SKU. @param sku_id [String] A Voucherify SKU identifier or SKU source ID. @param [Hash] opts the optional parameters @return [SkusGetResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 338
def get_sku(sku_id, opts = {})
  data, _status_code, _headers = get_sku_with_http_info(sku_id, opts)
  data
end
import_products_using_csv(opts = {}) click to toggle source

Import Products using CSV Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [ProductsImportCsvCreateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 397
def import_products_using_csv(opts = {})
  data, _status_code, _headers = import_products_using_csv_with_http_info(opts)
  data
end
import_skus_using_csv(opts = {}) click to toggle source

Import SKUs using CSV Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [SkusImportCsvCreateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 462
def import_skus_using_csv(opts = {})
  data, _status_code, _headers = import_skus_using_csv_with_http_info(opts)
  data
end
list_products(opts = {}) click to toggle source

List Products Retrieve a list of products. @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 [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [ProductsListResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 531
def list_products(opts = {})
  data, _status_code, _headers = list_products_with_http_info(opts)
  data
end
list_skus_in_product(product_id, opts = {}) click to toggle source

List SKUs in Product Retrieve all SKUs for a given product. @param product_id [String] A Voucherify product ID or product source ID. @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 [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [ProductsSkusListResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 604
def list_skus_in_product(product_id, opts = {})
  data, _status_code, _headers = list_skus_in_product_with_http_info(product_id, opts)
  data
end
update_product(product_id, opts = {}) click to toggle source

Update Product Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @option opts [ProductsUpdateRequestBody] :products_update_request_body Specify the parameters of the product that are to be updated. @return [ProductsUpdateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 674
def update_product(product_id, opts = {})
  data, _status_code, _headers = update_product_with_http_info(product_id, opts)
  data
end
update_products_in_bulk(opts = {}) click to toggle source

Update Products in Bulk Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [Array<ProductsUpdateInBulkRequestBody>] :products_update_in_bulk_request_body List the product fields to be updated in each customer object. @return [ProductsUpdateInBulkResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 739
def update_products_in_bulk(opts = {})
  data, _status_code, _headers = update_products_in_bulk_with_http_info(opts)
  data
end
update_products_metadata_in_bulk(opts = {}) click to toggle source

Update Products’ Metadata in Bulk Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body List the source_ids of the products you would like to update with the metadata key/value pairs. @return [ProductsMetadataUpdateInBulkResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 803
def update_products_metadata_in_bulk(opts = {})
  data, _status_code, _headers = update_products_metadata_in_bulk_with_http_info(opts)
  data
end
update_sku(product_id, sku_id, opts = {}) click to toggle source

Update SKU Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. @param product_id [String] A unique Voucherify product ID or product source ID. @param sku_id [String] A Voucherify SKU ID or SKU source ID. @param [Hash] opts the optional parameters @option opts [ProductsSkusUpdateRequestBody] :products_skus_update_request_body Specify the parameters to be updated. @return [ProductsSkusUpdateResponseBody]

# File lib/VoucherifySdk/api/products_api.rb, line 869
def update_sku(product_id, sku_id, opts = {})
  data, _status_code, _headers = update_sku_with_http_info(product_id, sku_id, opts)
  data
end

Private Instance Methods

create_product_with_http_info(opts = {}) click to toggle source

Create Product Creates a product object. πŸ“˜ Upsert Mode If you pass an id or a source_id that already exists in the product database, Voucherify will return a related product object with updated fields. @param [Hash] opts the optional parameters @option opts [ProductsCreateRequestBody] :products_create_request_body Specify the product parameters. @return [Array<(ProductsCreateResponseBody, Integer, Hash)>] ProductsCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 37
        def create_product_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.create_product ...'
  end
  # resource path
  local_var_path = '/v1/products'

  # 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[:'products_create_request_body'])

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

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

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

Create SKU This method adds product variants to a created product. πŸ“˜ Upsert Mode If you pass an id or a source_id that already exists in the sku database, Voucherify will return a related sku object with updated fields. @param product_id [String] A Voucherify product ID or product source ID. @param [Hash] opts the optional parameters @option opts [ProductsSkusCreateRequestBody] :products_skus_create_request_body Specify the SKU parameters to be created. @return [Array<(ProductsSkusCreateResponseBody, Integer, Hash)>] ProductsSkusCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 103
        def create_sku_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.create_sku ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}/skus'.sub('{' + 'productId' + '}', CGI.escape(product_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'
  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[:'products_skus_create_request_body'])

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

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

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

Delete Product Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @option opts [Boolean] :force If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 169
        def delete_product_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.delete_product ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

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

  # 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 => :"ProductsApi.delete_product",
    :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: ProductsApi#delete_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_sku_with_http_info(product_id, sku_id, opts = {}) click to toggle source

Delete SKU Deletes a product SKU. This operation cannot be undone. If the force parameter is set to false or not set at all, the SKU will be moved to the bin. @param product_id [String] A unique Voucherify product ID or product source ID. @param sku_id [String] A Voucherify SKU ID or SKU source ID. @param [Hash] opts the optional parameters @option opts [Boolean] :force If this flag is set to true, the SKU will be removed permanently. If it is set to false or not set at all, the SKU will be moved to the bin. Going forward, the user will be able to create another SKU with exactly the same source_id. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 231
        def delete_sku_with_http_info(product_id, sku_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.delete_sku ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}/skus/{skuId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)).sub('{' + 'skuId' + '}', CGI.escape(sku_id.to_s))

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

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

Get Product Retrieve product details. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @return [Array<(ProductsGetResponseBody, Integer, Hash)>] ProductsGetResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 289
        def get_product_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_product ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_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] || 'ProductsGetResponseBody'

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

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

Get SKU Retrieve details of a SKU. @param sku_id [String] A Voucherify SKU identifier or SKU source ID. @param [Hash] opts the optional parameters @return [Array<(SkusGetResponseBody, Integer, Hash)>] SkusGetResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 348
        def get_sku_with_http_info(sku_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.get_sku ...'
  end
  # resource path
  local_var_path = '/v1/skus/{skuId}'.sub('{' + 'skuId' + '}', CGI.escape(sku_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] || 'SkusGetResponseBody'

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

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

Import Products using CSV Import products into the repository using a CSV file. This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [Array<(ProductsImportCsvCreateResponseBody, Integer, Hash)>] ProductsImportCsvCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 407
        def import_products_using_csv_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.import_products_using_csv ...'
  end
  # resource path
  local_var_path = '/v1/products/importCSV'

  # 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(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

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

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

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

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

Import SKUs using CSV Import SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). This API request starts a process that affects Voucherify data in bulk. In case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the IN_PROGRESS status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. The result will return the async ID. You can verify the status of your request via this API request. @param [Hash] opts the optional parameters @option opts [File] :file File path. @return [Array<(SkusImportCsvCreateResponseBody, Integer, Hash)>] SkusImportCsvCreateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 472
        def import_skus_using_csv_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.import_skus_using_csv ...'
  end
  # resource path
  local_var_path = '/v1/skus/importCSV'

  # 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(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

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

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

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

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

List Products Retrieve a list of products. @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 [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [Array<(ProductsListResponseBody, Integer, Hash)>] ProductsListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 545
        def list_products_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.list_products ...'
  end
  # resource path
  local_var_path = '/v1/products'

  # 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?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'ProductsListResponseBody'

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

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

List SKUs in Product Retrieve all SKUs for a given product. @param product_id [String] A Voucherify product ID or product source ID. @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 [ParameterOrder] :order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. @option opts [Time] :start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @option opts [Time] :end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. @return [Array<(ProductsSkusListResponseBody, Integer, Hash)>] ProductsSkusListResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 619
        def list_skus_in_product_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.list_skus_in_product ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}/skus'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s))

  # 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?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].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] || 'ProductsSkusListResponseBody'

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

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

Update Product Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. @param product_id [String] A Voucherify product ID or source ID. @param [Hash] opts the optional parameters @option opts [ProductsUpdateRequestBody] :products_update_request_body Specify the parameters of the product that are to be updated. @return [Array<(ProductsUpdateResponseBody, Integer, Hash)>] ProductsUpdateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 685
        def update_product_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_product ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}'.sub('{' + 'productId' + '}', CGI.escape(product_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'
  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[:'products_update_request_body'])

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

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

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

Update Products in Bulk Update products in one asynchronous operation. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [Array<ProductsUpdateInBulkRequestBody>] :products_update_in_bulk_request_body List the product fields to be updated in each customer object. @return [Array<(ProductsUpdateInBulkResponseBody, Integer, Hash)>] ProductsUpdateInBulkResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 749
        def update_products_in_bulk_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_products_in_bulk ...'
  end
  # resource path
  local_var_path = '/v1/products/bulk/async'

  # 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[:'products_update_in_bulk_request_body'])

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

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

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

Update Products&#39; Metadata in Bulk Updates metadata parameters for a list of products. Every resource in the list will receive the metadata defined in the request. The request can include up to **10 MB** of data. The response returns a unique asynchronous action ID. Use this ID in the query paramater of the GET Async Action endpoint to check, e.g.: - The status of your request (in queue, in progress, done, or failed) - Resources that failed to be updated - The report file with details about the update If a product object is not found, it is upserted. This is shown in the report file in the GET Async Action endpoint. The upserted resources have value false in the found column and true in the updated column. This API request starts a process that affects Voucherify data in bulk. In the case of small jobs (like bulk update), the request is put into a queue and processed when every other bulk request placed in the queue prior to this request is finished. @param [Hash] opts the optional parameters @option opts [ProductsMetadataUpdateInBulkRequestBody] :products_metadata_update_in_bulk_request_body List the source_ids of the products you would like to update with the metadata key/value pairs. @return [Array<(ProductsMetadataUpdateInBulkResponseBody, Integer, Hash)>] ProductsMetadataUpdateInBulkResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 813
        def update_products_metadata_in_bulk_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_products_metadata_in_bulk ...'
  end
  # resource path
  local_var_path = '/v1/products/metadata/async'

  # 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[:'products_metadata_update_in_bulk_request_body'])

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

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

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

Update SKU Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. Fields other than the ones listed in the request body schema wont be modified. Even if provided, they will be silently skipped. @param product_id [String] A unique Voucherify product ID or product source ID. @param sku_id [String] A Voucherify SKU ID or SKU source ID. @param [Hash] opts the optional parameters @option opts [ProductsSkusUpdateRequestBody] :products_skus_update_request_body Specify the parameters to be updated. @return [Array<(ProductsSkusUpdateResponseBody, Integer, Hash)>] ProductsSkusUpdateResponseBody data, response status code and response headers

# File lib/VoucherifySdk/api/products_api.rb, line 881
        def update_sku_with_http_info(product_id, sku_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProductsApi.update_sku ...'
  end
  # resource path
  local_var_path = '/v1/products/{productId}/skus/{skuId}'.sub('{' + 'productId' + '}', CGI.escape(product_id.to_s)).sub('{' + 'skuId' + '}', CGI.escape(sku_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'
  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[:'products_skus_update_request_body'])

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

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

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