Class: VoucherifySdk::LoyaltiesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/VoucherifySdk/api/loyalties_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LoyaltiesApi

Returns a new instance of LoyaltiesApi.



19
20
21
# File 'lib/VoucherifySdk/api/loyalties_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/loyalties_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_in_bulk_loyalty_tiers(campaign_id, opts = {}) ⇒ Array<LoyaltyTier>

Create loyalty tiers Creates loyalty tiers for desired campaign.

Parameters:

  • campaign_id (String)

    Unique loyalty campaign ID or name.

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

    the optional parameters

Options Hash (opts):

Returns:



28
29
30
31
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 28

def create_in_bulk_loyalty_tiers(campaign_id, opts = {})
  data, _status_code, _headers = create_in_bulk_loyalty_tiers_with_http_info(campaign_id, opts)
  data
end

#delete_earning_rule(campaign_id, earning_rule_id, opts = {}) ⇒ nil

Delete Earning Rule This method deletes an earning rule for a specific loyalty campaign.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • earning_rule_id (String)

    A unique earning rule ID.

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

    the optional parameters

Returns:

  • (nil)


98
99
100
101
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 98

def delete_earning_rule(campaign_id, earning_rule_id, opts = {})
  delete_earning_rule_with_http_info(campaign_id, earning_rule_id, opts)
  nil
end

#delete_loyalty_program(campaign_id, opts = {}) ⇒ LoyaltiesDeleteResponseBody

Delete Loyalty Campaign This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

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

    the optional parameters

Options Hash (opts):

  • :force (Boolean)

    If this flag is set to true, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name.

Returns:



165
166
167
168
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 165

def delete_loyalty_program(campaign_id, opts = {})
  data, _status_code, _headers = delete_loyalty_program_with_http_info(campaign_id, opts)
  data
end

#delete_reward_assignment1(campaign_id, assignment_id, opts = {}) ⇒ nil

Delete Reward Assignment This method deletes a reward assignment for a particular loyalty campaign.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • assignment_id (String)

    A unique reward assignment ID.

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

    the optional parameters

Returns:

  • (nil)


231
232
233
234
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 231

def delete_reward_assignment1(campaign_id, assignment_id, opts = {})
  delete_reward_assignment1_with_http_info(campaign_id, assignment_id, opts)
  nil
end

#disable_earning_rule(campaign_id, earning_rule_id, opts = {}) ⇒ LoyaltiesEarningRulesDisableResponseBody

Disable Earning Rule Disable an earning rule.

Parameters:

  • campaign_id (String)

    Unique campaign ID or name.

  • earning_rule_id (String)

    Unique earning rule ID.

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

    the optional parameters

Returns:



298
299
300
301
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 298

def disable_earning_rule(campaign_id, earning_rule_id, opts = {})
  data, _status_code, _headers = disable_earning_rule_with_http_info(campaign_id, earning_rule_id, opts)
  data
end

#enable_earning_rule(campaign_id, earning_rule_id, opts = {}) ⇒ LoyaltiesEarningRulesEnableResponseBody

Enable Earning Rule Enable an earning rule.

Parameters:

  • campaign_id (String)

    Unique campaign ID or name.

  • earning_rule_id (String)

    Unique earning rule ID.

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

    the optional parameters

Returns:



367
368
369
370
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 367

def enable_earning_rule(campaign_id, earning_rule_id, opts = {})
  data, _status_code, _headers = enable_earning_rule_with_http_info(campaign_id, earning_rule_id, opts)
  data
end

#export_loyalty_card_transactions(member_id, opts = {}) ⇒ LoyaltiesMembersTransactionsExportCreateResponseBody

Export Loyalty Card Transactions Export transactions that are associated with point movements on a loyalty card.

Parameters:

  • member_id (String)

    A unique code identifying the loyalty card that you are looking to export transaction data for.

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

    the optional parameters

Options Hash (opts):

Returns:



436
437
438
439
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 436

def export_loyalty_card_transactions(member_id, opts = {})
  data, _status_code, _headers = export_loyalty_card_transactions_with_http_info(member_id, opts)
  data
end

#export_loyalty_card_transactions1(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersTransactionsExportCreateResponseBody

Export Loyalty Card Transactions Export transactions that are associated with point movements on a loyalty card.

Parameters:

  • campaign_id (String)

    A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export.

  • member_id (String)

    A unique code identifying the loyalty card that you are looking to export transaction data for.

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

    the optional parameters

Options Hash (opts):

Returns:



507
508
509
510
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 507

def export_loyalty_card_transactions1(campaign_id, member_id, opts = {})
  data, _status_code, _headers = export_loyalty_card_transactions1_with_http_info(campaign_id, member_id, opts)
  data
end

#get_earning_rule(campaign_id, earning_rule_id, opts = {}) ⇒ LoyaltiesEarningRulesGetResponseBody

Get Earning Rule Retrieves an earning rule assigned to a campaign.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • earning_rule_id (String)

    A unique earning rule ID.

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

    the optional parameters

Returns:



582
583
584
585
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 582

def get_earning_rule(campaign_id, earning_rule_id, opts = {})
  data, _status_code, _headers = get_earning_rule_with_http_info(campaign_id, earning_rule_id, opts)
  data
end

#get_loyalty_tier(campaign_id, loyalty_tier_id, opts = {}) ⇒ LoyaltiesTiersGetResponseBody

Get Loyalty Tier Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID.

Parameters:

  • campaign_id (String)

    Unique loyalty campaign ID or name.

  • loyalty_tier_id (String)

    Unique loyalty tier ID.

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

    the optional parameters

Returns:



651
652
653
654
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 651

def get_loyalty_tier(campaign_id, loyalty_tier_id, opts = {})
  data, _status_code, _headers = get_loyalty_tier_with_http_info(campaign_id, loyalty_tier_id, opts)
  data
end

#get_reward_assignment1(campaign_id, assignment_id, opts = {}) ⇒ LoyaltiesRewardAssignmentsGetResponseBody

Get Reward Assignment Retrieve specific reward assignment.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • assignment_id (String)

    Unique reward assignment ID.

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

    the optional parameters

Returns:



720
721
722
723
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 720

def get_reward_assignment1(campaign_id, assignment_id, opts = {})
  data, _status_code, _headers = get_reward_assignment1_with_http_info(campaign_id, assignment_id, opts)
  data
end

#get_reward_assignment2(campaign_id, assignment_id, opts = {}) ⇒ LoyaltiesRewardsGetResponseBody

Get Reward Assignment Retrieve specific reward assignment. 📘 Alternative endpoint This endpoint is an alternative to this endpoint.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • assignment_id (String)

    A unique reward assignment ID.

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

    the optional parameters

Returns:



789
790
791
792
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 789

def get_reward_assignment2(campaign_id, assignment_id, opts = {})
  data, _status_code, _headers = get_reward_assignment2_with_http_info(campaign_id, assignment_id, opts)
  data
end

#get_reward_details(campaign_id, assignment_id, opts = {}) ⇒ LoyaltiesRewardAssignmentsRewardGetResponseBody

Get Reward Details Get reward details in the context of a loyalty campaign and reward assignment ID.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • assignment_id (String)

    Unique reward assignment ID.

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

    the optional parameters

Returns:



858
859
860
861
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 858

def get_reward_details(campaign_id, assignment_id, opts = {})
  data, _status_code, _headers = get_reward_details_with_http_info(campaign_id, assignment_id, opts)
  data
end

#list_loyalty_card_transactions(member_id, opts = {}) ⇒ LoyaltiesMembersTransactionsListResponseBody

List Loyalty Card Transactions Retrieve transaction data related to point movements for a specific loyalty card.

Parameters:

  • member_id (String)

    A unique code identifying the loyalty card that you are looking to retrieve transaction data for.

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

Returns:



928
929
930
931
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 928

def list_loyalty_card_transactions(member_id, opts = {})
  data, _status_code, _headers = list_loyalty_card_transactions_with_http_info(member_id, opts)
  data
end

#list_loyalty_card_transactions1(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersTransactionsListResponseBody

List Loyalty Card Transactions Retrieve transaction data related to point movements for a specific loyalty card.

Parameters:

  • campaign_id (String)

    A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return.

  • member_id (String)

    A unique code identifying the loyalty card that you are looking to retrieve transaction data for.

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

Returns:



1010
1011
1012
1013
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1010

def list_loyalty_card_transactions1(campaign_id, member_id, opts = {})
  data, _status_code, _headers = list_loyalty_card_transactions1_with_http_info(campaign_id, member_id, opts)
  data
end

#list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {}) ⇒ LoyaltiesTiersEarningRulesListResponseBody

List Loyalty Tier Earning Rules Retrieve available earning rules for a given tier and the calculation method for earning points.

Parameters:

  • campaign_id (String)

    Unique campaign ID or name.

  • loyalty_tier_id (String)

    Unique loyalty tier 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.

Returns:



1097
1098
1099
1100
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1097

def list_loyalty_tier_earning_rules(campaign_id, loyalty_tier_id, opts = {})
  data, _status_code, _headers = list_loyalty_tier_earning_rules_with_http_info(campaign_id, loyalty_tier_id, opts)
  data
end

#list_loyalty_tier_rewards(campaign_id, loyalty_tier_id, opts = {}) ⇒ LoyaltiesTiersRewardsListResponseBody

List Loyalty Tier Rewards Get available rewards for a given tier.

Parameters:

  • campaign_id (String)

    Unique campaign ID or name.

  • loyalty_tier_id (String)

    Unique loyalty tier ID.

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

    the optional parameters

Returns:



1182
1183
1184
1185
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1182

def list_loyalty_tier_rewards(campaign_id, loyalty_tier_id, opts = {})
  data, _status_code, _headers = list_loyalty_tier_rewards_with_http_info(campaign_id, loyalty_tier_id, opts)
  data
end

#list_loyalty_tiers(campaign_id, opts = {}) ⇒ LoyaltiesTiersListResponseBody

List Loyalty Tiers Retrieve a list of loyalty tiers which were added to the loyalty program.

Parameters:

  • campaign_id (String)

    Unique loyalty campaign ID or name.

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

  • :order (ParameterOrderListLoyaltyTiers)

    Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order.

Returns:



1252
1253
1254
1255
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1252

def list_loyalty_tiers(campaign_id, opts = {})
  data, _status_code, _headers = list_loyalty_tiers_with_http_info(campaign_id, opts)
  data
end

#list_member_loyalty_tier(member_id, opts = {}) ⇒ LoyaltiesMembersTiersListResponseBody

List Member’s Loyalty Tiers Retrieve member tiers using the loyalty card ID.

Parameters:

  • member_id (String)

    Unique loyalty card assigned to a particular customer.

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

    the optional parameters

Returns:



1327
1328
1329
1330
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1327

def list_member_loyalty_tier(member_id, opts = {})
  data, _status_code, _headers = list_member_loyalty_tier_with_http_info(member_id, opts)
  data
end

#list_member_rewards(member_id, opts = {}) ⇒ LoyaltiesMembersRewardsListResponseBody

List Member Rewards Retrieves the list of rewards that the given customer (identified by member_id, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. You can use the affordable_only parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Please note that rewards that are disabled (i.e. set to Not Available in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint.

Parameters:

  • member_id (String)

    Unique loyalty card assigned to a particular customer.

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

    the optional parameters

Options Hash (opts):

  • :affordable_only (Boolean)

    Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to true to return rewards which the customer can actually afford.

Returns:



1391
1392
1393
1394
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1391

def list_member_rewards(member_id, opts = {})
  data, _status_code, _headers = list_member_rewards_with_http_info(member_id, opts)
  data
end

#list_points_expiration(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersPointsExpirationListResponseBody

Get Points Expiration Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the Exports API to retrieve a list of both ACTIVE and EXPIRED point buckets.

Parameters:

  • campaign_id (String)

    The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value, e.g., Loyalty%20Campaign.

  • member_id (String)

    Loyalty card code.

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

Returns:



1459
1460
1461
1462
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1459

def list_points_expiration(campaign_id, member_id, opts = {})
  data, _status_code, _headers = list_points_expiration_with_http_info(campaign_id, member_id, opts)
  data
end

#redeem_reward(member_id, opts = {}) ⇒ LoyaltiesMembersRedemptionRedeemResponseBody

Redeem Reward

📘 Alternative endpoint  This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to redeem a reward without having to provide the campaignId as a path parameter.

Parameters:

  • member_id (String)

    Unique loyalty card assigned to a particular customer.

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

    the optional parameters

Options Hash (opts):

  • :loyalties_members_redemption_redeem_request_body (LoyaltiesMembersRedemptionRedeemRequestBody)

    Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.

Returns:



1544
1545
1546
1547
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1544

def redeem_reward(member_id, opts = {})
  data, _status_code, _headers = redeem_reward_with_http_info(member_id, opts)
  data
end

#redeem_reward1(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersRedemptionRedeemResponseBody

Redeem Reward Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition.

Parameters:

  • campaign_id (String)

    Unique campaign ID.

  • member_id (String)

    A code that identifies the loyalty card.

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

    the optional parameters

Options Hash (opts):

  • :loyalties_members_redemption_redeem_request_body (LoyaltiesMembersRedemptionRedeemRequestBody)

    Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.

Returns:



1615
1616
1617
1618
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1615

def redeem_reward1(campaign_id, member_id, opts = {})
  data, _status_code, _headers = redeem_reward1_with_http_info(campaign_id, member_id, opts)
  data
end

#transfer_points(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersTransfersCreateResponseBody

Transfer Loyalty Points Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.

Parameters:

  • campaign_id (String)

    A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination).

  • member_id (String)

    A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination).

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

    the optional parameters

Options Hash (opts):

  • :loyalties_transfer_points (Array<LoyaltiesTransferPoints>)

    Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.

Returns:



1691
1692
1693
1694
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1691

def transfer_points(campaign_id, member_id, opts = {})
  data, _status_code, _headers = transfer_points_with_http_info(campaign_id, member_id, opts)
  data
end

#update_loyalty_card_balance(member_id, opts = {}) ⇒ LoyaltiesMembersBalanceUpdateResponseBody

Add or Remove Loyalty Card Balance This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. 📘 Alternative endpoint This endpoint is an alternative to this endpoint. The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the campaignId as a path parameter.

Parameters:

  • member_id (String)

    Unique loyalty card assigned to a particular customer.

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

    the optional parameters

Options Hash (opts):

Returns:



1766
1767
1768
1769
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1766

def update_loyalty_card_balance(member_id, opts = {})
  data, _status_code, _headers = update_loyalty_card_balance_with_http_info(member_id, opts)
  data
end

#update_loyalty_card_balance1(campaign_id, member_id, opts = {}) ⇒ LoyaltiesMembersBalanceUpdateResponseBody

Add or Remove Loyalty Card Balance This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest.

Parameters:

  • campaign_id (String)

    Unique campaign ID.

  • member_id (String)

    A code that identifies the loyalty card.

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

    the optional parameters

Options Hash (opts):

Returns:



1837
1838
1839
1840
# File 'lib/VoucherifySdk/api/loyalties_api.rb', line 1837

def update_loyalty_card_balance1(campaign_id, member_id, opts = {})
  data, _status_code, _headers = update_loyalty_card_balance1_with_http_info(campaign_id, member_id, opts)
  data
end