Class: VoucherifySdk::VouchersApi
- Inherits:
-
Object
- Object
- VoucherifySdk::VouchersApi
- Defined in:
- lib/VoucherifySdk/api/vouchers_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_voucher(code, opts = {}) ⇒ nil
Delete Voucher Deletes a voucher.
-
#disable_voucher(code, opts = {}) ⇒ VouchersDisableResponseBody
Disable Voucher There are various times when youll want to manage a vouchers accessibility.
-
#enable_voucher(code, opts = {}) ⇒ VouchersEnableResponseBody
Enable Voucher There are various times when youll want to manage a vouchers accessibility.
-
#export_voucher_transactions(code, opts = {}) ⇒ VouchersTransactionsExportCreateResponseBody
Export Voucher Transactions Export transactions that are associated with credit movements on a gift card or loyalty card.
-
#get_voucher(code, opts = {}) ⇒ VouchersGetResponseBody
Get Voucher Retrieves the voucher with the given code or unique Voucherify ID.
-
#import_vouchers_using_csv(file, opts = {}) ⇒ VouchersImportCsvCreateResponseBody
Import Vouchers using CSV Import standalone vouchers into the repository using a CSV file.
-
#initialize(api_client = ApiClient.default) ⇒ VouchersApi
constructor
A new instance of VouchersApi.
-
#list_voucher_transactions(code, opts = {}) ⇒ VouchersTransactionsListResponseBody
List Voucher Transactions List transactions that are associated with credit movements on a gift card or loyalty card.
-
#release_validation_session(code, session_key, opts = {}) ⇒ nil
Release Validation Session Manually release a validation session that has been set up for the voucher.
-
#update_voucher_balance(code, vouchers_balance_update_request_body, opts = {}) ⇒ VouchersBalanceUpdateResponseBody
Add or Remove Voucher Balance Add balance to an existing gift card or loyalty card.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ VouchersApi
Returns a new instance of VouchersApi.
19 20 21 |
# File 'lib/VoucherifySdk/api/vouchers_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/vouchers_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#delete_voucher(code, opts = {}) ⇒ nil
Delete Voucher Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.
28 29 30 31 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 28 def delete_voucher(code, opts = {}) delete_voucher_with_http_info(code, opts) nil end |
#disable_voucher(code, opts = {}) ⇒ VouchersDisableResponseBody
Disable Voucher There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - enable and disable. _ This method sets the voucher state to inactive. The voucher cannot be redeemed.
91 92 93 94 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 91 def disable_voucher(code, opts = {}) data, _status_code, _headers = disable_voucher_with_http_info(code, opts) data end |
#enable_voucher(code, opts = {}) ⇒ VouchersEnableResponseBody
Enable Voucher There are various times when youll want to manage a vouchers accessibility. This can be done by two API methods for managing the voucher state - enable and disable. _ The method sets the voucher state to active. The voucher can be redeemed - only if the redemption occurs after the start date and the voucher is not expired.
154 155 156 157 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 154 def enable_voucher(code, opts = {}) data, _status_code, _headers = enable_voucher_with_http_info(code, opts) data end |
#export_voucher_transactions(code, opts = {}) ⇒ VouchersTransactionsExportCreateResponseBody
Export Voucher Transactions Export transactions that are associated with credit movements on a gift card or loyalty card.
218 219 220 221 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 218 def export_voucher_transactions(code, opts = {}) data, _status_code, _headers = export_voucher_transactions_with_http_info(code, opts) data end |
#get_voucher(code, opts = {}) ⇒ VouchersGetResponseBody
Get Voucher Retrieves the voucher with the given code or unique Voucherify ID. You can either pass the voucher ID which was assigned by Voucherify, e.g., v_7HxHkf4VAkMuc8u4lZs78lyRwhRze5UE, or the code of the voucher as the path parameter value, e.g., 7fjWdr.
287 288 289 290 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 287 def get_voucher(code, opts = {}) data, _status_code, _headers = get_voucher_with_http_info(code, opts) data end |
#import_vouchers_using_csv(file, opts = {}) ⇒ VouchersImportCsvCreateResponseBody
Import Vouchers using CSV Import standalone vouchers into the repository using a CSV file. The CSV file has to include headers in the first line. All properties listed in the file headers that cannot be mapped to standard voucher fields will be added to the metadata object. You can find an example CSV file [here](support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons). _ 📘 Standard voucher fields mapping - Go to the import vouchers endpoint to see all standard CSV fields description (body params section). - Supported CSV file headers: Code,Voucher Type,Value,Discount Type,Category,Start Date,Expiration Date,Redemption Limit,Redeemed Quantity, Redeemed Amount,Active,Additional Info,Custom Metadata Property Name - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. - 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 - Custom code attributes (not supported by-default) need to be added as code metadata. - You **cannot import the same codes** to a single Voucherify Project. 📘 Categories In the structure representing your data, you can define a category that the voucher belongs to. You can later use the category of a voucher to group and search by specific criteria in the Dashboard and using the List Vouchers endpoint. 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.
350 351 352 353 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 350 def import_vouchers_using_csv(file, opts = {}) data, _status_code, _headers = import_vouchers_using_csv_with_http_info(file, opts) data end |
#list_voucher_transactions(code, opts = {}) ⇒ VouchersTransactionsListResponseBody
List Voucher Transactions List transactions that are associated with credit movements on a gift card or loyalty card.
421 422 423 424 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 421 def list_voucher_transactions(code, opts = {}) data, _status_code, _headers = list_voucher_transactions_with_http_info(code, opts) data end |
#release_validation_session(code, session_key, opts = {}) ⇒ nil
Release Validation Session Manually release a validation session that has been set up for the voucher. This method undos the actions that are explained in our guide on how a validation session was established, you can read more here. 📘 Release Session using Dashboard You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](support.voucherify.io/article/16-dashboard-sections#validations).
501 502 503 504 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 501 def release_validation_session(code, session_key, opts = {}) release_validation_session_with_http_info(code, session_key, opts) nil end |
#update_voucher_balance(code, vouchers_balance_update_request_body, opts = {}) ⇒ VouchersBalanceUpdateResponseBody
Add or Remove Voucher Balance Add balance to an existing gift card or loyalty card.
568 569 570 571 |
# File 'lib/VoucherifySdk/api/vouchers_api.rb', line 568 def update_voucher_balance(code, vouchers_balance_update_request_body, opts = {}) data, _status_code, _headers = update_voucher_balance_with_http_info(code, vouchers_balance_update_request_body, opts) data end |