Class: Square::LoyaltyApi
- Defined in:
- lib/square/api/loyalty_api.rb
Overview
LoyaltyApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#accumulate_loyalty_points(account_id:, body:) ⇒ ApiResponse
Adds points earned from a purchase to a [loyalty account]($m/LoyaltyAccount).
-
#adjust_loyalty_points(account_id:, body:) ⇒ ApiResponse
Adds points to or subtracts points from a buyer’s account.
-
#calculate_loyalty_points(program_id:, body:) ⇒ ApiResponse
Calculates the number of points a buyer can earn from a purchase.
-
#cancel_loyalty_promotion(promotion_id:, program_id:) ⇒ ApiResponse
Cancels a loyalty promotion.
-
#create_loyalty_account(body:) ⇒ ApiResponse
Creates a loyalty account.
-
#create_loyalty_promotion(program_id:, body:) ⇒ ApiResponse
Creates a loyalty promotion for a [loyalty program]($m/LoyaltyProgram).
-
#create_loyalty_reward(body:) ⇒ ApiResponse
Creates a loyalty reward.
-
#delete_loyalty_reward(reward_id:) ⇒ ApiResponse
Deletes a loyalty reward by doing the following: - Returns the loyalty points back to the loyalty account.
-
#list_loyalty_programs ⇒ ApiResponse
Returns a list of loyalty programs in the seller’s account.
-
#list_loyalty_promotions(program_id:, status: nil, cursor: nil, limit: nil) ⇒ ApiResponse
Lists the loyalty promotions associated with a [loyalty program]($m/LoyaltyProgram).
-
#redeem_loyalty_reward(reward_id:, body:) ⇒ ApiResponse
Redeems a loyalty reward.
-
#retrieve_loyalty_account(account_id:) ⇒ ApiResponse
Retrieves a loyalty account.
-
#retrieve_loyalty_program(program_id:) ⇒ ApiResponse
Retrieves the loyalty program in a seller’s account, specified by the program ID or the keyword ‘main`.
-
#retrieve_loyalty_promotion(promotion_id:, program_id:) ⇒ ApiResponse
Retrieves a loyalty promotion.
-
#retrieve_loyalty_reward(reward_id:) ⇒ ApiResponse
Retrieves a loyalty reward.
-
#search_loyalty_accounts(body:) ⇒ ApiResponse
Searches for loyalty accounts in a loyalty program.
-
#search_loyalty_events(body:) ⇒ ApiResponse
Searches for loyalty events.
-
#search_loyalty_rewards(body:) ⇒ ApiResponse
Searches for loyalty rewards.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#accumulate_loyalty_points(account_id:, body:) ⇒ ApiResponse
Adds points earned from a purchase to a [loyalty account]($m/LoyaltyAccount).
-
If you are using the Orders API to manage orders, provide the
‘order_id`. Square reads the order to compute the points earned from both the base loyalty program and an associated [loyalty promotion]($m/LoyaltyPromotion). For purchases that qualify for multiple accrual rules, Square computes points based on the accrual rule that grants the most points. For purchases that qualify for multiple promotions, Square computes points based on the most recently created promotion. A purchase must first qualify for program points to be eligible for promotion points.
-
If you are not using the Orders API to manage orders, provide ‘points`
with the number of points to add. You must first perform a client-side computation of the points earned from the loyalty program and loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints]($e/Loyalty/CalculateLoyaltyPoints) to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see [Calculating promotion points](developer.squareup.com/docs/loyalty-api/loyalty-promotions #calculate-promotion-points). [loyalty account](entity:LoyaltyAccount). containing the fields to POST for the request. See the corresponding object definition for field details.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/square/api/loyalty_api.rb', line 104 def accumulate_loyalty_points(account_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/accounts/{account_id}/accumulate', 'default') .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#adjust_loyalty_points(account_id:, body:) ⇒ ApiResponse
Adds points to or subtracts points from a buyer’s account. Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call [AccumulateLoyaltyPoints]($e/Loyalty/AccumulateLoyaltyPoints) to add points when a buyer pays for the purchase. [loyalty account](entity:LoyaltyAccount). containing the fields to POST for the request. See the corresponding object definition for field details.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/square/api/loyalty_api.rb', line 135 def adjust_loyalty_points(account_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/accounts/{account_id}/adjust', 'default') .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#calculate_loyalty_points(program_id:, body:) ⇒ ApiResponse
Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint to display the points to the buyer.
-
If you are using the Orders API to manage orders, provide the ‘order_id`
and (optional) ‘loyalty_account_id`. Square reads the order to compute the points earned from the base loyalty program and an associated [loyalty promotion]($m/LoyaltyPromotion).
-
If you are not using the Orders API to manage orders, provide
‘transaction_amount_money` with the purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. If the purchase qualifies for program points, call [ListLoyaltyPromotions]($e/Loyalty/ListLoyaltyPromotions) and perform a client-side computation to calculate whether the purchase also qualifies for promotion points. For more information, see [Calculating promotion points](developer.squareup.com/docs/loyalty-api/loyalty-promotions #calculate-promotion-points). program](entity:LoyaltyProgram), which defines the rules for accruing points. containing the fields to POST for the request. See the corresponding object definition for field details.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/square/api/loyalty_api.rb', line 267 def calculate_loyalty_points(program_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/programs/{program_id}/calculate', 'default') .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#cancel_loyalty_promotion(promotion_id:, program_id:) ⇒ ApiResponse
Cancels a loyalty promotion. Use this endpoint to cancel an ‘ACTIVE` promotion earlier than the end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion. Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before you create a new one. This endpoint sets the loyalty promotion to the `CANCELED` state promotion](entity:LoyaltyPromotion) to cancel. You can cancel a promotion that has an `ACTIVE` or `SCHEDULED` status. program](entity:LoyaltyProgram).
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/square/api/loyalty_api.rb', line 412 def cancel_loyalty_promotion(promotion_id:, program_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/programs/{program_id}/promotions/{promotion_id}/cancel', 'default') .template_param(new_parameter(promotion_id, key: 'promotion_id') .should_encode(true)) .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_loyalty_account(body:) ⇒ ApiResponse
Creates a loyalty account. To create a loyalty account, you must provide the ‘program_id` and a `mapping` with the `phone_number` of the buyer. containing the fields to POST for the request. See the corresponding object definition for field details.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/square/api/loyalty_api.rb', line 10 def create_loyalty_account(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/accounts', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_loyalty_promotion(program_id:, body:) ⇒ ApiResponse
Creates a loyalty promotion for a [loyalty program]($m/LoyaltyProgram). A loyalty promotion enables buyers to earn points in addition to those earned from the base loyalty program. This endpoint sets the loyalty promotion to the ‘ACTIVE` or `SCHEDULED` status, depending on the `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. program](entity:LoyaltyProgram) to associate with the promotion. To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. containing the fields to POST for the request. See the corresponding object definition for field details.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/square/api/loyalty_api.rb', line 351 def create_loyalty_promotion(program_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/programs/{program_id}/promotions', 'default') .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_loyalty_reward(body:) ⇒ ApiResponse
Creates a loyalty reward. In the process, the endpoint does following:
-
Uses the ‘reward_tier_id` in the request to determine the number of
points to lock for this reward.
-
If the request includes ‘order_id`, it adds the reward and related
discount to the order. After a reward is created, the points are locked and not available for the buyer to redeem another reward. containing the fields to POST for the request. See the corresponding object definition for field details.
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/square/api/loyalty_api.rb', line 443 def create_loyalty_reward(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/rewards', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_loyalty_reward(reward_id:) ⇒ ApiResponse
Deletes a loyalty reward by doing the following:
-
Returns the loyalty points back to the loyalty account.
-
If an order ID was specified when the reward was created
(see [CreateLoyaltyReward]($e/Loyalty/CreateLoyaltyReward)), it updates the order by removing the reward and related discounts. You cannot delete a reward that has reached the terminal state (REDEEMED). reward](entity:LoyaltyReward) to delete.
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/square/api/loyalty_api.rb', line 498 def delete_loyalty_reward(reward_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/loyalty/rewards/{reward_id}', 'default') .template_param(new_parameter(reward_id, key: 'reward_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_loyalty_programs ⇒ ApiResponse
Returns a list of loyalty programs in the seller’s account. Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](developer.squareup.com/docs/loyalty/overview). Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword ‘main`.
194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/square/api/loyalty_api.rb', line 194 def list_loyalty_programs warn 'Endpoint list_loyalty_programs in LoyaltyApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/programs', 'default') .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_loyalty_promotions(program_id:, status: nil, cursor: nil, limit: nil) ⇒ ApiResponse
Lists the loyalty promotions associated with a [loyalty program]($m/LoyaltyProgram). Results are sorted by the ‘created_at` date in descending order (newest to oldest). program](entity:LoyaltyProgram). To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the `main` keyword. filter the results by. If a status is provided, only loyalty promotions with the specified status are returned. Otherwise, all loyalty promotions associated with the loyalty program are returned. paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). to return in a single paged response. The minimum value is 1 and the maximum value is 30. The default value is 30. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination).
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/square/api/loyalty_api.rb', line 311 def list_loyalty_promotions(program_id:, status: nil, cursor: nil, limit: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/programs/{program_id}/promotions', 'default') .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .query_param(new_parameter(status, key: 'status')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(limit, key: 'limit')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#redeem_loyalty_reward(reward_id:, body:) ⇒ ApiResponse
Redeems a loyalty reward. The endpoint sets the reward to the ‘REDEEMED` terminal state. If you are using your own order processing system (not using the Orders API), you call this endpoint after the buyer paid for the purchase. After the reward reaches the terminal state, it cannot be deleted. In other words, points used for the reward cannot be returned to the account. reward](entity:LoyaltyReward) to redeem. containing the fields to POST for the request. See the corresponding object definition for field details.
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/square/api/loyalty_api.rb', line 548 def redeem_loyalty_reward(reward_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/rewards/{reward_id}/redeem', 'default') .template_param(new_parameter(reward_id, key: 'reward_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_loyalty_account(account_id:) ⇒ ApiResponse
Retrieves a loyalty account. account](entity:LoyaltyAccount) to retrieve.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/square/api/loyalty_api.rb', line 57 def retrieve_loyalty_account(account_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/accounts/{account_id}', 'default') .template_param(new_parameter(account_id, key: 'account_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_loyalty_program(program_id:) ⇒ ApiResponse
Retrieves the loyalty program in a seller’s account, specified by the program ID or the keyword ‘main`. Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](developer.squareup.com/docs/loyalty/overview). program or the keyword `main`. Either value can be used to retrieve the single loyalty program that belongs to the seller.
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/square/api/loyalty_api.rb', line 220 def retrieve_loyalty_program(program_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/programs/{program_id}', 'default') .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_loyalty_promotion(promotion_id:, program_id:) ⇒ ApiResponse
Retrieves a loyalty promotion. promotion](entity:LoyaltyPromotion) to retrieve. program](entity:LoyaltyProgram). To get the program ID, call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using the ‘main` keyword.
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/square/api/loyalty_api.rb', line 379 def retrieve_loyalty_promotion(promotion_id:, program_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/programs/{program_id}/promotions/{promotion_id}', 'default') .template_param(new_parameter(promotion_id, key: 'promotion_id') .should_encode(true)) .template_param(new_parameter(program_id, key: 'program_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_loyalty_reward(reward_id:) ⇒ ApiResponse
Retrieves a loyalty reward. reward](entity:LoyaltyReward) to retrieve.
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
# File 'lib/square/api/loyalty_api.rb', line 518 def retrieve_loyalty_reward(reward_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/loyalty/rewards/{reward_id}', 'default') .template_param(new_parameter(reward_id, key: 'reward_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_loyalty_accounts(body:) ⇒ ApiResponse
Searches for loyalty accounts in a loyalty program. You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty ‘query` object or omit it entirely. Search results are sorted by `created_at` in ascending order. containing the fields to POST for the request. See the corresponding object definition for field details.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/square/api/loyalty_api.rb', line 36 def search_loyalty_accounts(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/accounts/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_loyalty_events(body:) ⇒ ApiResponse
Searches for loyalty events. A Square loyalty program maintains a ledger of events that occur during the lifetime of a buyer’s loyalty account. Each change in the point balance (for example, points earned, points redeemed, and points expired) is recorded in the ledger. Using this endpoint, you can search the ledger for events. Search results are sorted by ‘created_at` in descending order. containing the fields to POST for the request. See the corresponding object definition for field details.
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/square/api/loyalty_api.rb', line 167 def search_loyalty_events(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/events/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_loyalty_rewards(body:) ⇒ ApiResponse
Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. If you include a ‘query` object, `loyalty_account_id` is required and `status` is optional. If you know a reward ID, use the [RetrieveLoyaltyReward]($e/Loyalty/RetrieveLoyaltyReward) endpoint. Search results are sorted by `updated_at` in descending order. containing the fields to POST for the request. See the corresponding object definition for field details.
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/square/api/loyalty_api.rb', line 471 def search_loyalty_rewards(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/loyalty/rewards/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |