square.rb 44.0.0.20250820 → 44.0.1.20250820
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +62 -9
- data/lib/square/apple_pay/client.rb +12 -6
- data/lib/square/bank_accounts/client.rb +40 -19
- data/lib/square/bookings/client.rb +124 -62
- data/lib/square/bookings/custom_attribute_definitions/client.rb +68 -32
- data/lib/square/bookings/custom_attributes/client.rb +80 -38
- data/lib/square/bookings/location_profiles/client.rb +16 -7
- data/lib/square/bookings/team_member_profiles/client.rb +28 -13
- data/lib/square/cards/client.rb +53 -24
- data/lib/square/cash_drawers/shifts/client.rb +48 -21
- data/lib/square/catalog/client.rb +112 -55
- data/lib/square/catalog/images/client.rb +22 -10
- data/lib/square/catalog/object/client.rb +40 -19
- data/lib/square/catalog/object/types/delete_object_request.rb +1 -1
- data/lib/square/catalog/object/types/get_object_request.rb +1 -1
- data/lib/square/checkout/client.rb +48 -24
- data/lib/square/checkout/payment_links/client.rb +64 -31
- data/lib/square/client.rb +1 -1
- data/lib/square/customers/cards/client.rb +24 -12
- data/lib/square/customers/client.rb +128 -62
- data/lib/square/customers/custom_attribute_definitions/client.rb +80 -38
- data/lib/square/customers/custom_attributes/client.rb +56 -26
- data/lib/square/customers/groups/client.rb +88 -43
- data/lib/square/customers/segments/client.rb +28 -13
- data/lib/square/devices/client.rb +28 -13
- data/lib/square/devices/codes/client.rb +40 -19
- data/lib/square/disputes/client.rb +75 -36
- data/lib/square/disputes/evidence/client.rb +40 -19
- data/lib/square/employees/client.rb +28 -13
- data/lib/square/errors/api_error.rb +8 -0
- data/lib/square/errors/client_error.rb +17 -0
- data/lib/square/errors/redirect_error.rb +8 -0
- data/lib/square/errors/response_error.rb +42 -0
- data/lib/square/errors/server_error.rb +11 -0
- data/lib/square/errors/timeout_error.rb +8 -0
- data/lib/square/events/client.rb +52 -25
- data/lib/square/gift_cards/activities/client.rb +28 -14
- data/lib/square/gift_cards/client.rb +88 -43
- data/lib/square/inventory/client.rb +164 -80
- data/lib/square/invoices/client.rb +127 -61
- data/lib/square/labor/break_types/client.rb +64 -31
- data/lib/square/labor/client.rb +132 -66
- data/lib/square/labor/employee_wages/client.rb +28 -13
- data/lib/square/labor/shifts/client.rb +60 -30
- data/lib/square/labor/team_member_wages/client.rb +28 -13
- data/lib/square/labor/workweek_configs/client.rb +28 -13
- data/lib/square/locations/client.rb +60 -30
- data/lib/square/locations/custom_attribute_definitions/client.rb +68 -32
- data/lib/square/locations/custom_attributes/client.rb +80 -38
- data/lib/square/locations/transactions/client.rb +52 -25
- data/lib/square/loyalty/accounts/client.rb +60 -30
- data/lib/square/loyalty/client.rb +12 -6
- data/lib/square/loyalty/programs/client.rb +36 -18
- data/lib/square/loyalty/programs/promotions/client.rb +52 -25
- data/lib/square/loyalty/rewards/client.rb +60 -30
- data/lib/square/merchants/client.rb +28 -13
- data/lib/square/merchants/custom_attribute_definitions/client.rb +68 -32
- data/lib/square/merchants/custom_attributes/client.rb +80 -38
- data/lib/square/mobile/client.rb +12 -6
- data/lib/square/o_auth/client.rb +46 -22
- data/lib/square/orders/client.rb +98 -46
- data/lib/square/orders/custom_attribute_definitions/client.rb +68 -32
- data/lib/square/orders/custom_attributes/client.rb +80 -38
- data/lib/square/payments/client.rb +90 -44
- data/lib/square/payouts/client.rb +44 -20
- data/lib/square/refunds/client.rb +42 -20
- data/lib/square/sites/client.rb +12 -6
- data/lib/square/snippets/client.rb +36 -18
- data/lib/square/subscriptions/client.rb +153 -73
- data/lib/square/team/client.rb +53 -24
- data/lib/square/team_members/client.rb +72 -36
- data/lib/square/team_members/wage_setting/client.rb +24 -12
- data/lib/square/terminal/actions/client.rb +48 -24
- data/lib/square/terminal/checkouts/client.rb +48 -24
- data/lib/square/terminal/client.rb +36 -18
- data/lib/square/terminal/refunds/client.rb +48 -24
- data/lib/square/types/action_cancel_reason.rb +2 -1
- data/lib/square/types/activity_type.rb +2 -1
- data/lib/square/types/application_details_external_square_product.rb +2 -1
- data/lib/square/types/archived_state.rb +2 -1
- data/lib/square/types/bank_account_status.rb +2 -1
- data/lib/square/types/bank_account_type.rb +2 -1
- data/lib/square/types/booking_booking_source.rb +2 -1
- data/lib/square/types/booking_creator_details_creator_type.rb +2 -1
- data/lib/square/types/booking_status.rb +2 -1
- data/lib/square/types/business_appointment_settings_alignment_time.rb +2 -1
- data/lib/square/types/business_appointment_settings_booking_location_type.rb +2 -1
- data/lib/square/types/business_appointment_settings_cancellation_policy.rb +2 -1
- data/lib/square/types/business_appointment_settings_max_appointments_per_day_limit_type.rb +2 -1
- data/lib/square/types/business_booking_profile_booking_policy.rb +2 -1
- data/lib/square/types/business_booking_profile_customer_timezone_choice.rb +2 -1
- data/lib/square/types/card_brand.rb +2 -1
- data/lib/square/types/card_co_brand.rb +2 -1
- data/lib/square/types/card_prepaid_type.rb +2 -1
- data/lib/square/types/card_type.rb +2 -1
- data/lib/square/types/cash_drawer_event_type.rb +2 -1
- data/lib/square/types/cash_drawer_shift_state.rb +2 -1
- data/lib/square/types/catalog_category_type.rb +2 -1
- data/lib/square/types/catalog_custom_attribute_definition_app_visibility.rb +2 -1
- data/lib/square/types/catalog_custom_attribute_definition_seller_visibility.rb +2 -1
- data/lib/square/types/catalog_custom_attribute_definition_type.rb +2 -1
- data/lib/square/types/catalog_discount_modify_tax_basis.rb +2 -1
- data/lib/square/types/catalog_discount_type.rb +2 -1
- data/lib/square/types/catalog_id_mapping.rb +1 -1
- data/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.rb +2 -1
- data/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.rb +2 -1
- data/lib/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.rb +2 -1
- data/lib/square/types/catalog_item_product_type.rb +2 -1
- data/lib/square/types/catalog_modifier_list_modifier_type.rb +2 -1
- data/lib/square/types/catalog_modifier_list_selection_type.rb +2 -1
- data/lib/square/types/catalog_object_reference.rb +1 -1
- data/lib/square/types/catalog_object_type.rb +2 -1
- data/lib/square/types/catalog_pricing_type.rb +2 -1
- data/lib/square/types/catalog_quick_amount_type.rb +2 -1
- data/lib/square/types/catalog_quick_amounts_settings_option.rb +2 -1
- data/lib/square/types/change_timing.rb +2 -1
- data/lib/square/types/checkout_location_settings_branding_button_shape.rb +2 -1
- data/lib/square/types/checkout_location_settings_branding_header_type.rb +2 -1
- data/lib/square/types/checkout_options_payment_type.rb +2 -1
- data/lib/square/types/component_component_type.rb +2 -1
- data/lib/square/types/country.rb +2 -1
- data/lib/square/types/create_catalog_image_request.rb +1 -1
- data/lib/square/types/currency.rb +2 -1
- data/lib/square/types/custom_attribute_definition_visibility.rb +2 -1
- data/lib/square/types/customer_creation_source.rb +2 -1
- data/lib/square/types/customer_inclusion_exclusion.rb +2 -1
- data/lib/square/types/customer_sort_field.rb +2 -1
- data/lib/square/types/data_collection_options_input_type.rb +2 -1
- data/lib/square/types/day_of_week.rb +2 -1
- data/lib/square/types/destination_type.rb +2 -1
- data/lib/square/types/device_code_status.rb +2 -1
- data/lib/square/types/device_component_details_external_power.rb +2 -1
- data/lib/square/types/device_status_category.rb +2 -1
- data/lib/square/types/dispute_evidence_type.rb +2 -1
- data/lib/square/types/dispute_reason.rb +2 -1
- data/lib/square/types/dispute_state.rb +2 -1
- data/lib/square/types/ecom_visibility.rb +2 -1
- data/lib/square/types/employee_status.rb +2 -1
- data/lib/square/types/error_category.rb +2 -1
- data/lib/square/types/error_code.rb +2 -1
- data/lib/square/types/exclude_strategy.rb +2 -1
- data/lib/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.rb +2 -1
- data/lib/square/types/fulfillment_fulfillment_line_item_application.rb +2 -1
- data/lib/square/types/fulfillment_pickup_details_schedule_type.rb +2 -1
- data/lib/square/types/fulfillment_state.rb +2 -1
- data/lib/square/types/fulfillment_type.rb +2 -1
- data/lib/square/types/gift_card_activity_adjust_decrement_reason.rb +2 -1
- data/lib/square/types/gift_card_activity_adjust_increment_reason.rb +2 -1
- data/lib/square/types/gift_card_activity_clear_balance_reason.rb +2 -1
- data/lib/square/types/gift_card_activity_deactivate_reason.rb +2 -1
- data/lib/square/types/gift_card_activity_redeem_status.rb +2 -1
- data/lib/square/types/gift_card_activity_type.rb +2 -1
- data/lib/square/types/gift_card_gan_source.rb +2 -1
- data/lib/square/types/gift_card_status.rb +2 -1
- data/lib/square/types/gift_card_type.rb +2 -1
- data/lib/square/types/inventory_alert_type.rb +2 -1
- data/lib/square/types/inventory_change_type.rb +2 -1
- data/lib/square/types/inventory_state.rb +2 -1
- data/lib/square/types/invoice_attachment.rb +1 -1
- data/lib/square/types/invoice_automatic_payment_source.rb +2 -1
- data/lib/square/types/invoice_custom_field_placement.rb +2 -1
- data/lib/square/types/invoice_delivery_method.rb +2 -1
- data/lib/square/types/invoice_payment_reminder_status.rb +2 -1
- data/lib/square/types/invoice_request_method.rb +2 -1
- data/lib/square/types/invoice_request_type.rb +2 -1
- data/lib/square/types/invoice_status.rb +2 -1
- data/lib/square/types/job_assignment_pay_type.rb +2 -1
- data/lib/square/types/list_payment_refunds_request_sort_field.rb +2 -1
- data/lib/square/types/list_payments_request_sort_field.rb +2 -1
- data/lib/square/types/location_capability.rb +2 -1
- data/lib/square/types/location_status.rb +2 -1
- data/lib/square/types/location_type.rb +2 -1
- data/lib/square/types/loyalty_event_source.rb +2 -1
- data/lib/square/types/loyalty_event_type.rb +2 -1
- data/lib/square/types/loyalty_program_accrual_rule_tax_mode.rb +2 -1
- data/lib/square/types/loyalty_program_accrual_rule_type.rb +2 -1
- data/lib/square/types/loyalty_program_status.rb +2 -1
- data/lib/square/types/loyalty_promotion_incentive_type.rb +2 -1
- data/lib/square/types/loyalty_promotion_status.rb +2 -1
- data/lib/square/types/loyalty_promotion_trigger_limit_interval.rb +2 -1
- data/lib/square/types/loyalty_reward_status.rb +2 -1
- data/lib/square/types/measurement_unit_area.rb +2 -1
- data/lib/square/types/measurement_unit_length.rb +2 -1
- data/lib/square/types/measurement_unit_time.rb +2 -1
- data/lib/square/types/measurement_unit_unit_type.rb +2 -1
- data/lib/square/types/measurement_unit_volume.rb +2 -1
- data/lib/square/types/measurement_unit_weight.rb +2 -1
- data/lib/square/types/merchant_status.rb +2 -1
- data/lib/square/types/oauth_authorization_revoked_event_revoker_type.rb +2 -1
- data/lib/square/types/order_fulfillment_delivery_details_schedule_type.rb +2 -1
- data/lib/square/types/order_fulfillment_fulfillment_line_item_application.rb +2 -1
- data/lib/square/types/order_fulfillment_pickup_details_schedule_type.rb +2 -1
- data/lib/square/types/order_fulfillment_state.rb +2 -1
- data/lib/square/types/order_fulfillment_type.rb +2 -1
- data/lib/square/types/order_line_item_discount_scope.rb +2 -1
- data/lib/square/types/order_line_item_discount_type.rb +2 -1
- data/lib/square/types/order_line_item_item_type.rb +2 -1
- data/lib/square/types/order_line_item_tax_scope.rb +2 -1
- data/lib/square/types/order_line_item_tax_type.rb +2 -1
- data/lib/square/types/order_service_charge_calculation_phase.rb +2 -1
- data/lib/square/types/order_service_charge_scope.rb +2 -1
- data/lib/square/types/order_service_charge_treatment_type.rb +2 -1
- data/lib/square/types/order_service_charge_type.rb +2 -1
- data/lib/square/types/order_state.rb +2 -1
- data/lib/square/types/payment_options_delay_action.rb +2 -1
- data/lib/square/types/payout_fee_type.rb +2 -1
- data/lib/square/types/payout_status.rb +2 -1
- data/lib/square/types/payout_type.rb +2 -1
- data/lib/square/types/product.rb +2 -1
- data/lib/square/types/refund_status.rb +2 -1
- data/lib/square/types/register_domain_response_status.rb +2 -1
- data/lib/square/types/risk_evaluation_risk_level.rb +2 -1
- data/lib/square/types/scheduled_shift_filter_assignment_status.rb +2 -1
- data/lib/square/types/scheduled_shift_filter_scheduled_shift_status.rb +2 -1
- data/lib/square/types/scheduled_shift_notification_audience.rb +2 -1
- data/lib/square/types/scheduled_shift_sort_field.rb +2 -1
- data/lib/square/types/scheduled_shift_workday_matcher.rb +2 -1
- data/lib/square/types/search_catalog_items_request_stock_level.rb +2 -1
- data/lib/square/types/search_orders_sort_field.rb +2 -1
- data/lib/square/types/search_vendors_request_sort_field.rb +2 -1
- data/lib/square/types/shift_filter_status.rb +2 -1
- data/lib/square/types/shift_sort_field.rb +2 -1
- data/lib/square/types/shift_status.rb +2 -1
- data/lib/square/types/shift_workday_matcher.rb +2 -1
- data/lib/square/types/sort_order.rb +2 -1
- data/lib/square/types/subscription_action_type.rb +2 -1
- data/lib/square/types/subscription_cadence.rb +2 -1
- data/lib/square/types/subscription_event_info_code.rb +2 -1
- data/lib/square/types/subscription_event_subscription_event_type.rb +2 -1
- data/lib/square/types/subscription_pricing_type.rb +2 -1
- data/lib/square/types/subscription_status.rb +2 -1
- data/lib/square/types/tax_calculation_phase.rb +2 -1
- data/lib/square/types/tax_inclusion_type.rb +2 -1
- data/lib/square/types/team_member_assigned_locations_assignment_type.rb +2 -1
- data/lib/square/types/team_member_invitation_status.rb +2 -1
- data/lib/square/types/team_member_status.rb +2 -1
- data/lib/square/types/tender_bank_account_details_status.rb +2 -1
- data/lib/square/types/tender_buy_now_pay_later_details_brand.rb +2 -1
- data/lib/square/types/tender_buy_now_pay_later_details_status.rb +2 -1
- data/lib/square/types/tender_card_details_entry_method.rb +2 -1
- data/lib/square/types/tender_card_details_status.rb +2 -1
- data/lib/square/types/tender_square_account_details_status.rb +2 -1
- data/lib/square/types/tender_type.rb +2 -1
- data/lib/square/types/terminal_action_action_type.rb +2 -1
- data/lib/square/types/timecard_filter_status.rb +2 -1
- data/lib/square/types/timecard_sort_field.rb +2 -1
- data/lib/square/types/timecard_status.rb +2 -1
- data/lib/square/types/timecard_workday_matcher.rb +2 -1
- data/lib/square/types/transaction_product.rb +2 -1
- data/lib/square/types/transaction_type.rb +2 -1
- data/lib/square/types/v_1_order_history_entry_action.rb +2 -1
- data/lib/square/types/v_1_order_state.rb +2 -1
- data/lib/square/types/v_1_tender_card_brand.rb +2 -1
- data/lib/square/types/v_1_tender_entry_method.rb +2 -1
- data/lib/square/types/v_1_tender_type.rb +2 -1
- data/lib/square/types/v_1_update_order_request_action.rb +2 -1
- data/lib/square/types/vendor_status.rb +2 -1
- data/lib/square/types/visibility_filter.rb +2 -1
- data/lib/square/types/weekday.rb +2 -1
- data/lib/square/v_1_transactions/client.rb +40 -15
- data/lib/square/vendors/client.rb +84 -42
- data/lib/square/version.rb +5 -0
- data/lib/square/webhooks/event_types/client.rb +16 -7
- data/lib/square/webhooks/subscriptions/client.rb +88 -43
- data/lib/square.rb +7 -6
- data/test/square/integration/client_tests/test_catalog.rb +3 -0
- metadata +9 -2
@@ -18,22 +18,31 @@ module Square
|
|
18
18
|
#
|
19
19
|
# @return [Square::Types::ListTransactionsResponse]
|
20
20
|
def list(request_options: {}, **params)
|
21
|
-
_query_param_names =
|
21
|
+
_query_param_names = [
|
22
|
+
%w[begin_time end_time sort_order cursor],
|
23
|
+
%i[begin_time end_time sort_order cursor]
|
24
|
+
].flatten
|
22
25
|
_query = params.slice(*_query_param_names)
|
23
26
|
params = params.except(*_query_param_names)
|
24
27
|
|
25
28
|
_request = Square::Internal::JSON::Request.new(
|
26
|
-
base_url: request_options[:base_url] || Square::Environment::
|
29
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
27
30
|
method: "GET",
|
28
31
|
path: "v2/locations/#{params[:location_id]}/transactions",
|
29
32
|
query: _query
|
30
33
|
)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
begin
|
35
|
+
_response = @client.send(_request)
|
36
|
+
rescue Net::HTTPRequestTimeout
|
37
|
+
raise Square::Errors::TimeoutError
|
38
|
+
end
|
39
|
+
code = _response.code.to_i
|
40
|
+
if code.between?(200, 299)
|
41
|
+
Square::Types::ListTransactionsResponse.load(_response.body)
|
42
|
+
else
|
43
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
44
|
+
raise error_class.new(_response.body, code: code)
|
34
45
|
end
|
35
|
-
|
36
|
-
raise _response.body
|
37
46
|
end
|
38
47
|
|
39
48
|
# Retrieves details for a single transaction.
|
@@ -41,16 +50,22 @@ module Square
|
|
41
50
|
# @return [Square::Types::GetTransactionResponse]
|
42
51
|
def get(request_options: {}, **params)
|
43
52
|
_request = Square::Internal::JSON::Request.new(
|
44
|
-
base_url: request_options[:base_url] || Square::Environment::
|
53
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
45
54
|
method: "GET",
|
46
55
|
path: "v2/locations/#{params[:location_id]}/transactions/#{params[:transaction_id]}"
|
47
56
|
)
|
48
|
-
|
49
|
-
|
50
|
-
|
57
|
+
begin
|
58
|
+
_response = @client.send(_request)
|
59
|
+
rescue Net::HTTPRequestTimeout
|
60
|
+
raise Square::Errors::TimeoutError
|
61
|
+
end
|
62
|
+
code = _response.code.to_i
|
63
|
+
if code.between?(200, 299)
|
64
|
+
Square::Types::GetTransactionResponse.load(_response.body)
|
65
|
+
else
|
66
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
67
|
+
raise error_class.new(_response.body, code: code)
|
51
68
|
end
|
52
|
-
|
53
|
-
raise _response.body
|
54
69
|
end
|
55
70
|
|
56
71
|
# Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
|
@@ -63,16 +78,22 @@ module Square
|
|
63
78
|
# @return [Square::Types::CaptureTransactionResponse]
|
64
79
|
def capture(request_options: {}, **params)
|
65
80
|
_request = Square::Internal::JSON::Request.new(
|
66
|
-
base_url: request_options[:base_url] || Square::Environment::
|
81
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
67
82
|
method: "POST",
|
68
83
|
path: "v2/locations/#{params[:location_id]}/transactions/#{params[:transaction_id]}/capture"
|
69
84
|
)
|
70
|
-
|
71
|
-
|
72
|
-
|
85
|
+
begin
|
86
|
+
_response = @client.send(_request)
|
87
|
+
rescue Net::HTTPRequestTimeout
|
88
|
+
raise Square::Errors::TimeoutError
|
89
|
+
end
|
90
|
+
code = _response.code.to_i
|
91
|
+
if code.between?(200, 299)
|
92
|
+
Square::Types::CaptureTransactionResponse.load(_response.body)
|
93
|
+
else
|
94
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
95
|
+
raise error_class.new(_response.body, code: code)
|
73
96
|
end
|
74
|
-
|
75
|
-
raise _response.body
|
76
97
|
end
|
77
98
|
|
78
99
|
# Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge)
|
@@ -85,16 +106,22 @@ module Square
|
|
85
106
|
# @return [Square::Types::VoidTransactionResponse]
|
86
107
|
def void(request_options: {}, **params)
|
87
108
|
_request = Square::Internal::JSON::Request.new(
|
88
|
-
base_url: request_options[:base_url] || Square::Environment::
|
109
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
89
110
|
method: "POST",
|
90
111
|
path: "v2/locations/#{params[:location_id]}/transactions/#{params[:transaction_id]}/void"
|
91
112
|
)
|
92
|
-
|
93
|
-
|
94
|
-
|
113
|
+
begin
|
114
|
+
_response = @client.send(_request)
|
115
|
+
rescue Net::HTTPRequestTimeout
|
116
|
+
raise Square::Errors::TimeoutError
|
117
|
+
end
|
118
|
+
code = _response.code.to_i
|
119
|
+
if code.between?(200, 299)
|
120
|
+
Square::Types::VoidTransactionResponse.load(_response.body)
|
121
|
+
else
|
122
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
123
|
+
raise error_class.new(_response.body, code: code)
|
95
124
|
end
|
96
|
-
|
97
|
-
raise _response.body
|
98
125
|
end
|
99
126
|
end
|
100
127
|
end
|
@@ -14,17 +14,23 @@ module Square
|
|
14
14
|
# @return [Square::Types::CreateLoyaltyAccountResponse]
|
15
15
|
def create(request_options: {}, **params)
|
16
16
|
_request = Square::Internal::JSON::Request.new(
|
17
|
-
base_url: request_options[:base_url] || Square::Environment::
|
17
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
18
18
|
method: "POST",
|
19
19
|
path: "v2/loyalty/accounts",
|
20
20
|
body: params
|
21
21
|
)
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
begin
|
23
|
+
_response = @client.send(_request)
|
24
|
+
rescue Net::HTTPRequestTimeout
|
25
|
+
raise Square::Errors::TimeoutError
|
26
|
+
end
|
27
|
+
code = _response.code.to_i
|
28
|
+
if code.between?(200, 299)
|
29
|
+
Square::Types::CreateLoyaltyAccountResponse.load(_response.body)
|
30
|
+
else
|
31
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
32
|
+
raise error_class.new(_response.body, code: code)
|
25
33
|
end
|
26
|
-
|
27
|
-
raise _response.body
|
28
34
|
end
|
29
35
|
|
30
36
|
# Searches for loyalty accounts in a loyalty program.
|
@@ -36,17 +42,23 @@ module Square
|
|
36
42
|
# @return [Square::Types::SearchLoyaltyAccountsResponse]
|
37
43
|
def search(request_options: {}, **params)
|
38
44
|
_request = Square::Internal::JSON::Request.new(
|
39
|
-
base_url: request_options[:base_url] || Square::Environment::
|
45
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
40
46
|
method: "POST",
|
41
47
|
path: "v2/loyalty/accounts/search",
|
42
48
|
body: params
|
43
49
|
)
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
begin
|
51
|
+
_response = @client.send(_request)
|
52
|
+
rescue Net::HTTPRequestTimeout
|
53
|
+
raise Square::Errors::TimeoutError
|
54
|
+
end
|
55
|
+
code = _response.code.to_i
|
56
|
+
if code.between?(200, 299)
|
57
|
+
Square::Types::SearchLoyaltyAccountsResponse.load(_response.body)
|
58
|
+
else
|
59
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
60
|
+
raise error_class.new(_response.body, code: code)
|
47
61
|
end
|
48
|
-
|
49
|
-
raise _response.body
|
50
62
|
end
|
51
63
|
|
52
64
|
# Retrieves a loyalty account.
|
@@ -54,16 +66,22 @@ module Square
|
|
54
66
|
# @return [Square::Types::GetLoyaltyAccountResponse]
|
55
67
|
def get(request_options: {}, **params)
|
56
68
|
_request = Square::Internal::JSON::Request.new(
|
57
|
-
base_url: request_options[:base_url] || Square::Environment::
|
69
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
58
70
|
method: "GET",
|
59
71
|
path: "v2/loyalty/accounts/#{params[:account_id]}"
|
60
72
|
)
|
61
|
-
|
62
|
-
|
63
|
-
|
73
|
+
begin
|
74
|
+
_response = @client.send(_request)
|
75
|
+
rescue Net::HTTPRequestTimeout
|
76
|
+
raise Square::Errors::TimeoutError
|
77
|
+
end
|
78
|
+
code = _response.code.to_i
|
79
|
+
if code.between?(200, 299)
|
80
|
+
Square::Types::GetLoyaltyAccountResponse.load(_response.body)
|
81
|
+
else
|
82
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
83
|
+
raise error_class.new(_response.body, code: code)
|
64
84
|
end
|
65
|
-
|
66
|
-
raise _response.body
|
67
85
|
end
|
68
86
|
|
69
87
|
# Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount).
|
@@ -86,17 +104,23 @@ module Square
|
|
86
104
|
_path_param_names = ["account_id"]
|
87
105
|
|
88
106
|
_request = Square::Internal::JSON::Request.new(
|
89
|
-
base_url: request_options[:base_url] || Square::Environment::
|
107
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
90
108
|
method: "POST",
|
91
109
|
path: "v2/loyalty/accounts/#{params[:account_id]}/accumulate",
|
92
110
|
body: params.except(*_path_param_names)
|
93
111
|
)
|
94
|
-
|
95
|
-
|
96
|
-
|
112
|
+
begin
|
113
|
+
_response = @client.send(_request)
|
114
|
+
rescue Net::HTTPRequestTimeout
|
115
|
+
raise Square::Errors::TimeoutError
|
116
|
+
end
|
117
|
+
code = _response.code.to_i
|
118
|
+
if code.between?(200, 299)
|
119
|
+
Square::Types::AccumulateLoyaltyPointsResponse.load(_response.body)
|
120
|
+
else
|
121
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
122
|
+
raise error_class.new(_response.body, code: code)
|
97
123
|
end
|
98
|
-
|
99
|
-
raise _response.body
|
100
124
|
end
|
101
125
|
|
102
126
|
# Adds points to or subtracts points from a buyer's account.
|
@@ -110,17 +134,23 @@ module Square
|
|
110
134
|
_path_param_names = ["account_id"]
|
111
135
|
|
112
136
|
_request = Square::Internal::JSON::Request.new(
|
113
|
-
base_url: request_options[:base_url] || Square::Environment::
|
137
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
114
138
|
method: "POST",
|
115
139
|
path: "v2/loyalty/accounts/#{params[:account_id]}/adjust",
|
116
140
|
body: params.except(*_path_param_names)
|
117
141
|
)
|
118
|
-
|
119
|
-
|
120
|
-
|
142
|
+
begin
|
143
|
+
_response = @client.send(_request)
|
144
|
+
rescue Net::HTTPRequestTimeout
|
145
|
+
raise Square::Errors::TimeoutError
|
146
|
+
end
|
147
|
+
code = _response.code.to_i
|
148
|
+
if code.between?(200, 299)
|
149
|
+
Square::Types::AdjustLoyaltyPointsResponse.load(_response.body)
|
150
|
+
else
|
151
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
152
|
+
raise error_class.new(_response.body, code: code)
|
121
153
|
end
|
122
|
-
|
123
|
-
raise _response.body
|
124
154
|
end
|
125
155
|
end
|
126
156
|
end
|
@@ -20,17 +20,23 @@ module Square
|
|
20
20
|
# @return [Square::Types::SearchLoyaltyEventsResponse]
|
21
21
|
def search_events(request_options: {}, **params)
|
22
22
|
_request = Square::Internal::JSON::Request.new(
|
23
|
-
base_url: request_options[:base_url] || Square::Environment::
|
23
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
24
24
|
method: "POST",
|
25
25
|
path: "v2/loyalty/events/search",
|
26
26
|
body: params
|
27
27
|
)
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
begin
|
29
|
+
_response = @client.send(_request)
|
30
|
+
rescue Net::HTTPRequestTimeout
|
31
|
+
raise Square::Errors::TimeoutError
|
32
|
+
end
|
33
|
+
code = _response.code.to_i
|
34
|
+
if code.between?(200, 299)
|
35
|
+
Square::Types::SearchLoyaltyEventsResponse.load(_response.body)
|
36
|
+
else
|
37
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
38
|
+
raise error_class.new(_response.body, code: code)
|
31
39
|
end
|
32
|
-
|
33
|
-
raise _response.body
|
34
40
|
end
|
35
41
|
|
36
42
|
# @return [Square::Accounts::Client]
|
@@ -18,16 +18,22 @@ module Square
|
|
18
18
|
# @return [Square::Types::ListLoyaltyProgramsResponse]
|
19
19
|
def list(request_options: {}, **_params)
|
20
20
|
_request = Square::Internal::JSON::Request.new(
|
21
|
-
base_url: request_options[:base_url] || Square::Environment::
|
21
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
22
22
|
method: "GET",
|
23
23
|
path: "v2/loyalty/programs"
|
24
24
|
)
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
begin
|
26
|
+
_response = @client.send(_request)
|
27
|
+
rescue Net::HTTPRequestTimeout
|
28
|
+
raise Square::Errors::TimeoutError
|
29
|
+
end
|
30
|
+
code = _response.code.to_i
|
31
|
+
if code.between?(200, 299)
|
32
|
+
Square::Types::ListLoyaltyProgramsResponse.load(_response.body)
|
33
|
+
else
|
34
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
35
|
+
raise error_class.new(_response.body, code: code)
|
28
36
|
end
|
29
|
-
|
30
|
-
raise _response.body
|
31
37
|
end
|
32
38
|
|
33
39
|
# Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`.
|
@@ -37,16 +43,22 @@ module Square
|
|
37
43
|
# @return [Square::Types::GetLoyaltyProgramResponse]
|
38
44
|
def get(request_options: {}, **params)
|
39
45
|
_request = Square::Internal::JSON::Request.new(
|
40
|
-
base_url: request_options[:base_url] || Square::Environment::
|
46
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
41
47
|
method: "GET",
|
42
48
|
path: "v2/loyalty/programs/#{params[:program_id]}"
|
43
49
|
)
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
begin
|
51
|
+
_response = @client.send(_request)
|
52
|
+
rescue Net::HTTPRequestTimeout
|
53
|
+
raise Square::Errors::TimeoutError
|
54
|
+
end
|
55
|
+
code = _response.code.to_i
|
56
|
+
if code.between?(200, 299)
|
57
|
+
Square::Types::GetLoyaltyProgramResponse.load(_response.body)
|
58
|
+
else
|
59
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
60
|
+
raise error_class.new(_response.body, code: code)
|
47
61
|
end
|
48
|
-
|
49
|
-
raise _response.body
|
50
62
|
end
|
51
63
|
|
52
64
|
# Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint
|
@@ -70,17 +82,23 @@ module Square
|
|
70
82
|
_path_param_names = ["program_id"]
|
71
83
|
|
72
84
|
_request = Square::Internal::JSON::Request.new(
|
73
|
-
base_url: request_options[:base_url] || Square::Environment::
|
85
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
74
86
|
method: "POST",
|
75
87
|
path: "v2/loyalty/programs/#{params[:program_id]}/calculate",
|
76
88
|
body: params.except(*_path_param_names)
|
77
89
|
)
|
78
|
-
|
79
|
-
|
80
|
-
|
90
|
+
begin
|
91
|
+
_response = @client.send(_request)
|
92
|
+
rescue Net::HTTPRequestTimeout
|
93
|
+
raise Square::Errors::TimeoutError
|
94
|
+
end
|
95
|
+
code = _response.code.to_i
|
96
|
+
if code.between?(200, 299)
|
97
|
+
Square::Types::CalculateLoyaltyPointsResponse.load(_response.body)
|
98
|
+
else
|
99
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
100
|
+
raise error_class.new(_response.body, code: code)
|
81
101
|
end
|
82
|
-
|
83
|
-
raise _response.body
|
84
102
|
end
|
85
103
|
|
86
104
|
# @return [Square::Promotions::Client]
|
@@ -15,22 +15,31 @@ module Square
|
|
15
15
|
#
|
16
16
|
# @return [Square::Types::ListLoyaltyPromotionsResponse]
|
17
17
|
def list(request_options: {}, **params)
|
18
|
-
_query_param_names =
|
18
|
+
_query_param_names = [
|
19
|
+
%w[status cursor limit],
|
20
|
+
%i[status cursor limit]
|
21
|
+
].flatten
|
19
22
|
_query = params.slice(*_query_param_names)
|
20
23
|
params = params.except(*_query_param_names)
|
21
24
|
|
22
25
|
_request = Square::Internal::JSON::Request.new(
|
23
|
-
base_url: request_options[:base_url] || Square::Environment::
|
26
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
24
27
|
method: "GET",
|
25
28
|
path: "v2/loyalty/programs/#{params[:program_id]}/promotions",
|
26
29
|
query: _query
|
27
30
|
)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
begin
|
32
|
+
_response = @client.send(_request)
|
33
|
+
rescue Net::HTTPRequestTimeout
|
34
|
+
raise Square::Errors::TimeoutError
|
35
|
+
end
|
36
|
+
code = _response.code.to_i
|
37
|
+
if code.between?(200, 299)
|
38
|
+
Square::Types::ListLoyaltyPromotionsResponse.load(_response.body)
|
39
|
+
else
|
40
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
41
|
+
raise error_class.new(_response.body, code: code)
|
31
42
|
end
|
32
|
-
|
33
|
-
raise _response.body
|
34
43
|
end
|
35
44
|
|
36
45
|
# Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion
|
@@ -45,17 +54,23 @@ module Square
|
|
45
54
|
_path_param_names = ["program_id"]
|
46
55
|
|
47
56
|
_request = Square::Internal::JSON::Request.new(
|
48
|
-
base_url: request_options[:base_url] || Square::Environment::
|
57
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
49
58
|
method: "POST",
|
50
59
|
path: "v2/loyalty/programs/#{params[:program_id]}/promotions",
|
51
60
|
body: params.except(*_path_param_names)
|
52
61
|
)
|
53
|
-
|
54
|
-
|
55
|
-
|
62
|
+
begin
|
63
|
+
_response = @client.send(_request)
|
64
|
+
rescue Net::HTTPRequestTimeout
|
65
|
+
raise Square::Errors::TimeoutError
|
66
|
+
end
|
67
|
+
code = _response.code.to_i
|
68
|
+
if code.between?(200, 299)
|
69
|
+
Square::Types::CreateLoyaltyPromotionResponse.load(_response.body)
|
70
|
+
else
|
71
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
72
|
+
raise error_class.new(_response.body, code: code)
|
56
73
|
end
|
57
|
-
|
58
|
-
raise _response.body
|
59
74
|
end
|
60
75
|
|
61
76
|
# Retrieves a loyalty promotion.
|
@@ -63,16 +78,22 @@ module Square
|
|
63
78
|
# @return [Square::Types::GetLoyaltyPromotionResponse]
|
64
79
|
def get(request_options: {}, **params)
|
65
80
|
_request = Square::Internal::JSON::Request.new(
|
66
|
-
base_url: request_options[:base_url] || Square::Environment::
|
81
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
67
82
|
method: "GET",
|
68
83
|
path: "v2/loyalty/programs/#{params[:program_id]}/promotions/#{params[:promotion_id]}"
|
69
84
|
)
|
70
|
-
|
71
|
-
|
72
|
-
|
85
|
+
begin
|
86
|
+
_response = @client.send(_request)
|
87
|
+
rescue Net::HTTPRequestTimeout
|
88
|
+
raise Square::Errors::TimeoutError
|
89
|
+
end
|
90
|
+
code = _response.code.to_i
|
91
|
+
if code.between?(200, 299)
|
92
|
+
Square::Types::GetLoyaltyPromotionResponse.load(_response.body)
|
93
|
+
else
|
94
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
95
|
+
raise error_class.new(_response.body, code: code)
|
73
96
|
end
|
74
|
-
|
75
|
-
raise _response.body
|
76
97
|
end
|
77
98
|
|
78
99
|
# Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the
|
@@ -85,16 +106,22 @@ module Square
|
|
85
106
|
# @return [Square::Types::CancelLoyaltyPromotionResponse]
|
86
107
|
def cancel(request_options: {}, **params)
|
87
108
|
_request = Square::Internal::JSON::Request.new(
|
88
|
-
base_url: request_options[:base_url] || Square::Environment::
|
109
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
89
110
|
method: "POST",
|
90
111
|
path: "v2/loyalty/programs/#{params[:program_id]}/promotions/#{params[:promotion_id]}/cancel"
|
91
112
|
)
|
92
|
-
|
93
|
-
|
94
|
-
|
113
|
+
begin
|
114
|
+
_response = @client.send(_request)
|
115
|
+
rescue Net::HTTPRequestTimeout
|
116
|
+
raise Square::Errors::TimeoutError
|
117
|
+
end
|
118
|
+
code = _response.code.to_i
|
119
|
+
if code.between?(200, 299)
|
120
|
+
Square::Types::CancelLoyaltyPromotionResponse.load(_response.body)
|
121
|
+
else
|
122
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
123
|
+
raise error_class.new(_response.body, code: code)
|
95
124
|
end
|
96
|
-
|
97
|
-
raise _response.body
|
98
125
|
end
|
99
126
|
end
|
100
127
|
end
|
@@ -21,17 +21,23 @@ module Square
|
|
21
21
|
# @return [Square::Types::CreateLoyaltyRewardResponse]
|
22
22
|
def create(request_options: {}, **params)
|
23
23
|
_request = Square::Internal::JSON::Request.new(
|
24
|
-
base_url: request_options[:base_url] || Square::Environment::
|
24
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
25
25
|
method: "POST",
|
26
26
|
path: "v2/loyalty/rewards",
|
27
27
|
body: params
|
28
28
|
)
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
begin
|
30
|
+
_response = @client.send(_request)
|
31
|
+
rescue Net::HTTPRequestTimeout
|
32
|
+
raise Square::Errors::TimeoutError
|
33
|
+
end
|
34
|
+
code = _response.code.to_i
|
35
|
+
if code.between?(200, 299)
|
36
|
+
Square::Types::CreateLoyaltyRewardResponse.load(_response.body)
|
37
|
+
else
|
38
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
39
|
+
raise error_class.new(_response.body, code: code)
|
32
40
|
end
|
33
|
-
|
34
|
-
raise _response.body
|
35
41
|
end
|
36
42
|
|
37
43
|
# Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts.
|
@@ -45,17 +51,23 @@ module Square
|
|
45
51
|
# @return [Square::Types::SearchLoyaltyRewardsResponse]
|
46
52
|
def search(request_options: {}, **params)
|
47
53
|
_request = Square::Internal::JSON::Request.new(
|
48
|
-
base_url: request_options[:base_url] || Square::Environment::
|
54
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
49
55
|
method: "POST",
|
50
56
|
path: "v2/loyalty/rewards/search",
|
51
57
|
body: params
|
52
58
|
)
|
53
|
-
|
54
|
-
|
55
|
-
|
59
|
+
begin
|
60
|
+
_response = @client.send(_request)
|
61
|
+
rescue Net::HTTPRequestTimeout
|
62
|
+
raise Square::Errors::TimeoutError
|
63
|
+
end
|
64
|
+
code = _response.code.to_i
|
65
|
+
if code.between?(200, 299)
|
66
|
+
Square::Types::SearchLoyaltyRewardsResponse.load(_response.body)
|
67
|
+
else
|
68
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
69
|
+
raise error_class.new(_response.body, code: code)
|
56
70
|
end
|
57
|
-
|
58
|
-
raise _response.body
|
59
71
|
end
|
60
72
|
|
61
73
|
# Retrieves a loyalty reward.
|
@@ -63,16 +75,22 @@ module Square
|
|
63
75
|
# @return [Square::Types::GetLoyaltyRewardResponse]
|
64
76
|
def get(request_options: {}, **params)
|
65
77
|
_request = Square::Internal::JSON::Request.new(
|
66
|
-
base_url: request_options[:base_url] || Square::Environment::
|
78
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
67
79
|
method: "GET",
|
68
80
|
path: "v2/loyalty/rewards/#{params[:reward_id]}"
|
69
81
|
)
|
70
|
-
|
71
|
-
|
72
|
-
|
82
|
+
begin
|
83
|
+
_response = @client.send(_request)
|
84
|
+
rescue Net::HTTPRequestTimeout
|
85
|
+
raise Square::Errors::TimeoutError
|
86
|
+
end
|
87
|
+
code = _response.code.to_i
|
88
|
+
if code.between?(200, 299)
|
89
|
+
Square::Types::GetLoyaltyRewardResponse.load(_response.body)
|
90
|
+
else
|
91
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
92
|
+
raise error_class.new(_response.body, code: code)
|
73
93
|
end
|
74
|
-
|
75
|
-
raise _response.body
|
76
94
|
end
|
77
95
|
|
78
96
|
# Deletes a loyalty reward by doing the following:
|
@@ -88,16 +106,22 @@ module Square
|
|
88
106
|
# @return [Square::Types::DeleteLoyaltyRewardResponse]
|
89
107
|
def delete(request_options: {}, **params)
|
90
108
|
_request = Square::Internal::JSON::Request.new(
|
91
|
-
base_url: request_options[:base_url] || Square::Environment::
|
109
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
92
110
|
method: "DELETE",
|
93
111
|
path: "v2/loyalty/rewards/#{params[:reward_id]}"
|
94
112
|
)
|
95
|
-
|
96
|
-
|
97
|
-
|
113
|
+
begin
|
114
|
+
_response = @client.send(_request)
|
115
|
+
rescue Net::HTTPRequestTimeout
|
116
|
+
raise Square::Errors::TimeoutError
|
117
|
+
end
|
118
|
+
code = _response.code.to_i
|
119
|
+
if code.between?(200, 299)
|
120
|
+
Square::Types::DeleteLoyaltyRewardResponse.load(_response.body)
|
121
|
+
else
|
122
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
123
|
+
raise error_class.new(_response.body, code: code)
|
98
124
|
end
|
99
|
-
|
100
|
-
raise _response.body
|
101
125
|
end
|
102
126
|
|
103
127
|
# Redeems a loyalty reward.
|
@@ -117,17 +141,23 @@ module Square
|
|
117
141
|
_path_param_names = ["reward_id"]
|
118
142
|
|
119
143
|
_request = Square::Internal::JSON::Request.new(
|
120
|
-
base_url: request_options[:base_url] || Square::Environment::
|
144
|
+
base_url: request_options[:base_url] || Square::Environment::PRODUCTION,
|
121
145
|
method: "POST",
|
122
146
|
path: "v2/loyalty/rewards/#{params[:reward_id]}/redeem",
|
123
147
|
body: params.except(*_path_param_names)
|
124
148
|
)
|
125
|
-
|
126
|
-
|
127
|
-
|
149
|
+
begin
|
150
|
+
_response = @client.send(_request)
|
151
|
+
rescue Net::HTTPRequestTimeout
|
152
|
+
raise Square::Errors::TimeoutError
|
153
|
+
end
|
154
|
+
code = _response.code.to_i
|
155
|
+
if code.between?(200, 299)
|
156
|
+
Square::Types::RedeemLoyaltyRewardResponse.load(_response.body)
|
157
|
+
else
|
158
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
159
|
+
raise error_class.new(_response.body, code: code)
|
128
160
|
end
|
129
|
-
|
130
|
-
raise _response.body
|
131
161
|
end
|
132
162
|
end
|
133
163
|
end
|