Class: VoucherifySdk::ProductsApi
- Inherits:
-
Object
- Object
- VoucherifySdk::ProductsApi
- Defined in:
- lib/VoucherifySdk/api/products_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_product(opts = {}) ⇒ ProductsCreateResponseBody
Create Product Creates a product object.
-
#create_sku(product_id, opts = {}) ⇒ ProductsSkusCreateResponseBody
Create SKU This method adds product variants to a created product.
-
#delete_product(product_id, opts = {}) ⇒ nil
Delete Product Deletes a product and all related SKUs.
-
#delete_sku(product_id, sku_id, opts = {}) ⇒ nil
Delete SKU Deletes a product SKU.
-
#get_product(product_id, opts = {}) ⇒ ProductsGetResponseBody
Get Product Retrieve details of a given product and its SKUs, if any.
-
#get_sku(sku_id, opts = {}) ⇒ SkusGetResponseBody
Get SKU Retrieve details of a SKU.
-
#import_products_using_csv(opts = {}) ⇒ ProductsImportCsvCreateResponseBody
Import Products using CSV Import products into the repository using a CSV file.
-
#import_skus_using_csv(opts = {}) ⇒ SkusImportCsvCreateResponseBody
Import SKUs using CSV Import SKUs into the repository using a CSV file.
-
#initialize(api_client = ApiClient.default) ⇒ ProductsApi
constructor
A new instance of ProductsApi.
-
#list_products(opts = {}) ⇒ ProductsListResponseBody
List Products Retrieve a list of products.
-
#list_skus_in_product(product_id, opts = {}) ⇒ ProductsSkusListResponseBody
List SKUs in Product Retrieve all SKUs for a given product.
-
#update_product(product_id, opts = {}) ⇒ ProductsUpdateResponseBody
Update Product Updates the specified product by setting the values of the parameters passed in the request body.
-
#update_products_in_bulk(opts = {}) ⇒ ProductsUpdateInBulkResponseBody
Update Products in Bulk Update products in one asynchronous operation.
-
#update_products_metadata_in_bulk(opts = {}) ⇒ ProductsMetadataUpdateInBulkResponseBody
Update Products' Metadata in Bulk Updates metadata parameters for a list of products.
-
#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.
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_client ⇒ Object
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.
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.
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.
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.
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 details of a given product and its SKUs, if any.
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.
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. The CSV file has to include headers in the first line. 📘 Standard product fields mapping - Create a comma separated value (CSV) file or download our CSV import template. You can find an example template here. - Supported CSV file headers: name,source_id,price,attributes,image_url,Metadata_property_name - Name is a required field. The remaining fields in the CSV template are optional. - Override/Update products names in Voucherify using this method. Data will be updated for each product included in the CSV file whose source_id matches a source ID in Voucherify. No other data can be updated other than the product name. - Note that dates and date-time attributes need to be provided in compliance with the ISO 8601 standard. For example, 2022-03-11T09:00:00.000Z or 2022-03-11 - YYYY-MM-DD - YYYY-MM-DDTHH - YYYY-MM-DDTHH:mm - YYYY-MM-DDTHH:mm:ss - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ssZ - YYYY-MM-DDTHH:mm:ss.SSSZ - Columns that cannot be mapped to standard fields, will be mapped to Custom attributes and added as products metadata. There is no limit on the number of custom attributes that you can import as metadata. - To provide the proper data type, you need to add all custom attributes to the metadata schema before importing the file. Read more here. - Product attributes (not custom attributes) need to be separated by a comma and enclosed in double quotes, i.e attribute1,attribute2. - Headers with metadata names cant contain white-space characters. - If you import metadata defined in the schema as arrays (multiple), you need to separate each value using a comma, for example: - array of strings: subscribed,premium - array of numbers: 123,234. - array of dates: 2000-01-01,2000-01-02 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.
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. 🚧 Import sequence First import products using the dedicated endpoint, then import SKUs using this endpoint to properly match SKUs to products. 📘 Standard SKU fields mapping - Required fields are source_id and product_id. - Supported CSV file headers: product_id,sku,source_id,price,image_url,attributes - SKU source_id must be unique in the entire product catalog, no duplicates are allowed. - SKU attributes need to be in the form of a stringy-fied json, i.e.color:blue. These attributes must be defined in the product beforehand so you can import them to the SKU. - You can use this method to update the following parameters in bulk: sku and the sku price. - Columns that cannot be mapped to standard fields will be mapped to Custom attributes and added as product metadata. There is no limit on the number of custom attributes that you can import as metadata. 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.
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.
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.
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.
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.
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.
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.
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 |