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

#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:



92
93
94
95
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 92

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:



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

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

#update_customers_consents_client_side(customer_id, opts = {}) ⇒ nil

Update Customer’s consents (client-side) Update marketing permissions for the specified customer.

Parameters:

  • customer_id (String)

    A Voucherify customer identifier or source_id

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

    the optional parameters

Options Hash (opts):

  • :body (Object)

    Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication:

Returns:

  • (nil)


234
235
236
237
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 234

def update_customers_consents_client_side(customer_id, opts = {})
  update_customers_consents_client_side_with_http_info(customer_id, opts)
  nil
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:



302
303
304
305
# File 'lib/VoucherifySdk/api/client_side_api.rb', line 302

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