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 = {}) ⇒ CampaignsVouchersCreateResponseBody
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 Permanently deletes a campaign and all related vouchers.
-
#disable_campaign(campaign_id, opts = {}) ⇒ CampaignsDisableResponseBody
Disable Campaign There are various times when youll want to manage a campaigns accessibility.
-
#enable_campaign(campaign_id, opts = {}) ⇒ CampaignsEnableResponseBody
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, file, 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 = {}) ⇒ CampaignsVouchersCreateResponseBody
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.
105 106 107 108 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 105 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.
176 177 178 179 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 176 def create_campaign(opts = {}) data, _status_code, _headers = create_campaign_with_http_info(opts) data end |
#delete_campaign(campaign_id, opts = {}) ⇒ CampaignsDeleteResponseBody
Delete Campaign Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher. 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.
241 242 243 244 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 241 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 = {}) ⇒ CampaignsDisableResponseBody
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.
306 307 308 309 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 306 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 = {}) ⇒ CampaignsEnableResponseBody
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.
369 370 371 372 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 369 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.
432 433 434 435 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 432 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.
496 497 498 499 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 496 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, file, 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.
566 567 568 569 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 566 def import_vouchers_to_campaign_using_csv(campaign_id, file, opts = {}) data, _status_code, _headers = import_vouchers_to_campaign_using_csv_with_http_info(campaign_id, file, 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.
644 645 646 647 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 644 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.
725 726 727 728 |
# File 'lib/VoucherifySdk/api/campaigns_api.rb', line 725 def update_campaign(campaign_id, opts = {}) data, _status_code, _headers = update_campaign_with_http_info(campaign_id, opts) data end |