Class: VoucherifySdk::ProductsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/VoucherifySdk/api/products_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProductsApi

Returns a new instance of ProductsApi.



19
20
21
# File 'lib/VoucherifySdk/api/products_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/VoucherifySdk/api/products_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_product(opts = {}) ⇒ ProductsCreateResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



27
28
29
30
# 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 = {}) ⇒ ProductsSkusCreateResponseBody

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.

Parameters:

  • product_id (String)

    A Voucherify product ID or product source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



92
93
94
95
# 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 = {}) ⇒ nil

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.

Parameters:

  • product_id (String)

    A Voucherify product ID or source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :force (Boolean)

    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.

Returns:

  • (nil)


158
159
160
161
# 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 = {}) ⇒ nil

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.

Parameters:

  • product_id (String)

    A unique Voucherify product ID or product source ID.

  • sku_id (String)

    A Voucherify SKU ID or SKU source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :force (Boolean)

    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.

Returns:

  • (nil)


219
220
221
222
# 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 = {}) ⇒ ProductsGetResponseBody

Get Product Retrieve product details.

Parameters:

  • product_id (String)

    A Voucherify product ID or source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



279
280
281
282
# 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 = {}) ⇒ SkusGetResponseBody

Get SKU Retrieve details of a SKU.

Parameters:

  • sku_id (String)

    A Voucherify SKU identifier or SKU source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



338
339
340
341
# 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 = {}) ⇒ ProductsImportCsvCreateResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :file (File)

    File path.

Returns:



397
398
399
400
# 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 = {}) ⇒ SkusImportCsvCreateResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :file (File)

    File path.

Returns:



462
463
464
465
# 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 = {}) ⇒ ProductsListResponseBody

List Products Retrieve a list of products.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :page (Integer)

    Which page of results to return. The lowest value is 1.

  • :order (ParameterOrder)

    Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

  • :start_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

  • :end_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

Returns:



531
532
533
534
# 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 = {}) ⇒ ProductsSkusListResponseBody

List SKUs in Product Retrieve all SKUs for a given product.

Parameters:

  • product_id (String)

    A Voucherify product ID or product source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    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.

  • :page (Integer)

    Which page of results to return. The lowest value is 1.

  • :order (ParameterOrder)

    Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

  • :start_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

  • :end_date (Time)

    Timestamp representing the date and time which results must end on. Represented in ISO 8601 format.

Returns:



604
605
606
607
# 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 = {}) ⇒ ProductsUpdateResponseBody

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.

Parameters:

  • product_id (String)

    A Voucherify product ID or source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :products_update_request_body (ProductsUpdateRequestBody)

    Specify the parameters of the product that are to be updated.

Returns:



674
675
676
677
# 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 = {}) ⇒ ProductsUpdateInBulkResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



739
740
741
742
# 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 = {}) ⇒ ProductsMetadataUpdateInBulkResponseBody

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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



803
804
805
806
# File 'lib/VoucherifySdk/api/products_api.rb', line 803

def (opts = {})
  data, _status_code, _headers = (opts)
  data
end

#update_sku(product_id, sku_id, opts = {}) ⇒ ProductsSkusUpdateResponseBody

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.

Parameters:

  • product_id (String)

    A unique Voucherify product ID or product source ID.

  • sku_id (String)

    A Voucherify SKU ID or SKU source ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



869
870
871
872
# 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