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 This method deletes a product.

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 will be removed permanently. Going forward, the user will be able to create another product with exactly the same source_id.

Returns:

  • (nil)


162
163
164
165
# File 'lib/VoucherifySdk/api/products_api.rb', line 162

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 This method deletes a product SKU.

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. Going forward, the user will be able to create another SKU with exactly the same source_id.

Returns:

  • (nil)


227
228
229
230
# File 'lib/VoucherifySdk/api/products_api.rb', line 227

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:



295
296
297
298
# File 'lib/VoucherifySdk/api/products_api.rb', line 295

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:



358
359
360
361
# File 'lib/VoucherifySdk/api/products_api.rb', line 358

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

#import_products_using_csv(file, 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:

  • file (File)

    File path.

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

    the optional parameters

Returns:



421
422
423
424
# File 'lib/VoucherifySdk/api/products_api.rb', line 421

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

#import_skus_using_csv(file, 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:

  • file (File)

    File path.

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

    the optional parameters

Returns:



490
491
492
493
# File 'lib/VoucherifySdk/api/products_api.rb', line 490

def import_skus_using_csv(file, opts = {})
  data, _status_code, _headers = import_skus_using_csv_with_http_info(file, 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)

    A limit on the number of objects to be returned. Limit can range between 1 and 100 items.

  • :page (Integer)

    Which page of results to return.

  • :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:



563
564
565
566
# File 'lib/VoucherifySdk/api/products_api.rb', line 563

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)

    A limit on the number of objects to be returned. Limit can range between 1 and 100 items.

  • :page (Integer)

    Which page of results to return.

  • :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:



648
649
650
651
# File 'lib/VoucherifySdk/api/products_api.rb', line 648

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:



734
735
736
737
# File 'lib/VoucherifySdk/api/products_api.rb', line 734

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 several products in one asynchronous operation. In one request, it is possible to update a maximum of 100 records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an upsert occurs. This is reflected in the Get Async Action endpoint as follows: 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):

  • :products_update_in_bulk_request_body (Array<ProductsUpdateInBulkRequestBody>)

    Create an array of product objects, each with the parameters which you want to update.

Returns:



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

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 Update several product metadata properties in one asynchronous operation. In one request, it is possible to update a maximum of 100 records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an upsert occurs. This is reflected in the Get Async Action endpoint as follows: 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):

  • :products_metadata_update_in_bulk_request_body (ProductsMetadataUpdateInBulkRequestBody)

    Specify the list of product source IDs and the metadata key value pairs to be udpated for these products.

Returns:



867
868
869
870
# File 'lib/VoucherifySdk/api/products_api.rb', line 867

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:



933
934
935
936
# File 'lib/VoucherifySdk/api/products_api.rb', line 933

def update_sku(product_id, sku_id, opts = {})
  data, _status_code, _headers = update_sku_with_http_info(product_id, sku_id, opts)
  data
end