Class: VoucherifySdk::CampaignsApi
- Inherits:
-
Object
- Object
- VoucherifySdk::CampaignsApi
- Defined in:
- lib/VoucherifySdk/api/campaigns_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#add_voucher_with_specific_code_to_campaign(campaign_id, code, opts = {}) ⇒ CampaignsVouchersCreateResponseBody
Add Voucher with Specific Code to Campaign This method gives a possibility to add a new voucher to an existing campaign.
-
#add_vouchers_to_campaign(campaign_id, opts = {}) ⇒ CampaignsVouchersCreateCombinedResponseBody
Add Vouchers to Campaign This method gives the possibility to push new vouchers to an existing campaign.
-
#create_campaign(opts = {}) ⇒ CampaignsCreateResponseBody
Create Campaign Method to create a batch of vouchers aggregated in one campaign.
-
#delete_campaign(campaign_id, opts = {}) ⇒ CampaignsDeleteResponseBody
Delete Campaign Deletes a campaign and all related vouchers.
-
#disable_campaign(campaign_id, opts = {}) ⇒ Object
Disable Campaign There are various times when youll want to manage a campaigns accessibility.
-
#enable_campaign(campaign_id, opts = {}) ⇒ Object
Enable Campaign There are various times when youll want to manage a campaigns accessibility.
-
#get_campaign(campaign_id, opts = {}) ⇒ CampaignsGetResponseBody
Get Campaign Retrieves the campaign with the given campaign ID or campaign name.
-
#import_vouchers_to_campaign(campaign_id, opts = {}) ⇒ CampaignsImportCreateResponseBody
Import Vouchers to Campaign Imports vouchers to an existing campaign.
-
#import_vouchers_to_campaign_using_csv(campaign_id, opts = {}) ⇒ CampaignsImportCsvCreateResponseBody
Import Vouchers to Campaign by CSV Imports vouchers to an existing campaign.
-
#initialize(api_client = ApiClient.default) ⇒ CampaignsApi
constructor
A new instance of CampaignsApi.
-
#list_campaigns(opts = {}) ⇒ CampaignsListResponseBody
List Campaigns Retrieve a list of campaigns in a project.
-
#update_campaign(campaign_id, opts = {}) ⇒ CampaignsUpdateResponseBody
Update Campaign Updates the specified campaign by setting the values of the parameters passed in the request body.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CampaignsApi
Returns a new instance of CampaignsApi.
19 20 21 |
# File 'lib/VoucherifySdk/api/campaigns_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/campaigns_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#add_voucher_with_specific_code_to_campaign(campaign_id, code, opts = {}) ⇒ CampaignsVouchersCreateResponseBody
Add Voucher with Specific Code to Campaign This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.
29 30 31 32 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 29 def add_voucher_with_specific_code_to_campaign(campaign_id, code, opts = {}) data, _status_code, _headers = add_voucher_with_specific_code_to_campaign_with_http_info(campaign_id, code, opts) data end |
#add_vouchers_to_campaign(campaign_id, opts = {}) ⇒ CampaignsVouchersCreateCombinedResponseBody
Add Vouchers to Campaign This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional code_config parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used. 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.
97 98 99 100 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 97 def add_vouchers_to_campaign(campaign_id, opts = {}) data, _status_code, _headers = add_vouchers_to_campaign_with_http_info(campaign_id, opts) data end |
#create_campaign(opts = {}) ⇒ CampaignsCreateResponseBody
Create Campaign Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. 📘 Global uniqueness All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. 🚧 Code generation status This is an asynchronous action; you cant read or modify a newly created campaign until the code generation is completed. See the creation_status field in the campaign object description. 🚧 Standalone Vouchers and Campaigns In version [v20241004](support.voucherify.io/article/23-whats-new-in-voucherify#v20241004), standalone vouchers created through the Voucherify dashboard create a campaign for that voucher. However, you cannot create a standalone discount or gift voucher campaign with the type: STANDALONE through the API. Voucherify developers work on adding that feature. Follow the [Voucherify Release Notes](support.voucherify.io/article/23-whats-new-in-voucherify#v20241004) for more details about released features.
164 165 166 167 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 164 def create_campaign(opts = {}) data, _status_code, _headers = create_campaign_with_http_info(opts) data end |
#delete_campaign(campaign_id, opts = {}) ⇒ CampaignsDeleteResponseBody
Delete Campaign Deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. If the force parameter is set to false or not set at all, the campaign and all related vouchers will be moved to the bin. 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.
229 230 231 232 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 229 def delete_campaign(campaign_id, opts = {}) data, _status_code, _headers = delete_campaign_with_http_info(campaign_id, opts) data end |
#disable_campaign(campaign_id, opts = {}) ⇒ Object
Disable Campaign There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - enable and disable. Sets campaign state to inactive. The vouchers in this campaign can no longer be redeemed.
290 291 292 293 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 290 def disable_campaign(campaign_id, opts = {}) data, _status_code, _headers = disable_campaign_with_http_info(campaign_id, opts) data end |
#enable_campaign(campaign_id, opts = {}) ⇒ Object
Enable Campaign There are various times when youll want to manage a campaigns accessibility. This can be done by two API methods for managing the campaign state - enable and disable. Sets campaign state to active. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired.
349 350 351 352 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 349 def enable_campaign(campaign_id, opts = {}) data, _status_code, _headers = enable_campaign_with_http_info(campaign_id, opts) data end |
#get_campaign(campaign_id, opts = {}) ⇒ CampaignsGetResponseBody
Get Campaign Retrieves the campaign with the given campaign ID or campaign name.
408 409 410 411 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 408 def get_campaign(campaign_id, opts = {}) data, _status_code, _headers = get_campaign_with_http_info(campaign_id, opts) data end |
#import_vouchers_to_campaign(campaign_id, opts = {}) ⇒ CampaignsImportCreateResponseBody
Import Vouchers to Campaign Imports vouchers to an existing campaign. 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.
468 469 470 471 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 468 def import_vouchers_to_campaign(campaign_id, opts = {}) data, _status_code, _headers = import_vouchers_to_campaign_with_http_info(campaign_id, opts) data end |
#import_vouchers_to_campaign_using_csv(campaign_id, opts = {}) ⇒ CampaignsImportCsvCreateResponseBody
Import Vouchers to Campaign by CSV Imports vouchers to an existing campaign. The CSV file has to include headers in the first line. 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.
534 535 536 537 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 534 def import_vouchers_to_campaign_using_csv(campaign_id, opts = {}) data, _status_code, _headers = import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, opts) data end |
#list_campaigns(opts = {}) ⇒ CampaignsListResponseBody
List Campaigns Retrieve a list of campaigns in a project. The campaigns are returned sorted by creation date, with the most recent campaigns appearing first. When you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using limit, which page of campaigns to return using page, sort the campaigns using the order query parameter and filter the results by the campaign_type. This method will return an error when trying to return a limit of more than 100 campaigns.
605 606 607 608 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 605 def list_campaigns(opts = {}) data, _status_code, _headers = list_campaigns_with_http_info(opts) data end |
#update_campaign(campaign_id, opts = {}) ⇒ CampaignsUpdateResponseBody
Update Campaign Updates the specified campaign 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 wont be modified. Even if provided, they will be silently skipped. ## Vouchers will be affected This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet.
676 677 678 679 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 676 def update_campaign(campaign_id, opts = {}) data, _status_code, _headers = update_campaign_with_http_info(campaign_id, opts) data end |