square.rb 44.2.0.20251016 → 45.0.1.20260122
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/.fern/metadata.json +9 -0
- data/.fernignore +20 -0
- data/.rubocop.yml +60 -0
- data/LICENSE +1 -1
- data/Rakefile +29 -0
- data/custom.gemspec.rb +19 -0
- data/lib/square/apple_pay/client.rb +24 -10
- data/lib/square/bank_accounts/client.rb +144 -31
- data/lib/square/bank_accounts/types/create_bank_account_request.rb +13 -0
- data/lib/square/bank_accounts/types/disable_bank_account_request.rb +11 -0
- data/lib/square/bank_accounts/types/get_by_v_1_id_bank_accounts_request.rb +1 -1
- data/lib/square/bank_accounts/types/list_bank_accounts_request.rb +1 -0
- data/lib/square/bookings/client.rb +238 -100
- data/lib/square/bookings/custom_attribute_definitions/client.rb +139 -67
- data/lib/square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request.rb +1 -3
- data/lib/square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request.rb +1 -3
- data/lib/square/bookings/custom_attributes/client.rb +168 -76
- data/lib/square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request.rb +1 -3
- data/lib/square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request.rb +1 -3
- data/lib/square/bookings/location_profiles/client.rb +44 -24
- data/lib/square/bookings/team_member_profiles/client.rb +66 -31
- data/lib/square/cards/client.rb +103 -45
- data/lib/square/cash_drawers/client.rb +3 -1
- data/lib/square/cash_drawers/shifts/client.rb +121 -61
- data/lib/square/catalog/client.rb +203 -91
- data/lib/square/catalog/images/client.rb +50 -20
- data/lib/square/catalog/object/client.rb +66 -29
- 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/catalog/types/batch_upsert_catalog_objects_request.rb +1 -3
- data/lib/square/catalog/types/search_catalog_items_request.rb +3 -9
- data/lib/square/catalog/types/search_catalog_objects_request.rb +1 -3
- data/lib/square/channels/client.rb +85 -38
- data/lib/square/checkout/client.rb +77 -31
- data/lib/square/checkout/payment_links/client.rb +120 -54
- data/lib/square/client.rb +8 -10
- data/lib/square/customers/cards/client.rb +43 -16
- data/lib/square/customers/client.rb +220 -97
- data/lib/square/customers/custom_attribute_definitions/client.rb +157 -74
- data/lib/square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request.rb +1 -3
- data/lib/square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request.rb +1 -3
- data/lib/square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request.rb +1 -3
- data/lib/square/customers/custom_attributes/client.rb +117 -53
- data/lib/square/customers/groups/client.rb +156 -67
- data/lib/square/customers/segments/client.rb +62 -31
- data/lib/square/customers/types/bulk_create_customers_request.rb +1 -3
- data/lib/square/customers/types/bulk_update_customers_request.rb +1 -3
- data/lib/square/devices/client.rb +66 -31
- data/lib/square/devices/codes/client.rb +83 -38
- data/lib/square/disputes/client.rb +140 -60
- data/lib/square/disputes/evidence/client.rb +83 -39
- data/lib/square/employees/client.rb +66 -31
- data/lib/square/events/client.rb +80 -38
- data/lib/square/file_param.rb +77 -77
- data/lib/square/gift_cards/activities/client.rb +73 -31
- data/lib/square/gift_cards/client.rb +163 -69
- data/lib/square/internal/http/base_request.rb +6 -0
- data/lib/square/internal/http/raw_client.rb +111 -20
- data/lib/square/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/square/internal/iterators/cursor_page_iterator.rb +51 -0
- data/lib/square/internal/iterators/item_iterator.rb +65 -0
- data/lib/square/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/square/internal/iterators/offset_page_iterator.rb +83 -0
- data/lib/square/internal/json/request.rb +2 -1
- data/lib/square/internal/multipart/multipart_request.rb +2 -1
- data/lib/square/internal/types/enum.rb +8 -0
- data/lib/square/internal/types/model/field.rb +11 -1
- data/lib/square/internal/types/model.rb +14 -4
- data/lib/square/internal/types/union.rb +88 -7
- data/lib/square/internal/types/utils.rb +20 -4
- data/lib/square/inventory/client.rb +100 -76
- data/lib/square/invoices/client.rb +228 -99
- data/lib/square/labor/break_types/client.rb +120 -53
- data/lib/square/labor/client.rb +205 -81
- data/lib/square/labor/employee_wages/client.rb +64 -31
- data/lib/square/labor/shifts/client.rb +94 -37
- data/lib/square/labor/team_member_wages/client.rb +64 -31
- data/lib/square/labor/types/bulk_publish_scheduled_shifts_request.rb +2 -6
- data/lib/square/labor/types/publish_scheduled_shift_request.rb +1 -3
- data/lib/square/labor/workweek_configs/client.rb +65 -32
- data/lib/square/locations/client.rb +102 -41
- data/lib/square/locations/custom_attribute_definitions/client.rb +135 -64
- data/lib/square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request.rb +1 -3
- data/lib/square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request.rb +1 -3
- data/lib/square/locations/custom_attributes/client.rb +156 -68
- data/lib/square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request.rb +1 -3
- data/lib/square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request.rb +1 -3
- data/lib/square/locations/transactions/client.rb +93 -37
- data/lib/square/locations/types/create_checkout_request.rb +1 -3
- data/lib/square/loyalty/accounts/client.rb +109 -44
- data/lib/square/loyalty/accounts/types/search_loyalty_accounts_request.rb +1 -3
- data/lib/square/loyalty/client.rb +20 -8
- data/lib/square/loyalty/programs/client.rb +72 -29
- data/lib/square/loyalty/programs/promotions/client.rb +106 -46
- data/lib/square/loyalty/rewards/client.rb +96 -38
- data/lib/square/loyalty/rewards/types/search_loyalty_rewards_request.rb +1 -3
- data/lib/square/merchants/client.rb +60 -31
- data/lib/square/merchants/custom_attribute_definitions/client.rb +137 -65
- data/lib/square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request.rb +1 -3
- data/lib/square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request.rb +1 -3
- data/lib/square/merchants/custom_attributes/client.rb +156 -68
- data/lib/square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request.rb +1 -3
- data/lib/square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request.rb +1 -3
- data/lib/square/o_auth/client.rb +76 -31
- data/lib/square/o_auth/types/obtain_token_request.rb +1 -0
- data/lib/square/orders/client.rb +156 -63
- data/lib/square/orders/custom_attribute_definitions/client.rb +137 -65
- data/lib/square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request.rb +1 -3
- data/lib/square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request.rb +1 -3
- data/lib/square/orders/custom_attributes/client.rb +159 -69
- data/lib/square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request.rb +1 -3
- data/lib/square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request.rb +1 -3
- data/lib/square/orders/types/calculate_order_request.rb +1 -3
- data/lib/square/payments/client.rb +182 -70
- data/lib/square/payouts/client.rb +116 -54
- data/lib/square/refunds/client.rb +97 -40
- data/lib/square/refunds/types/refund_payment_request.rb +1 -3
- data/lib/square/sites/client.rb +26 -11
- data/lib/square/snippets/client.rb +73 -28
- data/lib/square/subscriptions/client.rb +271 -117
- data/lib/square/team/client.rb +81 -36
- data/lib/square/team_members/client.rb +119 -49
- data/lib/square/team_members/types/batch_create_team_members_request.rb +1 -3
- data/lib/square/team_members/types/batch_update_team_members_request.rb +1 -3
- data/lib/square/team_members/wage_setting/client.rb +48 -19
- data/lib/square/terminal/actions/client.rb +75 -30
- data/lib/square/terminal/checkouts/client.rb +76 -30
- data/lib/square/terminal/client.rb +60 -23
- data/lib/square/terminal/refunds/client.rb +78 -31
- data/lib/square/transfer_orders/client.rb +26 -21
- data/lib/square/types/address.rb +2 -1
- data/lib/square/types/application_details.rb +1 -3
- data/lib/square/types/application_type.rb +23 -0
- data/lib/square/types/availability.rb +3 -4
- data/lib/square/types/bank_account.rb +1 -0
- data/lib/square/types/batch_create_team_members_response.rb +1 -3
- data/lib/square/types/batch_create_vendors_response.rb +1 -3
- data/lib/square/types/batch_get_catalog_objects_response.rb +1 -3
- data/lib/square/types/batch_get_vendors_response.rb +1 -3
- data/lib/square/types/batch_update_team_members_response.rb +1 -3
- data/lib/square/types/batch_update_vendors_response.rb +1 -3
- data/lib/square/types/batch_upsert_catalog_objects_response.rb +1 -3
- data/lib/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.rb +2 -1
- data/lib/square/types/batch_upsert_customer_custom_attributes_response.rb +4 -4
- data/lib/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.rb +3 -1
- data/lib/square/types/booking.rb +2 -6
- data/lib/square/types/booking_created_event.rb +2 -1
- data/lib/square/types/booking_custom_attribute_definition_visible_created_event.rb +2 -1
- data/lib/square/types/booking_custom_attribute_definition_visible_deleted_event.rb +2 -1
- data/lib/square/types/booking_custom_attribute_definition_visible_updated_event.rb +2 -1
- data/lib/square/types/booking_custom_attribute_delete_request.rb +4 -2
- data/lib/square/types/booking_custom_attribute_delete_response.rb +3 -1
- data/lib/square/types/booking_custom_attribute_upsert_request.rb +2 -1
- data/lib/square/types/booking_custom_attribute_upsert_response.rb +3 -1
- data/lib/square/types/booking_updated_event.rb +2 -1
- data/lib/square/types/bulk_create_customers_response.rb +1 -3
- data/lib/square/types/bulk_delete_booking_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_delete_customers_response.rb +1 -3
- data/lib/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.rb +2 -1
- data/lib/square/types/bulk_delete_location_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.rb +2 -1
- data/lib/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.rb +2 -1
- data/lib/square/types/bulk_delete_merchant_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.rb +2 -1
- data/lib/square/types/bulk_delete_order_custom_attributes_response.rb +1 -3
- data/lib/square/types/bulk_publish_scheduled_shifts_response.rb +1 -3
- data/lib/square/types/bulk_retrieve_bookings_response.rb +1 -3
- data/lib/square/types/bulk_retrieve_channels_request_constants.rb +23 -0
- data/lib/square/types/bulk_retrieve_channels_response.rb +1 -3
- data/lib/square/types/bulk_retrieve_customers_response.rb +1 -3
- data/lib/square/types/bulk_retrieve_team_member_booking_profiles_response.rb +3 -4
- data/lib/square/types/bulk_update_customers_response.rb +1 -3
- data/lib/square/types/bulk_upsert_booking_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.rb +2 -1
- data/lib/square/types/bulk_upsert_location_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.rb +3 -1
- data/lib/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.rb +2 -1
- data/lib/square/types/bulk_upsert_merchant_custom_attributes_response.rb +4 -4
- data/lib/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.rb +3 -1
- data/lib/square/types/bulk_upsert_order_custom_attributes_response.rb +1 -3
- data/lib/square/types/business_appointment_settings.rb +4 -12
- data/lib/square/types/business_booking_profile.rb +2 -6
- data/lib/square/types/buy_now_pay_later_details.rb +1 -0
- data/lib/square/types/card.rb +2 -0
- data/lib/square/types/card_issuer_alert.rb +23 -0
- data/lib/square/types/catalog_category.rb +1 -3
- data/lib/square/types/catalog_custom_attribute_definition.rb +6 -18
- data/lib/square/types/catalog_custom_attribute_definition_selection_config.rb +1 -3
- data/lib/square/types/catalog_id_mapping.rb +1 -1
- data/lib/square/types/catalog_info_response.rb +1 -3
- data/lib/square/types/catalog_item.rb +6 -12
- data/lib/square/types/catalog_item_food_and_beverage_details.rb +2 -6
- data/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference.rb +2 -6
- data/lib/square/types/catalog_item_food_and_beverage_details_ingredient.rb +2 -6
- data/lib/square/types/catalog_item_modifier_list_info.rb +6 -9
- data/lib/square/types/catalog_item_variation.rb +17 -13
- data/lib/square/types/catalog_modifier.rb +4 -4
- data/lib/square/types/catalog_modifier_list.rb +4 -2
- data/lib/square/types/catalog_modifier_override.rb +2 -2
- data/lib/square/types/catalog_modifier_toggle_override_type.rb +13 -0
- data/lib/square/types/catalog_object.rb +7 -3
- data/lib/square/types/catalog_object_base.rb +2 -4
- data/lib/square/types/catalog_object_category.rb +3 -4
- data/lib/square/types/catalog_object_custom_attribute_definition.rb +1 -3
- data/lib/square/types/catalog_object_quick_amounts_settings.rb +1 -3
- data/lib/square/types/catalog_object_reference.rb +1 -1
- data/lib/square/types/catalog_object_subscription_plan_variation.rb +1 -3
- data/lib/square/types/catalog_query.rb +11 -13
- data/lib/square/types/catalog_query_prefix.rb +2 -1
- data/lib/square/types/catalog_query_text.rb +2 -1
- data/lib/square/types/catalog_subscription_plan.rb +5 -5
- data/lib/square/types/catalog_subscription_plan_variation.rb +4 -2
- data/lib/square/types/catalog_v_1_id.rb +1 -1
- data/lib/square/types/catalog_version_updated_event_object.rb +1 -3
- data/lib/square/types/checkout.rb +1 -3
- data/lib/square/types/checkout_location_settings.rb +1 -3
- data/lib/square/types/checkout_location_settings_branding.rb +2 -6
- data/lib/square/types/checkout_merchant_settings.rb +1 -3
- data/lib/square/types/checkout_merchant_settings_payment_methods.rb +4 -12
- data/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.rb +2 -6
- data/lib/square/types/component.rb +4 -12
- data/lib/square/types/create_bank_account_response.rb +11 -0
- data/lib/square/types/create_booking_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/create_catalog_image_request.rb +1 -1
- data/lib/square/types/create_customer_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/create_location_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/create_merchant_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/create_order_custom_attribute_definition_response.rb +1 -3
- data/lib/square/types/create_transfer_order_data.rb +3 -4
- data/lib/square/types/create_webhook_subscription_response.rb +2 -1
- data/lib/square/types/custom_attribute.rb +1 -1
- data/lib/square/types/custom_attribute_definition.rb +1 -3
- data/lib/square/types/custom_attribute_definition_event_data_object.rb +1 -3
- data/lib/square/types/custom_field.rb +2 -1
- data/lib/square/types/customer_address_filter.rb +2 -1
- data/lib/square/types/customer_created_event.rb +4 -2
- data/lib/square/types/customer_created_event_event_context_merge.rb +2 -1
- data/lib/square/types/customer_creation_source_filter.rb +1 -3
- data/lib/square/types/customer_custom_attribute_filter.rb +2 -1
- data/lib/square/types/customer_custom_attribute_filter_value.rb +2 -1
- data/lib/square/types/customer_custom_attribute_filters.rb +7 -6
- data/lib/square/types/customer_custom_attribute_visible_updated_event.rb +6 -3
- data/lib/square/types/customer_deleted_event.rb +4 -2
- data/lib/square/types/customer_deleted_event_event_context_merge.rb +2 -1
- data/lib/square/types/customer_tax_ids.rb +4 -2
- data/lib/square/types/customer_updated_event.rb +4 -2
- data/lib/square/types/delete_booking_custom_attribute_definition_response.rb +5 -2
- data/lib/square/types/delete_booking_custom_attribute_response.rb +2 -1
- data/lib/square/types/delete_customer_custom_attribute_response.rb +2 -1
- data/lib/square/types/delete_location_custom_attribute_response.rb +2 -1
- data/lib/square/types/delete_merchant_custom_attribute_response.rb +2 -1
- data/lib/square/types/delete_subscription_action_response.rb +2 -1
- data/lib/square/types/delete_webhook_subscription_response.rb +2 -1
- data/lib/square/types/destination_details.rb +1 -3
- data/lib/square/types/device_checkout_options.rb +1 -0
- data/lib/square/types/device_component_details_ethernet_details.rb +1 -1
- data/lib/square/types/device_component_details_wi_fi_details.rb +1 -1
- data/lib/square/types/digital_wallet_details.rb +1 -0
- data/lib/square/types/disable_bank_account_response.rb +11 -0
- data/lib/square/types/dispute.rb +2 -1
- data/lib/square/types/dispute_evidence_added_event.rb +2 -1
- data/lib/square/types/dispute_evidence_created_event.rb +2 -1
- data/lib/square/types/employee_wage.rb +2 -1
- data/lib/square/types/error_code.rb +2 -0
- data/lib/square/types/event_data.rb +1 -3
- data/lib/square/types/fulfillment.rb +4 -7
- data/lib/square/types/fulfillment_delivery_details.rb +1 -3
- data/lib/square/types/fulfillment_pickup_details.rb +1 -3
- data/lib/square/types/get_bank_account_response.rb +1 -1
- data/lib/square/types/get_booking_request.rb +23 -0
- data/lib/square/types/get_business_booking_profile_request.rb +23 -0
- data/lib/square/types/get_card_request.rb +23 -0
- data/lib/square/types/get_catalog_object_response.rb +1 -3
- data/lib/square/types/get_customer_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/get_customer_custom_attribute_response.rb +2 -1
- data/lib/square/types/get_customer_group_request.rb +23 -0
- data/lib/square/types/get_customer_request.rb +23 -0
- data/lib/square/types/get_customer_segment_request.rb +23 -0
- data/lib/square/types/get_dispute_evidence_request.rb +23 -0
- data/lib/square/types/get_dispute_request.rb +23 -0
- data/lib/square/types/get_employee_request.rb +23 -0
- data/lib/square/types/get_gift_card_request.rb +23 -0
- data/lib/square/types/get_inventory_adjustment_request.rb +23 -0
- data/lib/square/types/get_inventory_physical_count_request.rb +23 -0
- data/lib/square/types/get_inventory_transfer_request.rb +23 -0
- data/lib/square/types/get_location_request.rb +23 -0
- data/lib/square/types/get_loyalty_account_request.rb +23 -0
- data/lib/square/types/get_loyalty_program_request.rb +23 -0
- data/lib/square/types/get_loyalty_promotion_request.rb +23 -0
- data/lib/square/types/get_loyalty_reward_request.rb +23 -0
- data/lib/square/types/get_merchant_request.rb +23 -0
- data/lib/square/types/get_order_request.rb +23 -0
- data/lib/square/types/get_payment_link_request.rb +23 -0
- data/lib/square/types/get_snippet_request.rb +23 -0
- data/lib/square/types/get_team_member_booking_profile_request.rb +23 -0
- data/lib/square/types/get_team_member_booking_profile_response.rb +1 -3
- data/lib/square/types/get_team_member_request.rb +23 -0
- data/lib/square/types/get_transaction_request.rb +23 -0
- data/lib/square/types/get_vendor_request.rb +23 -0
- data/lib/square/types/get_wage_setting_request.rb +23 -0
- data/lib/square/types/get_webhook_subscription_request.rb +23 -0
- data/lib/square/types/get_webhook_subscription_response.rb +2 -1
- data/lib/square/types/gift_card_activity.rb +8 -24
- data/lib/square/types/gift_card_activity_block_reason.rb +23 -0
- data/lib/square/types/gift_card_activity_unblock_reason.rb +23 -0
- data/lib/square/types/gift_card_activity_updated_event.rb +2 -1
- data/lib/square/types/inventory_count_updated_event_object.rb +1 -3
- data/lib/square/types/invoice.rb +6 -13
- data/lib/square/types/invoice_accepted_payment_methods.rb +2 -1
- data/lib/square/types/invoice_attachment.rb +1 -1
- data/lib/square/types/invoice_custom_field.rb +2 -1
- data/lib/square/types/invoice_payment_made_event.rb +2 -1
- data/lib/square/types/invoice_payment_request.rb +6 -8
- data/lib/square/types/invoice_refunded_event.rb +2 -1
- data/lib/square/types/invoice_sort_field.rb +23 -0
- data/lib/square/types/labor_scheduled_shift_created_event_object.rb +1 -1
- data/lib/square/types/labor_scheduled_shift_published_event_object.rb +1 -1
- data/lib/square/types/labor_scheduled_shift_updated_event_object.rb +1 -1
- data/lib/square/types/list_bank_accounts_response.rb +1 -1
- data/lib/square/types/list_booking_custom_attribute_definitions_response.rb +4 -4
- data/lib/square/types/list_booking_custom_attributes_response.rb +3 -4
- data/lib/square/types/list_cash_drawer_shift_events_response.rb +1 -3
- data/lib/square/types/list_cash_drawer_shifts_response.rb +1 -3
- data/lib/square/types/list_channels_request_constants.rb +23 -0
- data/lib/square/types/list_customer_custom_attribute_definitions_response.rb +4 -4
- data/lib/square/types/list_customer_custom_attributes_response.rb +3 -4
- data/lib/square/types/list_gift_card_activities_response.rb +1 -3
- data/lib/square/types/list_location_booking_profiles_response.rb +1 -3
- data/lib/square/types/list_location_custom_attribute_definitions_response.rb +4 -4
- data/lib/square/types/list_location_custom_attributes_response.rb +3 -4
- data/lib/square/types/list_loyalty_promotions_response.rb +1 -3
- data/lib/square/types/list_merchant_custom_attribute_definitions_response.rb +4 -4
- data/lib/square/types/list_merchant_custom_attributes_response.rb +3 -4
- data/lib/square/types/list_order_custom_attribute_definitions_response.rb +1 -3
- data/lib/square/types/list_order_custom_attributes_response.rb +1 -3
- data/lib/square/types/list_subscription_events_response.rb +1 -3
- data/lib/square/types/list_team_member_booking_profiles_response.rb +1 -3
- data/lib/square/types/list_team_member_wages_response.rb +1 -3
- data/lib/square/types/list_webhook_subscriptions_response.rb +1 -3
- data/lib/square/types/list_workweek_configs_response.rb +1 -3
- data/lib/square/types/location.rb +1 -3
- data/lib/square/types/location_booking_profile.rb +2 -1
- data/lib/square/types/location_custom_attribute_visible_updated_event.rb +6 -3
- data/lib/square/types/loyalty_account.rb +1 -3
- data/lib/square/types/loyalty_account_mapping_type.rb +23 -0
- data/lib/square/types/loyalty_event.rb +3 -4
- data/lib/square/types/loyalty_event_filter.rb +1 -3
- data/lib/square/types/loyalty_program.rb +4 -7
- data/lib/square/types/loyalty_program_accrual_rule.rb +3 -4
- data/lib/square/types/loyalty_program_reward_tier.rb +3 -1
- data/lib/square/types/loyalty_promotion_incentive.rb +2 -6
- data/lib/square/types/loyalty_promotion_incentive_points_addition_data.rb +2 -1
- data/lib/square/types/loyalty_promotion_incentive_points_multiplier_data.rb +2 -1
- data/lib/square/types/loyalty_promotion_trigger_limit.rb +2 -1
- data/lib/square/types/loyalty_reward.rb +4 -2
- data/lib/square/types/measurement_unit_generic.rb +23 -0
- data/lib/square/types/oauth_authorization_revoked_event_object.rb +1 -3
- data/lib/square/types/oauth_authorization_revoked_event_revocation_object.rb +1 -3
- data/lib/square/types/order.rb +2 -6
- data/lib/square/types/order_card_surcharge_treatment_type.rb +12 -0
- data/lib/square/types/order_custom_attribute_definition_owned_created_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_definition_owned_deleted_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_definition_owned_updated_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_definition_visible_created_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_definition_visible_deleted_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_definition_visible_updated_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_owned_deleted_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_owned_updated_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_visible_deleted_event.rb +2 -1
- data/lib/square/types/order_custom_attribute_visible_updated_event.rb +2 -1
- data/lib/square/types/order_fulfillment_updated.rb +1 -3
- data/lib/square/types/order_line_item.rb +4 -12
- data/lib/square/types/order_line_item_applied_tax.rb +1 -0
- data/lib/square/types/order_line_item_pricing_blocklists.rb +3 -6
- data/lib/square/types/order_line_item_pricing_blocklists_blocked_service_charge.rb +14 -0
- data/lib/square/types/order_return.rb +3 -9
- data/lib/square/types/order_return_line_item.rb +4 -12
- data/lib/square/types/order_return_service_charge.rb +3 -6
- data/lib/square/types/order_service_charge.rb +2 -6
- data/lib/square/types/payment.rb +1 -3
- data/lib/square/types/payment_link_related_resources.rb +1 -3
- data/lib/square/types/payment_refund.rb +1 -3
- data/lib/square/types/payout_entry.rb +24 -72
- data/lib/square/types/pre_populated_data.rb +2 -1
- data/lib/square/types/product_type.rb +23 -0
- data/lib/square/types/refund.rb +1 -3
- data/lib/square/types/retrieve_booking_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/retrieve_booking_custom_attribute_response.rb +2 -1
- data/lib/square/types/retrieve_location_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/retrieve_location_custom_attribute_response.rb +2 -1
- data/lib/square/types/retrieve_merchant_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/retrieve_merchant_custom_attribute_response.rb +2 -1
- data/lib/square/types/retrieve_order_custom_attribute_definition_response.rb +1 -3
- data/lib/square/types/scheduled_shift_filter.rb +3 -7
- data/lib/square/types/scheduled_shift_workday.rb +1 -3
- data/lib/square/types/search_availability_filter.rb +1 -3
- data/lib/square/types/search_catalog_items_response.rb +2 -1
- data/lib/square/types/search_catalog_objects_response.rb +1 -3
- data/lib/square/types/search_events_sort_field.rb +23 -0
- data/lib/square/types/search_loyalty_accounts_request_loyalty_account_query.rb +1 -3
- data/lib/square/types/search_loyalty_accounts_response.rb +1 -3
- data/lib/square/types/search_orders_date_time_filter.rb +2 -1
- data/lib/square/types/search_orders_fulfillment_filter.rb +2 -6
- data/lib/square/types/search_orders_source_filter.rb +2 -0
- data/lib/square/types/search_scheduled_shifts_response.rb +1 -3
- data/lib/square/types/search_transfer_orders_response.rb +1 -3
- data/lib/square/types/shift_filter.rb +3 -2
- data/lib/square/types/shift_query.rb +2 -1
- data/lib/square/types/shift_sort.rb +2 -1
- data/lib/square/types/shift_wage.rb +2 -1
- data/lib/square/types/shift_workday.rb +2 -1
- data/lib/square/types/snippet.rb +2 -1
- data/lib/square/types/standard_unit_description_group.rb +1 -3
- data/lib/square/types/subscription_event.rb +1 -3
- data/lib/square/types/subscription_phase.rb +2 -1
- data/lib/square/types/subscription_test_result.rb +5 -3
- data/lib/square/types/team_member_assigned_locations.rb +1 -3
- data/lib/square/types/team_member_booking_profile.rb +2 -1
- data/lib/square/types/tender.rb +2 -6
- data/lib/square/types/tender_buy_now_pay_later_details.rb +1 -3
- data/lib/square/types/terminal_refund.rb +2 -1
- data/lib/square/types/test_webhook_subscription_response.rb +5 -5
- data/lib/square/types/timecard_filter.rb +1 -1
- data/lib/square/types/transfer_order.rb +1 -3
- data/lib/square/types/transfer_order_filter.rb +1 -3
- data/lib/square/types/transfer_order_goods_receipt.rb +1 -3
- data/lib/square/types/update_booking_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/update_customer_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/update_location_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/update_merchant_custom_attribute_definition_response.rb +4 -4
- data/lib/square/types/update_order_custom_attribute_definition_response.rb +1 -3
- data/lib/square/types/update_transfer_order_data.rb +1 -3
- data/lib/square/types/update_webhook_subscription_response.rb +2 -1
- data/lib/square/types/update_webhook_subscription_signature_key_response.rb +3 -1
- data/lib/square/types/upsert_booking_custom_attribute_response.rb +2 -1
- data/lib/square/types/upsert_catalog_object_response.rb +1 -3
- data/lib/square/types/upsert_customer_custom_attribute_response.rb +2 -1
- data/lib/square/types/upsert_location_custom_attribute_response.rb +2 -1
- data/lib/square/types/upsert_merchant_custom_attribute_response.rb +2 -1
- data/lib/square/types/v_1_get_payment_request.rb +23 -0
- data/lib/square/types/v_1_get_settlement_request.rb +23 -0
- data/lib/square/types/v_1_order.rb +1 -3
- data/lib/square/types/vendor_created_event_object_operation.rb +23 -0
- data/lib/square/types/vendor_updated_event_object_operation.rb +23 -0
- data/lib/square/types/wage_setting.rb +1 -3
- data/lib/square/v_1_transactions/client.rb +72 -29
- data/lib/square/vendors/client.rb +126 -51
- data/lib/square/vendors/types/batch_update_vendors_request.rb +1 -3
- data/lib/square/version.rb +1 -1
- data/lib/square/webhooks/client.rb +3 -1
- data/lib/square/webhooks/event_types/client.rb +25 -14
- data/lib/square/webhooks/subscriptions/client.rb +164 -69
- data/lib/square.rb +57 -5
- data/lib/square_legacy/utilities/webhooks_helper.rb +1 -1
- data/reference.md +29588 -0
- data/wiremock/docker-compose.test.yml +14 -0
- data/wiremock/wiremock-mappings.json +1 -0
- metadata +69 -45
- data/lib/square/mobile/client.rb +0 -50
- data/lib/square/mobile/types/create_mobile_authorization_code_request.rb +0 -11
- data/lib/square/types/create_mobile_authorization_code_response.rb +0 -13
- data/test/square/integration/client_tests/test_cash_drawers.rb +0 -27
- data/test/square/integration/client_tests/test_catalog.rb +0 -704
- data/test/square/integration/client_tests/test_customers.rb +0 -65
- data/test/square/integration/client_tests/test_customers_groups.rb +0 -144
- data/test/square/integration/client_tests/test_customers_segments.rb +0 -36
- data/test/square/integration/client_tests/test_devices.rb +0 -67
- data/test/square/integration/client_tests/test_inventory.rb +0 -28
- data/test/square/integration/client_tests/test_locations.rb +0 -18
- data/test/square/integration/client_tests/test_merchants.rb +0 -40
- data/test/square/integration/client_tests/test_mobile.rb +0 -21
- data/test/square/integration/client_tests/test_orders.rb +0 -177
- data/test/square/integration/client_tests/test_payments.rb +0 -167
- data/test/square/integration/client_tests/test_refunds.rb +0 -133
- data/test/square/integration/client_tests/test_team_members.rb +0 -97
- data/test/square/integration/client_tests/test_terminal.rb +0 -107
- data/test/square/integration/integration_test_base.rb +0 -16
- data/test/square/integration/testdata/image.jpeg +0 -0
- data/test/square/internal/multipart/test_form_data.rb +0 -311
- data/test/square/internal/types/test_array.rb +0 -37
- data/test/square/internal/types/test_boolean.rb +0 -35
- data/test/square/internal/types/test_enum.rb +0 -42
- data/test/square/internal/types/test_hash.rb +0 -50
- data/test/square/internal/types/test_model.rb +0 -105
- data/test/square/internal/types/test_union.rb +0 -52
- data/test/square/internal/types/test_utils.rb +0 -216
- data/test/square_legacy/api/api_test_base.rb +0 -27
- data/test/square_legacy/api/test_catalog_api.rb +0 -57
- data/test/square_legacy/api/test_customers_api.rb +0 -43
- data/test/square_legacy/api/test_employees_api.rb +0 -34
- data/test/square_legacy/api/test_labor_api.rb +0 -82
- data/test/square_legacy/api/test_locations_api.rb +0 -22
- data/test/square_legacy/api/test_merchants_api.rb +0 -38
- data/test/square_legacy/api/test_payments_api.rb +0 -40
- data/test/square_legacy/api/test_refunds_api.rb +0 -42
- data/test/square_legacy/http_response_catcher.rb +0 -14
- data/test/square_legacy/webhooks/test_webhooks_helper.rb +0 -153
- data/test/test_helper.rb +0 -123
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
module Square
|
|
4
4
|
module Catalog
|
|
5
5
|
class Client
|
|
6
|
-
# @
|
|
6
|
+
# @param client [Square::Internal::Http::RawClient]
|
|
7
|
+
#
|
|
8
|
+
# @return [void]
|
|
7
9
|
def initialize(client:)
|
|
8
10
|
@client = client
|
|
9
11
|
end
|
|
@@ -23,25 +25,35 @@ module Square
|
|
|
23
25
|
# While one (batch or non-batch) delete request is being processed, other (batched and non-batched)
|
|
24
26
|
# delete requests are rejected with the `429` error code.
|
|
25
27
|
#
|
|
28
|
+
# @param request_options [Hash]
|
|
29
|
+
# @param params [Square::Catalog::Types::BatchDeleteCatalogObjectsRequest]
|
|
30
|
+
# @option request_options [String] :base_url
|
|
31
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
32
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
33
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
34
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
35
|
+
#
|
|
26
36
|
# @return [Square::Types::BatchDeleteCatalogObjectsResponse]
|
|
27
37
|
def batch_delete(request_options: {}, **params)
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
39
|
+
request = Square::Internal::JSON::Request.new(
|
|
40
|
+
base_url: request_options[:base_url],
|
|
30
41
|
method: "POST",
|
|
31
42
|
path: "v2/catalog/batch-delete",
|
|
32
|
-
body: params
|
|
43
|
+
body: Square::Catalog::Types::BatchDeleteCatalogObjectsRequest.new(params).to_h,
|
|
44
|
+
request_options: request_options
|
|
33
45
|
)
|
|
34
46
|
begin
|
|
35
|
-
|
|
47
|
+
response = @client.send(request)
|
|
36
48
|
rescue Net::HTTPRequestTimeout
|
|
37
49
|
raise Square::Errors::TimeoutError
|
|
38
50
|
end
|
|
39
|
-
code =
|
|
51
|
+
code = response.code.to_i
|
|
40
52
|
if code.between?(200, 299)
|
|
41
|
-
Square::Types::BatchDeleteCatalogObjectsResponse.load(
|
|
53
|
+
Square::Types::BatchDeleteCatalogObjectsResponse.load(response.body)
|
|
42
54
|
else
|
|
43
55
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
44
|
-
raise error_class.new(
|
|
56
|
+
raise error_class.new(response.body, code: code)
|
|
45
57
|
end
|
|
46
58
|
end
|
|
47
59
|
|
|
@@ -52,25 +64,35 @@ module Square
|
|
|
52
64
|
# its [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of
|
|
53
65
|
# any [CatalogTax](entity:CatalogTax) objects that apply to it.
|
|
54
66
|
#
|
|
67
|
+
# @param request_options [Hash]
|
|
68
|
+
# @param params [Square::Catalog::Types::BatchGetCatalogObjectsRequest]
|
|
69
|
+
# @option request_options [String] :base_url
|
|
70
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
71
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
72
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
73
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
74
|
+
#
|
|
55
75
|
# @return [Square::Types::BatchGetCatalogObjectsResponse]
|
|
56
76
|
def batch_get(request_options: {}, **params)
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
78
|
+
request = Square::Internal::JSON::Request.new(
|
|
79
|
+
base_url: request_options[:base_url],
|
|
59
80
|
method: "POST",
|
|
60
81
|
path: "v2/catalog/batch-retrieve",
|
|
61
|
-
body: params
|
|
82
|
+
body: Square::Catalog::Types::BatchGetCatalogObjectsRequest.new(params).to_h,
|
|
83
|
+
request_options: request_options
|
|
62
84
|
)
|
|
63
85
|
begin
|
|
64
|
-
|
|
86
|
+
response = @client.send(request)
|
|
65
87
|
rescue Net::HTTPRequestTimeout
|
|
66
88
|
raise Square::Errors::TimeoutError
|
|
67
89
|
end
|
|
68
|
-
code =
|
|
90
|
+
code = response.code.to_i
|
|
69
91
|
if code.between?(200, 299)
|
|
70
|
-
Square::Types::BatchGetCatalogObjectsResponse.load(
|
|
92
|
+
Square::Types::BatchGetCatalogObjectsResponse.load(response.body)
|
|
71
93
|
else
|
|
72
94
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
73
|
-
raise error_class.new(
|
|
95
|
+
raise error_class.new(response.body, code: code)
|
|
74
96
|
end
|
|
75
97
|
end
|
|
76
98
|
|
|
@@ -88,153 +110,223 @@ module Square
|
|
|
88
110
|
# While one (batch or non-batch) update request is being processed, other (batched and non-batched)
|
|
89
111
|
# update requests are rejected with the `429` error code.
|
|
90
112
|
#
|
|
113
|
+
# @param request_options [Hash]
|
|
114
|
+
# @param params [Square::Catalog::Types::BatchUpsertCatalogObjectsRequest]
|
|
115
|
+
# @option request_options [String] :base_url
|
|
116
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
117
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
118
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
119
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
120
|
+
#
|
|
91
121
|
# @return [Square::Types::BatchUpsertCatalogObjectsResponse]
|
|
92
122
|
def batch_upsert(request_options: {}, **params)
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
124
|
+
request = Square::Internal::JSON::Request.new(
|
|
125
|
+
base_url: request_options[:base_url],
|
|
95
126
|
method: "POST",
|
|
96
127
|
path: "v2/catalog/batch-upsert",
|
|
97
|
-
body: params
|
|
128
|
+
body: Square::Catalog::Types::BatchUpsertCatalogObjectsRequest.new(params).to_h,
|
|
129
|
+
request_options: request_options
|
|
98
130
|
)
|
|
99
131
|
begin
|
|
100
|
-
|
|
132
|
+
response = @client.send(request)
|
|
101
133
|
rescue Net::HTTPRequestTimeout
|
|
102
134
|
raise Square::Errors::TimeoutError
|
|
103
135
|
end
|
|
104
|
-
code =
|
|
136
|
+
code = response.code.to_i
|
|
105
137
|
if code.between?(200, 299)
|
|
106
|
-
Square::Types::BatchUpsertCatalogObjectsResponse.load(
|
|
138
|
+
Square::Types::BatchUpsertCatalogObjectsResponse.load(response.body)
|
|
107
139
|
else
|
|
108
140
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
109
|
-
raise error_class.new(
|
|
141
|
+
raise error_class.new(response.body, code: code)
|
|
110
142
|
end
|
|
111
143
|
end
|
|
112
144
|
|
|
113
145
|
# Retrieves information about the Square Catalog API, such as batch size
|
|
114
146
|
# limits that can be used by the `BatchUpsertCatalogObjects` endpoint.
|
|
115
147
|
#
|
|
148
|
+
# @param request_options [Hash]
|
|
149
|
+
# @param params [Hash]
|
|
150
|
+
# @option request_options [String] :base_url
|
|
151
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
152
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
153
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
154
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
155
|
+
#
|
|
116
156
|
# @return [Square::Types::CatalogInfoResponse]
|
|
117
|
-
def info(request_options: {}, **
|
|
118
|
-
|
|
119
|
-
|
|
157
|
+
def info(request_options: {}, **params)
|
|
158
|
+
Square::Internal::Types::Utils.normalize_keys(params)
|
|
159
|
+
request = Square::Internal::JSON::Request.new(
|
|
160
|
+
base_url: request_options[:base_url],
|
|
120
161
|
method: "GET",
|
|
121
|
-
path: "v2/catalog/info"
|
|
162
|
+
path: "v2/catalog/info",
|
|
163
|
+
request_options: request_options
|
|
122
164
|
)
|
|
123
165
|
begin
|
|
124
|
-
|
|
166
|
+
response = @client.send(request)
|
|
125
167
|
rescue Net::HTTPRequestTimeout
|
|
126
168
|
raise Square::Errors::TimeoutError
|
|
127
169
|
end
|
|
128
|
-
code =
|
|
170
|
+
code = response.code.to_i
|
|
129
171
|
if code.between?(200, 299)
|
|
130
|
-
Square::Types::CatalogInfoResponse.load(
|
|
172
|
+
Square::Types::CatalogInfoResponse.load(response.body)
|
|
131
173
|
else
|
|
132
174
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
133
|
-
raise error_class.new(
|
|
175
|
+
raise error_class.new(response.body, code: code)
|
|
134
176
|
end
|
|
135
177
|
end
|
|
136
178
|
|
|
137
179
|
# Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified types in the catalog.
|
|
138
180
|
#
|
|
139
|
-
# The `types` parameter is specified as a comma-separated list of the
|
|
181
|
+
# The `types` parameter is specified as a comma-separated list of the
|
|
182
|
+
# [CatalogObjectType](entity:CatalogObjectType) values,
|
|
140
183
|
# for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
|
|
141
184
|
#
|
|
142
185
|
# __Important:__ ListCatalog does not return deleted catalog items. To retrieve
|
|
143
186
|
# deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
|
|
144
187
|
# and set the `include_deleted_objects` attribute value to `true`.
|
|
145
188
|
#
|
|
189
|
+
# @param request_options [Hash]
|
|
190
|
+
# @param params [Hash]
|
|
191
|
+
# @option request_options [String] :base_url
|
|
192
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
193
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
194
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
195
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
196
|
+
# @option params [String, nil] :cursor
|
|
197
|
+
# @option params [String, nil] :types
|
|
198
|
+
# @option params [Integer, nil] :catalog_version
|
|
199
|
+
#
|
|
146
200
|
# @return [Square::Types::ListCatalogResponse]
|
|
147
201
|
def list(request_options: {}, **params)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
].
|
|
152
|
-
|
|
153
|
-
params.
|
|
202
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
203
|
+
query_param_names = %i[cursor types catalog_version]
|
|
204
|
+
query_params = {}
|
|
205
|
+
query_params["cursor"] = params[:cursor] if params.key?(:cursor)
|
|
206
|
+
query_params["types"] = params[:types] if params.key?(:types)
|
|
207
|
+
query_params["catalog_version"] = params[:catalog_version] if params.key?(:catalog_version)
|
|
208
|
+
params.except(*query_param_names)
|
|
154
209
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
210
|
+
Square::Internal::CursorItemIterator.new(
|
|
211
|
+
cursor_field: :cursor,
|
|
212
|
+
item_field: :objects,
|
|
213
|
+
initial_cursor: query_params[:cursor]
|
|
214
|
+
) do |next_cursor|
|
|
215
|
+
query_params[:cursor] = next_cursor
|
|
216
|
+
request = Square::Internal::JSON::Request.new(
|
|
217
|
+
base_url: request_options[:base_url],
|
|
218
|
+
method: "GET",
|
|
219
|
+
path: "v2/catalog/list",
|
|
220
|
+
query: query_params,
|
|
221
|
+
request_options: request_options
|
|
222
|
+
)
|
|
223
|
+
begin
|
|
224
|
+
response = @client.send(request)
|
|
225
|
+
rescue Net::HTTPRequestTimeout
|
|
226
|
+
raise Square::Errors::TimeoutError
|
|
227
|
+
end
|
|
228
|
+
code = response.code.to_i
|
|
229
|
+
if code.between?(200, 299)
|
|
230
|
+
Square::Types::ListCatalogResponse.load(response.body)
|
|
231
|
+
else
|
|
232
|
+
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
233
|
+
raise error_class.new(response.body, code: code)
|
|
234
|
+
end
|
|
172
235
|
end
|
|
173
236
|
end
|
|
174
237
|
|
|
175
238
|
# Searches for [CatalogObject](entity:CatalogObject) of any type by matching supported search attribute values,
|
|
176
|
-
# excluding custom attribute values on items or item variations, against one or more of the specified query
|
|
239
|
+
# excluding custom attribute values on items or item variations, against one or more of the specified query
|
|
240
|
+
# filters.
|
|
177
241
|
#
|
|
178
|
-
# This (`SearchCatalogObjects`) endpoint differs from the
|
|
242
|
+
# This (`SearchCatalogObjects`) endpoint differs from the
|
|
243
|
+
# [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems)
|
|
179
244
|
# endpoint in the following aspects:
|
|
180
245
|
#
|
|
181
|
-
# - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search
|
|
182
|
-
#
|
|
183
|
-
# - `SearchCatalogItems`
|
|
246
|
+
# - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search
|
|
247
|
+
# for any type of catalog objects.
|
|
248
|
+
# - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that
|
|
249
|
+
# contain custom attribute values, where `SearchCatalogObjects` does not.
|
|
250
|
+
# - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item
|
|
251
|
+
# variations, whereas `SearchCatalogObjects` does.
|
|
184
252
|
# - The both endpoints have different call conventions, including the query filter formats.
|
|
185
253
|
#
|
|
254
|
+
# @param request_options [Hash]
|
|
255
|
+
# @param params [Square::Catalog::Types::SearchCatalogObjectsRequest]
|
|
256
|
+
# @option request_options [String] :base_url
|
|
257
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
258
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
259
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
260
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
261
|
+
#
|
|
186
262
|
# @return [Square::Types::SearchCatalogObjectsResponse]
|
|
187
263
|
def search(request_options: {}, **params)
|
|
188
|
-
|
|
189
|
-
|
|
264
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
265
|
+
request = Square::Internal::JSON::Request.new(
|
|
266
|
+
base_url: request_options[:base_url],
|
|
190
267
|
method: "POST",
|
|
191
268
|
path: "v2/catalog/search",
|
|
192
|
-
body: params
|
|
269
|
+
body: Square::Catalog::Types::SearchCatalogObjectsRequest.new(params).to_h,
|
|
270
|
+
request_options: request_options
|
|
193
271
|
)
|
|
194
272
|
begin
|
|
195
|
-
|
|
273
|
+
response = @client.send(request)
|
|
196
274
|
rescue Net::HTTPRequestTimeout
|
|
197
275
|
raise Square::Errors::TimeoutError
|
|
198
276
|
end
|
|
199
|
-
code =
|
|
277
|
+
code = response.code.to_i
|
|
200
278
|
if code.between?(200, 299)
|
|
201
|
-
Square::Types::SearchCatalogObjectsResponse.load(
|
|
279
|
+
Square::Types::SearchCatalogObjectsResponse.load(response.body)
|
|
202
280
|
else
|
|
203
281
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
204
|
-
raise error_class.new(
|
|
282
|
+
raise error_class.new(response.body, code: code)
|
|
205
283
|
end
|
|
206
284
|
end
|
|
207
285
|
|
|
208
286
|
# Searches for catalog items or item variations by matching supported search attribute values, including
|
|
209
287
|
# custom attribute values, against one or more of the specified query filters.
|
|
210
288
|
#
|
|
211
|
-
# This (`SearchCatalogItems`) endpoint differs from the
|
|
289
|
+
# This (`SearchCatalogItems`) endpoint differs from the
|
|
290
|
+
# [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
|
|
212
291
|
# endpoint in the following aspects:
|
|
213
292
|
#
|
|
214
|
-
# - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search
|
|
215
|
-
#
|
|
216
|
-
# - `SearchCatalogItems`
|
|
293
|
+
# - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search
|
|
294
|
+
# for any type of catalog objects.
|
|
295
|
+
# - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that
|
|
296
|
+
# contain custom attribute values, where `SearchCatalogObjects` does not.
|
|
297
|
+
# - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item
|
|
298
|
+
# variations, whereas `SearchCatalogObjects` does.
|
|
217
299
|
# - The both endpoints use different call conventions, including the query filter formats.
|
|
218
300
|
#
|
|
301
|
+
# @param request_options [Hash]
|
|
302
|
+
# @param params [Square::Catalog::Types::SearchCatalogItemsRequest]
|
|
303
|
+
# @option request_options [String] :base_url
|
|
304
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
305
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
306
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
307
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
308
|
+
#
|
|
219
309
|
# @return [Square::Types::SearchCatalogItemsResponse]
|
|
220
310
|
def search_items(request_options: {}, **params)
|
|
221
|
-
|
|
222
|
-
|
|
311
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
312
|
+
request = Square::Internal::JSON::Request.new(
|
|
313
|
+
base_url: request_options[:base_url],
|
|
223
314
|
method: "POST",
|
|
224
315
|
path: "v2/catalog/search-catalog-items",
|
|
225
|
-
body: params
|
|
316
|
+
body: Square::Catalog::Types::SearchCatalogItemsRequest.new(params).to_h,
|
|
317
|
+
request_options: request_options
|
|
226
318
|
)
|
|
227
319
|
begin
|
|
228
|
-
|
|
320
|
+
response = @client.send(request)
|
|
229
321
|
rescue Net::HTTPRequestTimeout
|
|
230
322
|
raise Square::Errors::TimeoutError
|
|
231
323
|
end
|
|
232
|
-
code =
|
|
324
|
+
code = response.code.to_i
|
|
233
325
|
if code.between?(200, 299)
|
|
234
|
-
Square::Types::SearchCatalogItemsResponse.load(
|
|
326
|
+
Square::Types::SearchCatalogItemsResponse.load(response.body)
|
|
235
327
|
else
|
|
236
328
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
237
|
-
raise error_class.new(
|
|
329
|
+
raise error_class.new(response.body, code: code)
|
|
238
330
|
end
|
|
239
331
|
end
|
|
240
332
|
|
|
@@ -242,25 +334,35 @@ module Square
|
|
|
242
334
|
# that apply to the targeted [CatalogItem](entity:CatalogItem) without having
|
|
243
335
|
# to perform an upsert on the entire item.
|
|
244
336
|
#
|
|
337
|
+
# @param request_options [Hash]
|
|
338
|
+
# @param params [Square::Catalog::Types::UpdateItemModifierListsRequest]
|
|
339
|
+
# @option request_options [String] :base_url
|
|
340
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
341
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
342
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
343
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
344
|
+
#
|
|
245
345
|
# @return [Square::Types::UpdateItemModifierListsResponse]
|
|
246
346
|
def update_item_modifier_lists(request_options: {}, **params)
|
|
247
|
-
|
|
248
|
-
|
|
347
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
348
|
+
request = Square::Internal::JSON::Request.new(
|
|
349
|
+
base_url: request_options[:base_url],
|
|
249
350
|
method: "POST",
|
|
250
351
|
path: "v2/catalog/update-item-modifier-lists",
|
|
251
|
-
body: params
|
|
352
|
+
body: Square::Catalog::Types::UpdateItemModifierListsRequest.new(params).to_h,
|
|
353
|
+
request_options: request_options
|
|
252
354
|
)
|
|
253
355
|
begin
|
|
254
|
-
|
|
356
|
+
response = @client.send(request)
|
|
255
357
|
rescue Net::HTTPRequestTimeout
|
|
256
358
|
raise Square::Errors::TimeoutError
|
|
257
359
|
end
|
|
258
|
-
code =
|
|
360
|
+
code = response.code.to_i
|
|
259
361
|
if code.between?(200, 299)
|
|
260
|
-
Square::Types::UpdateItemModifierListsResponse.load(
|
|
362
|
+
Square::Types::UpdateItemModifierListsResponse.load(response.body)
|
|
261
363
|
else
|
|
262
364
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
263
|
-
raise error_class.new(
|
|
365
|
+
raise error_class.new(response.body, code: code)
|
|
264
366
|
end
|
|
265
367
|
end
|
|
266
368
|
|
|
@@ -268,25 +370,35 @@ module Square
|
|
|
268
370
|
# targeted [CatalogItem](entity:CatalogItem) without having to perform an
|
|
269
371
|
# upsert on the entire item.
|
|
270
372
|
#
|
|
373
|
+
# @param request_options [Hash]
|
|
374
|
+
# @param params [Square::Catalog::Types::UpdateItemTaxesRequest]
|
|
375
|
+
# @option request_options [String] :base_url
|
|
376
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
377
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
378
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
379
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
380
|
+
#
|
|
271
381
|
# @return [Square::Types::UpdateItemTaxesResponse]
|
|
272
382
|
def update_item_taxes(request_options: {}, **params)
|
|
273
|
-
|
|
274
|
-
|
|
383
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
384
|
+
request = Square::Internal::JSON::Request.new(
|
|
385
|
+
base_url: request_options[:base_url],
|
|
275
386
|
method: "POST",
|
|
276
387
|
path: "v2/catalog/update-item-taxes",
|
|
277
|
-
body: params
|
|
388
|
+
body: Square::Catalog::Types::UpdateItemTaxesRequest.new(params).to_h,
|
|
389
|
+
request_options: request_options
|
|
278
390
|
)
|
|
279
391
|
begin
|
|
280
|
-
|
|
392
|
+
response = @client.send(request)
|
|
281
393
|
rescue Net::HTTPRequestTimeout
|
|
282
394
|
raise Square::Errors::TimeoutError
|
|
283
395
|
end
|
|
284
|
-
code =
|
|
396
|
+
code = response.code.to_i
|
|
285
397
|
if code.between?(200, 299)
|
|
286
|
-
Square::Types::UpdateItemTaxesResponse.load(
|
|
398
|
+
Square::Types::UpdateItemTaxesResponse.load(response.body)
|
|
287
399
|
else
|
|
288
400
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
289
|
-
raise error_class.new(
|
|
401
|
+
raise error_class.new(response.body, code: code)
|
|
290
402
|
end
|
|
291
403
|
end
|
|
292
404
|
|
|
@@ -4,20 +4,34 @@ module Square
|
|
|
4
4
|
module Catalog
|
|
5
5
|
module Images
|
|
6
6
|
class Client
|
|
7
|
-
# @
|
|
7
|
+
# @param client [Square::Internal::Http::RawClient]
|
|
8
|
+
#
|
|
9
|
+
# @return [void]
|
|
8
10
|
def initialize(client:)
|
|
9
11
|
@client = client
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
# Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to
|
|
13
|
-
#
|
|
14
|
+
# Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to
|
|
15
|
+
# an existing
|
|
16
|
+
# [CatalogObject](entity:CatalogObject) instance. The resulting `CatalogImage` is unattached to any
|
|
17
|
+
# `CatalogObject` if the `object_id`
|
|
14
18
|
# is not specified.
|
|
15
19
|
#
|
|
16
|
-
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image
|
|
20
|
+
# This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image
|
|
21
|
+
# file part in
|
|
17
22
|
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
|
|
18
23
|
#
|
|
24
|
+
# @param request_options [Hash]
|
|
25
|
+
# @param params [void]
|
|
26
|
+
# @option request_options [String] :base_url
|
|
27
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
28
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
29
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
30
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
31
|
+
#
|
|
19
32
|
# @return [Square::Types::CreateCatalogImageResponse]
|
|
20
33
|
def create(request_options: {}, **params)
|
|
34
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
21
35
|
body = Internal::Multipart::FormData.new
|
|
22
36
|
|
|
23
37
|
if params[:request]
|
|
@@ -29,32 +43,46 @@ module Square
|
|
|
29
43
|
end
|
|
30
44
|
body.add_part(params[:image_file].to_form_data_part(name: "image_file")) if params[:image_file]
|
|
31
45
|
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
request = Square::Internal::Multipart::Request.new(
|
|
47
|
+
base_url: request_options[:base_url],
|
|
48
|
+
method: "POST",
|
|
34
49
|
path: "v2/catalog/images",
|
|
35
|
-
body: body
|
|
50
|
+
body: body,
|
|
51
|
+
request_options: request_options
|
|
36
52
|
)
|
|
37
53
|
begin
|
|
38
|
-
|
|
54
|
+
response = @client.send(request)
|
|
39
55
|
rescue Net::HTTPRequestTimeout
|
|
40
56
|
raise Square::Errors::TimeoutError
|
|
41
57
|
end
|
|
42
|
-
code =
|
|
58
|
+
code = response.code.to_i
|
|
43
59
|
if code.between?(200, 299)
|
|
44
|
-
Square::Types::CreateCatalogImageResponse.load(
|
|
60
|
+
Square::Types::CreateCatalogImageResponse.load(response.body)
|
|
45
61
|
else
|
|
46
62
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
47
|
-
raise error_class.new(
|
|
63
|
+
raise error_class.new(response.body, code: code)
|
|
48
64
|
end
|
|
49
65
|
end
|
|
50
66
|
|
|
51
|
-
# Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage)
|
|
67
|
+
# Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage)
|
|
68
|
+
# object.
|
|
52
69
|
#
|
|
53
|
-
# This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image
|
|
70
|
+
# This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image
|
|
71
|
+
# file part in
|
|
54
72
|
# JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
|
|
55
73
|
#
|
|
74
|
+
# @param request_options [Hash]
|
|
75
|
+
# @param params [void]
|
|
76
|
+
# @option request_options [String] :base_url
|
|
77
|
+
# @option request_options [Hash{String => Object}] :additional_headers
|
|
78
|
+
# @option request_options [Hash{String => Object}] :additional_query_parameters
|
|
79
|
+
# @option request_options [Hash{String => Object}] :additional_body_parameters
|
|
80
|
+
# @option request_options [Integer] :timeout_in_seconds
|
|
81
|
+
# @option params [String] :image_id
|
|
82
|
+
#
|
|
56
83
|
# @return [Square::Types::UpdateCatalogImageResponse]
|
|
57
84
|
def update(request_options: {}, **params)
|
|
85
|
+
params = Square::Internal::Types::Utils.normalize_keys(params)
|
|
58
86
|
body = Internal::Multipart::FormData.new
|
|
59
87
|
|
|
60
88
|
if params[:request]
|
|
@@ -66,22 +94,24 @@ module Square
|
|
|
66
94
|
end
|
|
67
95
|
body.add_part(params[:image_file].to_form_data_part(name: "image_file")) if params[:image_file]
|
|
68
96
|
|
|
69
|
-
|
|
70
|
-
|
|
97
|
+
request = Square::Internal::Multipart::Request.new(
|
|
98
|
+
base_url: request_options[:base_url],
|
|
99
|
+
method: "PUT",
|
|
71
100
|
path: "v2/catalog/images/#{params[:image_id]}",
|
|
72
|
-
body: body
|
|
101
|
+
body: body,
|
|
102
|
+
request_options: request_options
|
|
73
103
|
)
|
|
74
104
|
begin
|
|
75
|
-
|
|
105
|
+
response = @client.send(request)
|
|
76
106
|
rescue Net::HTTPRequestTimeout
|
|
77
107
|
raise Square::Errors::TimeoutError
|
|
78
108
|
end
|
|
79
|
-
code =
|
|
109
|
+
code = response.code.to_i
|
|
80
110
|
if code.between?(200, 299)
|
|
81
|
-
Square::Types::UpdateCatalogImageResponse.load(
|
|
111
|
+
Square::Types::UpdateCatalogImageResponse.load(response.body)
|
|
82
112
|
else
|
|
83
113
|
error_class = Square::Errors::ResponseError.subclass_for_code(code)
|
|
84
|
-
raise error_class.new(
|
|
114
|
+
raise error_class.new(response.body, code: code)
|
|
85
115
|
end
|
|
86
116
|
end
|
|
87
117
|
end
|