Class: VoucherifySdk::ClientSideApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ClientSideApi

Returns a new instance of ClientSideApi.



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

def api_client
  @api_client
end

Instance Method Details

#check_eligibility_client_side(opts = {}) ⇒ ClientQualificationsCheckEligibilityResponseBody

Check Eligibility (client-side) Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of Campaign Qualifications, Voucher Qualifications, and Promotions Validation API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version 👍 Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover here. # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables.

Parameters:

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

    the optional parameters

Options Hash (opts):

Returns:



27
28
29
30
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 27

def check_eligibility_client_side(opts = {})
  data, _status_code, _headers = check_eligibility_client_side_with_http_info(opts)
  data
end

#list_promotion_tiers_client_side(origin, opts = {}) ⇒ ClientPromotionsTiersListResponseBody

List Promotion Tiers (client-side) This method enables you to list promotion tiers.

Parameters:

  • origin (String)

    Indicates the origin (scheme, hostname, and port).

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

    the optional parameters

Options Hash (opts):

  • :is_available (Boolean)

    This parameter allows filtering promotions that are only available at the moment. When set to true, it selects only non-expired and active promotions.

  • :limit (Integer)

    Limits the number of objects to be returned. The limit can range between 1 and 100 items.

  • :page (Integer)

    Which page of results to return. The lowest value is 1.

  • :order (ParameterOrderListPromotionTiersClientSide)

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

Returns:



95
96
97
98
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 95

def list_promotion_tiers_client_side(origin, opts = {})
  data, _status_code, _headers = list_promotion_tiers_client_side_with_http_info(origin, opts)
  data
end

#redeem_stacked_discounts_client_side(origin, opts = {}) ⇒ ClientRedemptionsRedeemResponseBody

Redeem Stackable Discounts (client-side) This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: 📘 Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your rollback request.

Parameters:

  • origin (String)

    Indicates the origin (scheme, hostname, and port).

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

    the optional parameters

Options Hash (opts):

Returns:



164
165
166
167
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 164

def redeem_stacked_discounts_client_side(origin, opts = {})
  data, _status_code, _headers = redeem_stacked_discounts_client_side_with_http_info(origin, opts)
  data
end

#track_custom_event_client_side(origin, opts = {}) ⇒ ClientEventsCreateResponseBody

Track Custom Event (client-side) To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created.

Parameters:

  • origin (String)

    Indicates the origin (scheme, hostname, and port).

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

    the optional parameters

Options Hash (opts):

Returns:



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

def track_custom_event_client_side(origin, opts = {})
  data, _status_code, _headers = track_custom_event_client_side_with_http_info(origin, opts)
  data
end

#validate_stacked_discounts_client_side(origin, opts = {}) ⇒ ClientValidationsValidateResponseBody

Validate Stackable Discounts (client-side) Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.

Parameters:

  • origin (String)

    Indicates the origin (scheme, hostname, and port).

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

    the optional parameters

Options Hash (opts):

Returns:



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

def validate_stacked_discounts_client_side(origin, opts = {})
  data, _status_code, _headers = validate_stacked_discounts_client_side_with_http_info(origin, opts)
  data
end