diff --git a/.fernignore b/.fernignore index 2f4007699..75d1cd07f 100644 --- a/.fernignore +++ b/.fernignore @@ -1,2 +1,4 @@ lib/square_legacy/ -lib/square_legacy.rb \ No newline at end of file +lib/square_legacy.rb +Gemfile +Rakefile \ No newline at end of file diff --git a/.gitignore b/.gitignore index d63133a3b..28be072ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Gemfile.lock pkg -*.gem \ No newline at end of file +*.gem +CLAUDE.md diff --git a/.rubocop.yml b/.rubocop.yml index f01384699..64b5b1565 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,46 +1,39 @@ -Metrics/ClassLength: - Enabled: false - -Metrics/MethodLength: - Enabled: false +plugins: + - rubocop-minitest -Metrics/BlockLength: - Enabled: false +AllCops: + TargetRubyVersion: 3.1 + NewCops: enable -Metrics/ParameterLists: - Enabled: false +Style/StringLiterals: + EnforcedStyle: double_quotes -Metrics/AbcSize: - Enabled: false +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes -Metrics/CyclomaticComplexity: +Style/AccessModifierDeclarations: Enabled: false -Metrics/PerceivedComplexity: +Lint/ConstantDefinitionInBlock: Enabled: false -Metrics/LineLength: +Metrics/AbcSize: Enabled: false -Lint/UnderscorePrefixedVariableName: +Metrics/BlockLength: Enabled: false -Naming/AccessorMethodName: +Metrics/ClassLength: Enabled: false -Naming/UncommunicativeMethodParamName: +Metrics/MethodLength: Enabled: false -Style/AsciiComments: +Metrics/ParameterLists: Enabled: false -Style/StringLiterals: +Metrics/PerceivedComplexity: Enabled: false -Style/FrozenStringLiteralComment: +Style/Documentation: Enabled: false - -AllCops: - Exclude: - - './test/**/*' - - './*' \ No newline at end of file diff --git a/Gemfile b/Gemfile index e0d55aa9a..62e0d3a70 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,19 @@ -source 'https://rubygems.org' +# frozen_string_literal: true -group :test do - gem 'rake' -end +source "https://rubygems.org" gemspec + +group :test, :development do + gem "rake", "~> 13.0" + + gem "minitest", "~> 5.16" + gem "minitest-rg" + + gem "rubocop", "~> 1.21" + gem "rubocop-minitest" + + gem "pry" + + gem "webmock" +end diff --git a/Rakefile b/Rakefile index 420fa09f5..fa395a88f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,13 +1,14 @@ -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +# frozen_string_literal: true require "bundler/gem_tasks" -require 'rake/testtask' +require "minitest/test_task" -Rake::TestTask.new(:test) do |t| - t.libs << "test" - t.test_files = FileList['test/**/test_*.rb', 'spec/**/*_spec.rb'] - t.warning = false -end +# Minitest::TestTask.create -task :default => :test +# require "rubocop/rake_task" + +# RuboCop::RakeTask.new + +# task default: %i[test] + +# task lint: %i[rubocop] diff --git a/lib/square.rb b/lib/square.rb new file mode 100644 index 000000000..0e11618fe --- /dev/null +++ b/lib/square.rb @@ -0,0 +1,1671 @@ +# frozen_string_literal: true + +require "json" +require "net/http" +require "securerandom" + +# Internal Types +require_relative 'square/internal/json/serializable' +require_relative 'square/internal/types/type' +require_relative 'square/internal/types/utils' +require_relative 'square/internal/types/union' +require_relative 'square/internal/errors/constraint_error' +require_relative 'square/internal/errors/type_error' +require_relative 'square/internal/http/base_request' +require_relative 'square/internal/json/request' +require_relative 'square/internal/http/raw_client' +require_relative 'square/internal/multipart/multipart_encoder' +require_relative 'square/internal/multipart/multipart_form_data_part' +require_relative 'square/internal/multipart/multipart_form_data' +require_relative 'square/internal/multipart/multipart_request' +require_relative 'square/internal/types/model/field' +require_relative 'square/internal/types/model' +require_relative 'square/internal/types/array' +require_relative 'square/internal/types/boolean' +require_relative 'square/internal/types/enum' +require_relative 'square/internal/types/hash' +require_relative 'square/internal/types/unknown' + +# API Types +require_relative 'square/types/ach_details' +require_relative 'square/types/card_brand' +require_relative 'square/types/currency' +require_relative 'square/types/dispute_reason' +require_relative 'square/types/dispute_state' +require_relative 'square/types/disputed_payment' +require_relative 'square/types/money' +require_relative 'square/types/dispute' +require_relative 'square/types/error_category' +require_relative 'square/types/error_code' +require_relative 'square/types/error' +require_relative 'square/types/accept_dispute_response' +require_relative 'square/types/accepted_payment_methods' +require_relative 'square/types/loyalty_event_accumulate_points' +require_relative 'square/types/loyalty_event_accumulate_promotion_points' +require_relative 'square/types/loyalty_event_adjust_points' +require_relative 'square/types/loyalty_event_create_reward' +require_relative 'square/types/loyalty_event_delete_reward' +require_relative 'square/types/loyalty_event_expire_points' +require_relative 'square/types/loyalty_event_other' +require_relative 'square/types/loyalty_event_redeem_reward' +require_relative 'square/types/loyalty_event_source' +require_relative 'square/types/loyalty_event_type' +require_relative 'square/types/loyalty_event' +require_relative 'square/types/accumulate_loyalty_points_response' +require_relative 'square/types/action_cancel_reason' +require_relative 'square/types/activity_type' +require_relative 'square/types/add_group_to_customer_response' +require_relative 'square/types/additional_recipient' +require_relative 'square/types/country' +require_relative 'square/types/address' +require_relative 'square/types/adjust_loyalty_points_response' +require_relative 'square/types/afterpay_details' +require_relative 'square/types/application_details_external_square_product' +require_relative 'square/types/application_details' +require_relative 'square/types/appointment_segment' +require_relative 'square/types/archived_state' +require_relative 'square/types/availability' +require_relative 'square/types/bank_account_status' +require_relative 'square/types/bank_account_type' +require_relative 'square/types/bank_account' +require_relative 'square/types/bank_account_created_event_object' +require_relative 'square/types/bank_account_created_event_data' +require_relative 'square/types/bank_account_created_event' +require_relative 'square/types/bank_account_disabled_event_object' +require_relative 'square/types/bank_account_disabled_event_data' +require_relative 'square/types/bank_account_disabled_event' +require_relative 'square/types/bank_account_payment_details' +require_relative 'square/types/bank_account_verified_event_object' +require_relative 'square/types/bank_account_verified_event_data' +require_relative 'square/types/bank_account_verified_event' +require_relative 'square/types/measurement_unit_area' +require_relative 'square/types/measurement_unit_custom' +require_relative 'square/types/measurement_unit_length' +require_relative 'square/types/measurement_unit_time' +require_relative 'square/types/measurement_unit_unit_type' +require_relative 'square/types/measurement_unit_volume' +require_relative 'square/types/measurement_unit_weight' +require_relative 'square/types/measurement_unit' +require_relative 'square/types/catalog_measurement_unit' +require_relative 'square/types/inventory_state' +require_relative 'square/types/inventory_adjustment_group' +require_relative 'square/types/product' +require_relative 'square/types/source_application' +require_relative 'square/types/inventory_adjustment' +require_relative 'square/types/inventory_change_type' +require_relative 'square/types/inventory_physical_count' +require_relative 'square/types/inventory_transfer' +require_relative 'square/types/inventory_change' +require_relative 'square/types/batch_change_inventory_request' +require_relative 'square/types/inventory_count' +require_relative 'square/types/batch_change_inventory_response' +require_relative 'square/types/batch_delete_catalog_objects_response' +require_relative 'square/types/day_of_week' +require_relative 'square/types/catalog_availability_period' +require_relative 'square/types/catalog_category_type' +require_relative 'square/types/catalog_custom_attribute_definition_type' +require_relative 'square/types/catalog_custom_attribute_value' +require_relative 'square/types/catalog_ecom_seo_data' +require_relative 'square/types/catalog_v_1_id' +require_relative 'square/types/category_path_to_root_node' +require_relative 'square/types/catalog_object_category' +require_relative 'square/types/catalog_category' +require_relative 'square/types/catalog_custom_attribute_definition_app_visibility' +require_relative 'square/types/catalog_custom_attribute_definition_number_config' +require_relative 'square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection' +require_relative 'square/types/catalog_custom_attribute_definition_selection_config' +require_relative 'square/types/catalog_custom_attribute_definition_seller_visibility' +require_relative 'square/types/catalog_custom_attribute_definition_string_config' +require_relative 'square/types/catalog_object_type' +require_relative 'square/types/catalog_custom_attribute_definition' +require_relative 'square/types/catalog_discount_modify_tax_basis' +require_relative 'square/types/catalog_discount_type' +require_relative 'square/types/catalog_discount' +require_relative 'square/types/catalog_image' +require_relative 'square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference' +require_relative 'square/types/catalog_item_food_and_beverage_details_dietary_preference_type' +require_relative 'square/types/catalog_item_food_and_beverage_details_dietary_preference' +require_relative 'square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient' +require_relative 'square/types/catalog_item_food_and_beverage_details_ingredient' +require_relative 'square/types/catalog_item_food_and_beverage_details' +require_relative 'square/types/catalog_modifier_override' +require_relative 'square/types/catalog_item_modifier_list_info' +require_relative 'square/types/catalog_item_option_for_item' +require_relative 'square/types/catalog_item_option_value' +require_relative 'square/types/catalog_item_option_value_for_item_variation' +require_relative 'square/types/catalog_item_product_type' +require_relative 'square/types/catalog_pricing_type' +require_relative 'square/types/catalog_stock_conversion' +require_relative 'square/types/inventory_alert_type' +require_relative 'square/types/item_variation_location_overrides' +require_relative 'square/types/catalog_item_variation' +require_relative 'square/types/modifier_location_overrides' +require_relative 'square/types/catalog_modifier' +require_relative 'square/types/catalog_modifier_list_modifier_type' +require_relative 'square/types/catalog_modifier_list_selection_type' +require_relative 'square/types/exclude_strategy' +require_relative 'square/types/catalog_pricing_rule' +require_relative 'square/types/catalog_product_set' +require_relative 'square/types/catalog_quick_amount_type' +require_relative 'square/types/catalog_quick_amount' +require_relative 'square/types/catalog_quick_amounts_settings_option' +require_relative 'square/types/catalog_quick_amounts_settings' +require_relative 'square/types/subscription_cadence' +require_relative 'square/types/subscription_pricing_type' +require_relative 'square/types/subscription_pricing' +require_relative 'square/types/subscription_phase' +require_relative 'square/types/catalog_subscription_plan_variation' +require_relative 'square/types/tax_calculation_phase' +require_relative 'square/types/tax_inclusion_type' +require_relative 'square/types/catalog_tax' +require_relative 'square/types/catalog_time_period' +require_relative 'square/types/catalog_object_image' +require_relative 'square/types/catalog_object_item_variation' +require_relative 'square/types/catalog_object_tax' +require_relative 'square/types/catalog_object_discount' +require_relative 'square/types/catalog_object_modifier' +require_relative 'square/types/catalog_object_pricing_rule' +require_relative 'square/types/catalog_object_product_set' +require_relative 'square/types/catalog_object_time_period' +require_relative 'square/types/catalog_object_measurement_unit' +require_relative 'square/types/catalog_object_subscription_plan_variation' +require_relative 'square/types/catalog_object_item_option_value' +require_relative 'square/types/catalog_object_custom_attribute_definition' +require_relative 'square/types/catalog_object_quick_amounts_settings' +require_relative 'square/types/catalog_object_availability_period' +require_relative 'square/types/catalog_object_subscription_plan' +require_relative 'square/types/catalog_object_item_option' +require_relative 'square/types/catalog_object_modifier_list' +require_relative 'square/types/catalog_object_item' +require_relative 'square/types/catalog_subscription_plan' +require_relative 'square/types/catalog_modifier_list' +require_relative 'square/types/catalog_item_option' +require_relative 'square/types/catalog_item' +require_relative 'square/types/batch_get_catalog_objects_response' +require_relative 'square/types/batch_retrieve_inventory_changes_request' +require_relative 'square/types/batch_get_inventory_changes_response' +require_relative 'square/types/batch_get_inventory_counts_request' +require_relative 'square/types/batch_get_inventory_counts_response' +require_relative 'square/types/card_co_brand' +require_relative 'square/types/card_prepaid_type' +require_relative 'square/types/card_type' +require_relative 'square/types/card' +require_relative 'square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type' +require_relative 'square/types/fulfillment_recipient' +require_relative 'square/types/fulfillment_delivery_details' +require_relative 'square/types/fulfillment_fulfillment_entry' +require_relative 'square/types/fulfillment_fulfillment_line_item_application' +require_relative 'square/types/fulfillment_pickup_details_curbside_pickup_details' +require_relative 'square/types/fulfillment_pickup_details_schedule_type' +require_relative 'square/types/fulfillment_pickup_details' +require_relative 'square/types/fulfillment_shipment_details' +require_relative 'square/types/fulfillment_state' +require_relative 'square/types/fulfillment_type' +require_relative 'square/types/fulfillment' +require_relative 'square/types/order_line_item_applied_discount' +require_relative 'square/types/order_line_item_applied_service_charge' +require_relative 'square/types/order_line_item_applied_tax' +require_relative 'square/types/order_line_item_item_type' +require_relative 'square/types/order_line_item_modifier' +require_relative 'square/types/order_line_item_pricing_blocklists_blocked_discount' +require_relative 'square/types/order_line_item_pricing_blocklists_blocked_tax' +require_relative 'square/types/order_line_item_pricing_blocklists' +require_relative 'square/types/order_quantity_unit' +require_relative 'square/types/order_line_item' +require_relative 'square/types/order_line_item_discount_scope' +require_relative 'square/types/order_line_item_discount_type' +require_relative 'square/types/order_line_item_discount' +require_relative 'square/types/order_line_item_tax_scope' +require_relative 'square/types/order_line_item_tax_type' +require_relative 'square/types/order_line_item_tax' +require_relative 'square/types/order_money_amounts' +require_relative 'square/types/order_pricing_options' +require_relative 'square/types/order_return_discount' +require_relative 'square/types/order_return_line_item_modifier' +require_relative 'square/types/order_return_line_item' +require_relative 'square/types/order_service_charge_calculation_phase' +require_relative 'square/types/order_service_charge_scope' +require_relative 'square/types/order_service_charge_treatment_type' +require_relative 'square/types/order_return_service_charge' +require_relative 'square/types/order_return_tax' +require_relative 'square/types/order_return_tip' +require_relative 'square/types/order_rounding_adjustment' +require_relative 'square/types/order_return' +require_relative 'square/types/order_reward' +require_relative 'square/types/order_service_charge_type' +require_relative 'square/types/order_service_charge' +require_relative 'square/types/order_source' +require_relative 'square/types/order_state' +require_relative 'square/types/refund_status' +require_relative 'square/types/refund' +require_relative 'square/types/tender_bank_account_details_status' +require_relative 'square/types/tender_bank_account_details' +require_relative 'square/types/tender_buy_now_pay_later_details_brand' +require_relative 'square/types/tender_buy_now_pay_later_details_status' +require_relative 'square/types/tender_buy_now_pay_later_details' +require_relative 'square/types/tender_card_details_entry_method' +require_relative 'square/types/tender_card_details_status' +require_relative 'square/types/tender_card_details' +require_relative 'square/types/tender_cash_details' +require_relative 'square/types/tender_square_account_details_status' +require_relative 'square/types/tender_square_account_details' +require_relative 'square/types/tender_type' +require_relative 'square/types/tender' +require_relative 'square/types/order' +require_relative 'square/types/batch_get_orders_response' +require_relative 'square/types/catalog_id_mapping' +require_relative 'square/types/batch_upsert_catalog_objects_response' +require_relative 'square/types/booking_booking_source' +require_relative 'square/types/booking_creator_details_creator_type' +require_relative 'square/types/booking_creator_details' +require_relative 'square/types/booking_status' +require_relative 'square/types/business_appointment_settings_booking_location_type' +require_relative 'square/types/booking' +require_relative 'square/types/booking_created_event_object' +require_relative 'square/types/booking_created_event_data' +require_relative 'square/types/booking_created_event' +require_relative 'square/types/custom_attribute_definition_visibility' +require_relative 'square/types/custom_attribute_definition' +require_relative 'square/types/custom_attribute_definition_event_data_object' +require_relative 'square/types/custom_attribute_definition_event_data' +require_relative 'square/types/booking_custom_attribute_definition_owned_created_event' +require_relative 'square/types/booking_custom_attribute_definition_owned_deleted_event' +require_relative 'square/types/booking_custom_attribute_definition_owned_updated_event' +require_relative 'square/types/booking_custom_attribute_definition_visible_created_event' +require_relative 'square/types/booking_custom_attribute_definition_visible_deleted_event' +require_relative 'square/types/booking_custom_attribute_definition_visible_updated_event' +require_relative 'square/types/booking_custom_attribute_delete_request' +require_relative 'square/types/booking_custom_attribute_delete_response' +require_relative 'square/types/custom_attribute' +require_relative 'square/types/custom_attribute_event_data_object' +require_relative 'square/types/custom_attribute_event_data' +require_relative 'square/types/booking_custom_attribute_owned_deleted_event' +require_relative 'square/types/booking_custom_attribute_owned_updated_event' +require_relative 'square/types/booking_custom_attribute_upsert_request' +require_relative 'square/types/booking_custom_attribute_upsert_response' +require_relative 'square/types/booking_custom_attribute_visible_deleted_event' +require_relative 'square/types/booking_custom_attribute_visible_updated_event' +require_relative 'square/types/booking_updated_event_object' +require_relative 'square/types/booking_updated_event_data' +require_relative 'square/types/booking_updated_event' +require_relative 'square/types/break_' +require_relative 'square/types/break_type' +require_relative 'square/types/customer_tax_ids' +require_relative 'square/types/bulk_create_customer_data' +require_relative 'square/types/customer_creation_source' +require_relative 'square/types/customer_preferences' +require_relative 'square/types/customer' +require_relative 'square/types/create_customer_response' +require_relative 'square/types/bulk_create_customers_response' +require_relative 'square/types/job_assignment_pay_type' +require_relative 'square/types/job_assignment' +require_relative 'square/types/team_member_assigned_locations_assignment_type' +require_relative 'square/types/team_member_assigned_locations' +require_relative 'square/types/team_member_status' +require_relative 'square/types/wage_setting' +require_relative 'square/types/team_member' +require_relative 'square/types/create_team_member_response' +require_relative 'square/types/batch_create_team_members_response' +require_relative 'square/types/vendor_contact' +require_relative 'square/types/vendor_status' +require_relative 'square/types/vendor' +require_relative 'square/types/create_vendor_response' +require_relative 'square/types/batch_create_vendors_response' +require_relative 'square/types/bulk_delete_booking_custom_attributes_response' +require_relative 'square/types/delete_customer_response' +require_relative 'square/types/bulk_delete_customers_response' +require_relative 'square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request' +require_relative 'square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response' +require_relative 'square/types/bulk_delete_location_custom_attributes_response' +require_relative 'square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request' +require_relative 'square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response' +require_relative 'square/types/bulk_delete_merchant_custom_attributes_response' +require_relative 'square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute' +require_relative 'square/types/delete_order_custom_attribute_response' +require_relative 'square/types/bulk_delete_order_custom_attributes_response' +require_relative 'square/types/bulk_publish_scheduled_shifts_data' +require_relative 'square/types/scheduled_shift_details' +require_relative 'square/types/scheduled_shift' +require_relative 'square/types/publish_scheduled_shift_response' +require_relative 'square/types/bulk_publish_scheduled_shifts_response' +require_relative 'square/types/get_booking_response' +require_relative 'square/types/bulk_retrieve_bookings_response' +require_relative 'square/types/get_customer_response' +require_relative 'square/types/bulk_retrieve_customers_response' +require_relative 'square/types/team_member_booking_profile' +require_relative 'square/types/get_team_member_booking_profile_response' +require_relative 'square/types/bulk_retrieve_team_member_booking_profiles_response' +require_relative 'square/types/get_vendor_response' +require_relative 'square/types/batch_get_vendors_response' +require_relative 'square/types/bulk_swap_plan_response' +require_relative 'square/types/bulk_update_customer_data' +require_relative 'square/types/update_customer_response' +require_relative 'square/types/bulk_update_customers_response' +require_relative 'square/types/update_team_member_response' +require_relative 'square/types/batch_update_team_members_response' +require_relative 'square/types/update_vendor_response' +require_relative 'square/types/batch_update_vendors_response' +require_relative 'square/types/bulk_upsert_booking_custom_attributes_response' +require_relative 'square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request' +require_relative 'square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response' +require_relative 'square/types/batch_upsert_customer_custom_attributes_response' +require_relative 'square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request' +require_relative 'square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response' +require_relative 'square/types/bulk_upsert_location_custom_attributes_response' +require_relative 'square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request' +require_relative 'square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response' +require_relative 'square/types/bulk_upsert_merchant_custom_attributes_response' +require_relative 'square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute' +require_relative 'square/types/upsert_order_custom_attribute_response' +require_relative 'square/types/bulk_upsert_order_custom_attributes_response' +require_relative 'square/types/business_appointment_settings_alignment_time' +require_relative 'square/types/business_appointment_settings_cancellation_policy' +require_relative 'square/types/business_appointment_settings_max_appointments_per_day_limit_type' +require_relative 'square/types/business_appointment_settings' +require_relative 'square/types/business_booking_profile_booking_policy' +require_relative 'square/types/business_booking_profile_customer_timezone_choice' +require_relative 'square/types/business_booking_profile' +require_relative 'square/types/business_hours_period' +require_relative 'square/types/business_hours' +require_relative 'square/types/clearpay_details' +require_relative 'square/types/buy_now_pay_later_details' +require_relative 'square/types/calculate_loyalty_points_response' +require_relative 'square/types/calculate_order_response' +require_relative 'square/types/cancel_booking_response' +require_relative 'square/types/invoice_accepted_payment_methods' +require_relative 'square/types/invoice_attachment' +require_relative 'square/types/invoice_automatic_payment_source' +require_relative 'square/types/invoice_custom_field_placement' +require_relative 'square/types/invoice_custom_field' +require_relative 'square/types/invoice_delivery_method' +require_relative 'square/types/invoice_payment_reminder_status' +require_relative 'square/types/invoice_payment_reminder' +require_relative 'square/types/invoice_request_method' +require_relative 'square/types/invoice_request_type' +require_relative 'square/types/invoice_payment_request' +require_relative 'square/types/invoice_recipient_tax_ids' +require_relative 'square/types/invoice_recipient' +require_relative 'square/types/invoice_status' +require_relative 'square/types/invoice' +require_relative 'square/types/cancel_invoice_response' +require_relative 'square/types/loyalty_promotion_available_time_data' +require_relative 'square/types/loyalty_promotion_incentive_points_addition_data' +require_relative 'square/types/loyalty_promotion_incentive_points_multiplier_data' +require_relative 'square/types/loyalty_promotion_incentive_type' +require_relative 'square/types/loyalty_promotion_incentive' +require_relative 'square/types/loyalty_promotion_status' +require_relative 'square/types/loyalty_promotion_trigger_limit_interval' +require_relative 'square/types/loyalty_promotion_trigger_limit' +require_relative 'square/types/loyalty_promotion' +require_relative 'square/types/cancel_loyalty_promotion_response' +require_relative 'square/types/cancel_payment_by_idempotency_key_response' +require_relative 'square/types/card_payment_timeline' +require_relative 'square/types/device_details' +require_relative 'square/types/card_payment_details' +require_relative 'square/types/cash_app_details' +require_relative 'square/types/cash_payment_details' +require_relative 'square/types/digital_wallet_details' +require_relative 'square/types/external_payment_details' +require_relative 'square/types/offline_payment_details' +require_relative 'square/types/processing_fee' +require_relative 'square/types/risk_evaluation_risk_level' +require_relative 'square/types/risk_evaluation' +require_relative 'square/types/square_account_details' +require_relative 'square/types/payment' +require_relative 'square/types/cancel_payment_response' +require_relative 'square/types/phase' +require_relative 'square/types/subscription_action_type' +require_relative 'square/types/subscription_action' +require_relative 'square/types/subscription_source' +require_relative 'square/types/subscription_status' +require_relative 'square/types/subscription' +require_relative 'square/types/cancel_subscription_response' +require_relative 'square/types/collected_data' +require_relative 'square/types/confirmation_decision' +require_relative 'square/types/confirmation_options' +require_relative 'square/types/data_collection_options_input_type' +require_relative 'square/types/data_collection_options' +require_relative 'square/types/device_metadata' +require_relative 'square/types/qr_code_options' +require_relative 'square/types/receipt_options' +require_relative 'square/types/save_card_options' +require_relative 'square/types/select_option' +require_relative 'square/types/select_options' +require_relative 'square/types/signature_image' +require_relative 'square/types/signature_options' +require_relative 'square/types/terminal_action_action_type' +require_relative 'square/types/terminal_action' +require_relative 'square/types/cancel_terminal_action_response' +require_relative 'square/types/checkout_options_payment_type' +require_relative 'square/types/tip_settings' +require_relative 'square/types/device_checkout_options' +require_relative 'square/types/payment_options_delay_action' +require_relative 'square/types/payment_options' +require_relative 'square/types/terminal_checkout' +require_relative 'square/types/cancel_terminal_checkout_response' +require_relative 'square/types/terminal_refund' +require_relative 'square/types/cancel_terminal_refund_response' +require_relative 'square/types/capture_transaction_response' +require_relative 'square/types/card_automatically_updated_event_object' +require_relative 'square/types/card_automatically_updated_event_data' +require_relative 'square/types/card_automatically_updated_event' +require_relative 'square/types/card_created_event_object' +require_relative 'square/types/card_created_event_data' +require_relative 'square/types/card_created_event' +require_relative 'square/types/card_disabled_event_object' +require_relative 'square/types/card_disabled_event_data' +require_relative 'square/types/card_disabled_event' +require_relative 'square/types/card_forgotten_event_card' +require_relative 'square/types/card_forgotten_event_object' +require_relative 'square/types/card_forgotten_event_data' +require_relative 'square/types/card_forgotten_event' +require_relative 'square/types/card_updated_event_object' +require_relative 'square/types/card_updated_event_data' +require_relative 'square/types/card_updated_event' +require_relative 'square/types/cash_drawer_device' +require_relative 'square/types/cash_drawer_event_type' +require_relative 'square/types/cash_drawer_shift_state' +require_relative 'square/types/cash_drawer_shift' +require_relative 'square/types/cash_drawer_shift_event' +require_relative 'square/types/cash_drawer_shift_summary' +require_relative 'square/types/catalog_info_response_limits' +require_relative 'square/types/standard_unit_description' +require_relative 'square/types/standard_unit_description_group' +require_relative 'square/types/catalog_info_response' +require_relative 'square/types/catalog_object_batch' +require_relative 'square/types/catalog_object_reference' +require_relative 'square/types/catalog_query_exact' +require_relative 'square/types/catalog_query_item_variations_for_item_option_values' +require_relative 'square/types/catalog_query_items_for_item_options' +require_relative 'square/types/catalog_query_items_for_modifier_list' +require_relative 'square/types/catalog_query_items_for_tax' +require_relative 'square/types/catalog_query_prefix' +require_relative 'square/types/catalog_query_range' +require_relative 'square/types/catalog_query_set' +require_relative 'square/types/sort_order' +require_relative 'square/types/catalog_query_sorted_attribute' +require_relative 'square/types/catalog_query_text' +require_relative 'square/types/catalog_query' +require_relative 'square/types/catalog_version_updated_event_catalog_version' +require_relative 'square/types/catalog_version_updated_event_object' +require_relative 'square/types/catalog_version_updated_event_data' +require_relative 'square/types/catalog_version_updated_event' +require_relative 'square/types/change_billing_anchor_date_response' +require_relative 'square/types/change_timing' +require_relative 'square/types/charge_request_additional_recipient' +require_relative 'square/types/checkout' +require_relative 'square/types/checkout_location_settings_branding_button_shape' +require_relative 'square/types/checkout_location_settings_branding_header_type' +require_relative 'square/types/checkout_location_settings_branding' +require_relative 'square/types/checkout_location_settings_coupons' +require_relative 'square/types/checkout_location_settings_policy' +require_relative 'square/types/checkout_location_settings_tipping' +require_relative 'square/types/checkout_location_settings' +require_relative 'square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range' +require_relative 'square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay' +require_relative 'square/types/checkout_merchant_settings_payment_methods_payment_method' +require_relative 'square/types/checkout_merchant_settings_payment_methods' +require_relative 'square/types/checkout_merchant_settings' +require_relative 'square/types/custom_field' +require_relative 'square/types/shipping_fee' +require_relative 'square/types/checkout_options' +require_relative 'square/types/clone_order_response' +require_relative 'square/types/complete_payment_response' +require_relative 'square/types/component_component_type' +require_relative 'square/types/device_component_details_application_details' +require_relative 'square/types/device_component_details_external_power' +require_relative 'square/types/device_component_details_battery_details' +require_relative 'square/types/device_component_details_card_reader_details' +require_relative 'square/types/device_component_details_ethernet_details' +require_relative 'square/types/device_component_details_measurement' +require_relative 'square/types/device_component_details_wi_fi_details' +require_relative 'square/types/component' +require_relative 'square/types/coordinates' +require_relative 'square/types/create_booking_custom_attribute_definition_response' +require_relative 'square/types/create_booking_response' +require_relative 'square/types/create_break_type_response' +require_relative 'square/types/create_card_response' +require_relative 'square/types/create_catalog_image_request' +require_relative 'square/types/create_catalog_image_response' +require_relative 'square/types/create_checkout_response' +require_relative 'square/types/create_customer_card_response' +require_relative 'square/types/create_customer_custom_attribute_definition_response' +require_relative 'square/types/customer_group' +require_relative 'square/types/create_customer_group_response' +require_relative 'square/types/device_code_status' +require_relative 'square/types/device_code' +require_relative 'square/types/create_device_code_response' +require_relative 'square/types/dispute_evidence_type' +require_relative 'square/types/create_dispute_evidence_file_request' +require_relative 'square/types/dispute_evidence_file' +require_relative 'square/types/dispute_evidence' +require_relative 'square/types/create_dispute_evidence_file_response' +require_relative 'square/types/create_dispute_evidence_text_response' +require_relative 'square/types/gift_card_activity_activate' +require_relative 'square/types/gift_card_activity_adjust_decrement_reason' +require_relative 'square/types/gift_card_activity_adjust_decrement' +require_relative 'square/types/gift_card_activity_adjust_increment_reason' +require_relative 'square/types/gift_card_activity_adjust_increment' +require_relative 'square/types/gift_card_activity_block' +require_relative 'square/types/gift_card_activity_clear_balance_reason' +require_relative 'square/types/gift_card_activity_clear_balance' +require_relative 'square/types/gift_card_activity_deactivate_reason' +require_relative 'square/types/gift_card_activity_deactivate' +require_relative 'square/types/gift_card_activity_import' +require_relative 'square/types/gift_card_activity_import_reversal' +require_relative 'square/types/gift_card_activity_load' +require_relative 'square/types/gift_card_activity_redeem_status' +require_relative 'square/types/gift_card_activity_redeem' +require_relative 'square/types/gift_card_activity_refund' +require_relative 'square/types/gift_card_activity_transfer_balance_from' +require_relative 'square/types/gift_card_activity_transfer_balance_to' +require_relative 'square/types/gift_card_activity_type' +require_relative 'square/types/gift_card_activity_unblock' +require_relative 'square/types/gift_card_activity_unlinked_activity_refund' +require_relative 'square/types/gift_card_activity' +require_relative 'square/types/create_gift_card_activity_response' +require_relative 'square/types/gift_card_gan_source' +require_relative 'square/types/gift_card_status' +require_relative 'square/types/gift_card_type' +require_relative 'square/types/gift_card' +require_relative 'square/types/create_gift_card_response' +require_relative 'square/types/create_invoice_attachment_request_data' +require_relative 'square/types/create_invoice_attachment_response' +require_relative 'square/types/create_invoice_response' +require_relative 'square/types/job' +require_relative 'square/types/create_job_response' +require_relative 'square/types/create_location_custom_attribute_definition_response' +require_relative 'square/types/location_capability' +require_relative 'square/types/location_status' +require_relative 'square/types/location_type' +require_relative 'square/types/tax_ids' +require_relative 'square/types/location' +require_relative 'square/types/create_location_response' +require_relative 'square/types/loyalty_account_expiring_point_deadline' +require_relative 'square/types/loyalty_account_mapping' +require_relative 'square/types/loyalty_account' +require_relative 'square/types/create_loyalty_account_response' +require_relative 'square/types/create_loyalty_promotion_response' +require_relative 'square/types/loyalty_reward_status' +require_relative 'square/types/loyalty_reward' +require_relative 'square/types/create_loyalty_reward_response' +require_relative 'square/types/create_merchant_custom_attribute_definition_response' +require_relative 'square/types/create_mobile_authorization_code_response' +require_relative 'square/types/create_order_custom_attribute_definition_response' +require_relative 'square/types/create_order_request' +require_relative 'square/types/create_order_response' +require_relative 'square/types/pre_populated_data' +require_relative 'square/types/payment_link' +require_relative 'square/types/payment_link_related_resources' +require_relative 'square/types/create_payment_link_response' +require_relative 'square/types/create_payment_response' +require_relative 'square/types/create_scheduled_shift_response' +require_relative 'square/types/shift_status' +require_relative 'square/types/shift_wage' +require_relative 'square/types/shift' +require_relative 'square/types/create_shift_response' +require_relative 'square/types/create_subscription_response' +require_relative 'square/types/create_team_member_request' +require_relative 'square/types/create_terminal_action_response' +require_relative 'square/types/create_terminal_checkout_response' +require_relative 'square/types/create_terminal_refund_response' +require_relative 'square/types/timecard_status' +require_relative 'square/types/timecard_wage' +require_relative 'square/types/timecard' +require_relative 'square/types/create_timecard_response' +require_relative 'square/types/webhook_subscription' +require_relative 'square/types/create_webhook_subscription_response' +require_relative 'square/types/range' +require_relative 'square/types/custom_attribute_filter' +require_relative 'square/types/customer_text_filter' +require_relative 'square/types/customer_address_filter' +require_relative 'square/types/customer_created_event_event_context_merge' +require_relative 'square/types/customer_created_event_event_context' +require_relative 'square/types/customer_created_event_object' +require_relative 'square/types/customer_created_event_data' +require_relative 'square/types/customer_created_event' +require_relative 'square/types/customer_inclusion_exclusion' +require_relative 'square/types/customer_creation_source_filter' +require_relative 'square/types/customer_custom_attribute_definition_created_event' +require_relative 'square/types/customer_custom_attribute_definition_created_public_event' +require_relative 'square/types/customer_custom_attribute_definition_deleted_event' +require_relative 'square/types/customer_custom_attribute_definition_deleted_public_event' +require_relative 'square/types/customer_custom_attribute_definition_owned_created_event' +require_relative 'square/types/customer_custom_attribute_definition_owned_deleted_event' +require_relative 'square/types/customer_custom_attribute_definition_owned_updated_event' +require_relative 'square/types/customer_custom_attribute_definition_updated_event' +require_relative 'square/types/customer_custom_attribute_definition_updated_public_event' +require_relative 'square/types/customer_custom_attribute_definition_visible_created_event' +require_relative 'square/types/customer_custom_attribute_definition_visible_deleted_event' +require_relative 'square/types/customer_custom_attribute_definition_visible_updated_event' +require_relative 'square/types/customer_custom_attribute_deleted_event' +require_relative 'square/types/customer_custom_attribute_deleted_public_event' +require_relative 'square/types/filter_value' +require_relative 'square/types/float_number_range' +require_relative 'square/types/time_range' +require_relative 'square/types/customer_custom_attribute_filter_value' +require_relative 'square/types/customer_custom_attribute_filter' +require_relative 'square/types/customer_custom_attribute_filters' +require_relative 'square/types/customer_custom_attribute_owned_deleted_event' +require_relative 'square/types/customer_custom_attribute_owned_updated_event' +require_relative 'square/types/customer_custom_attribute_updated_event' +require_relative 'square/types/customer_custom_attribute_updated_public_event' +require_relative 'square/types/customer_custom_attribute_visible_deleted_event' +require_relative 'square/types/customer_custom_attribute_visible_updated_event' +require_relative 'square/types/customer_deleted_event_event_context_merge' +require_relative 'square/types/customer_deleted_event_event_context' +require_relative 'square/types/customer_deleted_event_object' +require_relative 'square/types/customer_deleted_event_data' +require_relative 'square/types/customer_deleted_event' +require_relative 'square/types/customer_details' +require_relative 'square/types/customer_filter' +require_relative 'square/types/customer_sort_field' +require_relative 'square/types/customer_sort' +require_relative 'square/types/customer_query' +require_relative 'square/types/customer_segment' +require_relative 'square/types/customer_updated_event_object' +require_relative 'square/types/customer_updated_event_data' +require_relative 'square/types/customer_updated_event' +require_relative 'square/types/date_range' +require_relative 'square/types/delete_booking_custom_attribute_definition_response' +require_relative 'square/types/delete_booking_custom_attribute_response' +require_relative 'square/types/delete_break_type_response' +require_relative 'square/types/delete_catalog_object_response' +require_relative 'square/types/delete_customer_card_response' +require_relative 'square/types/delete_customer_custom_attribute_definition_response' +require_relative 'square/types/delete_customer_custom_attribute_response' +require_relative 'square/types/delete_customer_group_response' +require_relative 'square/types/delete_dispute_evidence_response' +require_relative 'square/types/delete_invoice_attachment_response' +require_relative 'square/types/delete_invoice_response' +require_relative 'square/types/delete_location_custom_attribute_definition_response' +require_relative 'square/types/delete_location_custom_attribute_response' +require_relative 'square/types/delete_loyalty_reward_response' +require_relative 'square/types/delete_merchant_custom_attribute_definition_response' +require_relative 'square/types/delete_merchant_custom_attribute_response' +require_relative 'square/types/delete_order_custom_attribute_definition_response' +require_relative 'square/types/delete_payment_link_response' +require_relative 'square/types/delete_shift_response' +require_relative 'square/types/delete_snippet_response' +require_relative 'square/types/delete_subscription_action_response' +require_relative 'square/types/delete_timecard_response' +require_relative 'square/types/delete_webhook_subscription_response' +require_relative 'square/types/destination_type' +require_relative 'square/types/destination' +require_relative 'square/types/destination_details_card_refund_details' +require_relative 'square/types/destination_details_cash_refund_details' +require_relative 'square/types/destination_details_external_refund_details' +require_relative 'square/types/destination_details' +require_relative 'square/types/device_attributes' +require_relative 'square/types/device_status_category' +require_relative 'square/types/device_status' +require_relative 'square/types/device' +require_relative 'square/types/device_code_paired_event_object' +require_relative 'square/types/device_code_paired_event_data' +require_relative 'square/types/device_code_paired_event' +require_relative 'square/types/device_created_event_object' +require_relative 'square/types/device_created_event_data' +require_relative 'square/types/device_created_event' +require_relative 'square/types/disable_card_response' +require_relative 'square/types/disable_events_response' +require_relative 'square/types/dismiss_terminal_action_response' +require_relative 'square/types/dismiss_terminal_checkout_response' +require_relative 'square/types/dismiss_terminal_refund_response' +require_relative 'square/types/dispute_created_event_object' +require_relative 'square/types/dispute_created_event_data' +require_relative 'square/types/dispute_created_event' +require_relative 'square/types/dispute_evidence_added_event_object' +require_relative 'square/types/dispute_evidence_added_event_data' +require_relative 'square/types/dispute_evidence_added_event' +require_relative 'square/types/dispute_evidence_created_event_object' +require_relative 'square/types/dispute_evidence_created_event_data' +require_relative 'square/types/dispute_evidence_created_event' +require_relative 'square/types/dispute_evidence_deleted_event_object' +require_relative 'square/types/dispute_evidence_deleted_event_data' +require_relative 'square/types/dispute_evidence_deleted_event' +require_relative 'square/types/dispute_evidence_removed_event_object' +require_relative 'square/types/dispute_evidence_removed_event_data' +require_relative 'square/types/dispute_evidence_removed_event' +require_relative 'square/types/dispute_state_changed_event_object' +require_relative 'square/types/dispute_state_changed_event_data' +require_relative 'square/types/dispute_state_changed_event' +require_relative 'square/types/dispute_state_updated_event_object' +require_relative 'square/types/dispute_state_updated_event_data' +require_relative 'square/types/dispute_state_updated_event' +require_relative 'square/types/ecom_visibility' +require_relative 'square/types/employee_status' +require_relative 'square/types/employee' +require_relative 'square/types/employee_wage' +require_relative 'square/types/enable_events_response' +require_relative 'square/types/event_data' +require_relative 'square/types/event' +require_relative 'square/types/event_metadata' +require_relative 'square/types/event_type_metadata' +require_relative 'square/types/get_bank_account_by_v_1_id_response' +require_relative 'square/types/get_bank_account_response' +require_relative 'square/types/get_break_type_response' +require_relative 'square/types/get_device_code_response' +require_relative 'square/types/get_device_response' +require_relative 'square/types/get_employee_wage_response' +require_relative 'square/types/get_invoice_response' +require_relative 'square/types/payment_refund' +require_relative 'square/types/get_payment_refund_response' +require_relative 'square/types/get_payment_response' +require_relative 'square/types/payout_fee_type' +require_relative 'square/types/payout_fee' +require_relative 'square/types/payout_status' +require_relative 'square/types/payout_type' +require_relative 'square/types/payout' +require_relative 'square/types/get_payout_response' +require_relative 'square/types/get_shift_response' +require_relative 'square/types/team_member_wage' +require_relative 'square/types/get_team_member_wage_response' +require_relative 'square/types/get_terminal_action_response' +require_relative 'square/types/get_terminal_checkout_response' +require_relative 'square/types/get_terminal_refund_response' +require_relative 'square/types/gift_card_activity_created_event_object' +require_relative 'square/types/gift_card_activity_created_event_data' +require_relative 'square/types/gift_card_activity_created_event' +require_relative 'square/types/gift_card_activity_updated_event_object' +require_relative 'square/types/gift_card_activity_updated_event_data' +require_relative 'square/types/gift_card_activity_updated_event' +require_relative 'square/types/gift_card_created_event_object' +require_relative 'square/types/gift_card_created_event_data' +require_relative 'square/types/gift_card_created_event' +require_relative 'square/types/gift_card_customer_linked_event_object' +require_relative 'square/types/gift_card_customer_linked_event_data' +require_relative 'square/types/gift_card_customer_linked_event' +require_relative 'square/types/gift_card_customer_unlinked_event_object' +require_relative 'square/types/gift_card_customer_unlinked_event_data' +require_relative 'square/types/gift_card_customer_unlinked_event' +require_relative 'square/types/gift_card_updated_event_object' +require_relative 'square/types/gift_card_updated_event_data' +require_relative 'square/types/gift_card_updated_event' +require_relative 'square/types/inventory_count_updated_event_object' +require_relative 'square/types/inventory_count_updated_event_data' +require_relative 'square/types/inventory_count_updated_event' +require_relative 'square/types/invoice_canceled_event_object' +require_relative 'square/types/invoice_canceled_event_data' +require_relative 'square/types/invoice_canceled_event' +require_relative 'square/types/invoice_created_event_object' +require_relative 'square/types/invoice_created_event_data' +require_relative 'square/types/invoice_created_event' +require_relative 'square/types/invoice_deleted_event_data' +require_relative 'square/types/invoice_deleted_event' +require_relative 'square/types/invoice_filter' +require_relative 'square/types/invoice_payment_made_event_object' +require_relative 'square/types/invoice_payment_made_event_data' +require_relative 'square/types/invoice_payment_made_event' +require_relative 'square/types/invoice_published_event_object' +require_relative 'square/types/invoice_published_event_data' +require_relative 'square/types/invoice_published_event' +require_relative 'square/types/invoice_sort' +require_relative 'square/types/invoice_query' +require_relative 'square/types/invoice_refunded_event_object' +require_relative 'square/types/invoice_refunded_event_data' +require_relative 'square/types/invoice_refunded_event' +require_relative 'square/types/invoice_scheduled_charge_failed_event_object' +require_relative 'square/types/invoice_scheduled_charge_failed_event_data' +require_relative 'square/types/invoice_scheduled_charge_failed_event' +require_relative 'square/types/invoice_updated_event_object' +require_relative 'square/types/invoice_updated_event_data' +require_relative 'square/types/invoice_updated_event' +require_relative 'square/types/job_created_event_object' +require_relative 'square/types/job_created_event_data' +require_relative 'square/types/job_created_event' +require_relative 'square/types/job_updated_event_object' +require_relative 'square/types/job_updated_event_data' +require_relative 'square/types/job_updated_event' +require_relative 'square/types/labor_scheduled_shift_created_event_object' +require_relative 'square/types/labor_scheduled_shift_created_event_data' +require_relative 'square/types/labor_scheduled_shift_created_event' +require_relative 'square/types/labor_scheduled_shift_deleted_event_data' +require_relative 'square/types/labor_scheduled_shift_deleted_event' +require_relative 'square/types/labor_scheduled_shift_published_event_object' +require_relative 'square/types/labor_scheduled_shift_published_event_data' +require_relative 'square/types/labor_scheduled_shift_published_event' +require_relative 'square/types/labor_scheduled_shift_updated_event_object' +require_relative 'square/types/labor_scheduled_shift_updated_event_data' +require_relative 'square/types/labor_scheduled_shift_updated_event' +require_relative 'square/types/labor_shift_created_event_object' +require_relative 'square/types/labor_shift_created_event_data' +require_relative 'square/types/labor_shift_created_event' +require_relative 'square/types/labor_shift_deleted_event_data' +require_relative 'square/types/labor_shift_deleted_event' +require_relative 'square/types/labor_shift_updated_event_object' +require_relative 'square/types/labor_shift_updated_event_data' +require_relative 'square/types/labor_shift_updated_event' +require_relative 'square/types/labor_timecard_created_event_object' +require_relative 'square/types/labor_timecard_created_event_data' +require_relative 'square/types/labor_timecard_created_event' +require_relative 'square/types/labor_timecard_deleted_event_data' +require_relative 'square/types/labor_timecard_deleted_event' +require_relative 'square/types/labor_timecard_updated_event_object' +require_relative 'square/types/labor_timecard_updated_event_data' +require_relative 'square/types/labor_timecard_updated_event' +require_relative 'square/types/link_customer_to_gift_card_response' +require_relative 'square/types/list_bank_accounts_response' +require_relative 'square/types/list_booking_custom_attribute_definitions_response' +require_relative 'square/types/list_booking_custom_attributes_response' +require_relative 'square/types/list_bookings_response' +require_relative 'square/types/list_break_types_response' +require_relative 'square/types/list_cards_response' +require_relative 'square/types/list_cash_drawer_shift_events_response' +require_relative 'square/types/list_cash_drawer_shifts_response' +require_relative 'square/types/list_catalog_response' +require_relative 'square/types/list_customer_custom_attribute_definitions_response' +require_relative 'square/types/list_customer_custom_attributes_response' +require_relative 'square/types/list_customer_groups_response' +require_relative 'square/types/list_customer_segments_response' +require_relative 'square/types/list_customers_response' +require_relative 'square/types/list_device_codes_response' +require_relative 'square/types/list_devices_response' +require_relative 'square/types/list_dispute_evidence_response' +require_relative 'square/types/list_disputes_response' +require_relative 'square/types/list_employee_wages_response' +require_relative 'square/types/list_employees_response' +require_relative 'square/types/list_event_types_response' +require_relative 'square/types/list_gift_card_activities_response' +require_relative 'square/types/list_gift_cards_response' +require_relative 'square/types/list_invoices_response' +require_relative 'square/types/list_jobs_response' +require_relative 'square/types/location_booking_profile' +require_relative 'square/types/list_location_booking_profiles_response' +require_relative 'square/types/list_location_custom_attribute_definitions_response' +require_relative 'square/types/list_location_custom_attributes_response' +require_relative 'square/types/list_locations_response' +require_relative 'square/types/loyalty_program_accrual_rule_category_data' +require_relative 'square/types/loyalty_program_accrual_rule_item_variation_data' +require_relative 'square/types/loyalty_program_accrual_rule_tax_mode' +require_relative 'square/types/loyalty_program_accrual_rule_spend_data' +require_relative 'square/types/loyalty_program_accrual_rule_type' +require_relative 'square/types/loyalty_program_accrual_rule_visit_data' +require_relative 'square/types/loyalty_program_accrual_rule' +require_relative 'square/types/loyalty_program_expiration_policy' +require_relative 'square/types/loyalty_program_reward_tier' +require_relative 'square/types/loyalty_program_status' +require_relative 'square/types/loyalty_program_terminology' +require_relative 'square/types/loyalty_program' +require_relative 'square/types/list_loyalty_programs_response' +require_relative 'square/types/list_loyalty_promotions_response' +require_relative 'square/types/list_merchant_custom_attribute_definitions_response' +require_relative 'square/types/list_merchant_custom_attributes_response' +require_relative 'square/types/merchant_status' +require_relative 'square/types/merchant' +require_relative 'square/types/list_merchants_response' +require_relative 'square/types/list_order_custom_attribute_definitions_response' +require_relative 'square/types/list_order_custom_attributes_response' +require_relative 'square/types/list_payment_links_response' +require_relative 'square/types/list_payment_refunds_request_sort_field' +require_relative 'square/types/list_payment_refunds_response' +require_relative 'square/types/list_payments_request_sort_field' +require_relative 'square/types/list_payments_response' +require_relative 'square/types/payment_balance_activity_app_fee_refund_detail' +require_relative 'square/types/payment_balance_activity_app_fee_revenue_detail' +require_relative 'square/types/payment_balance_activity_automatic_savings_detail' +require_relative 'square/types/payment_balance_activity_automatic_savings_reversed_detail' +require_relative 'square/types/payment_balance_activity_charge_detail' +require_relative 'square/types/payment_balance_activity_deposit_fee_detail' +require_relative 'square/types/payment_balance_activity_deposit_fee_reversed_detail' +require_relative 'square/types/payment_balance_activity_dispute_detail' +require_relative 'square/types/payment_balance_activity_fee_detail' +require_relative 'square/types/payment_balance_activity_free_processing_detail' +require_relative 'square/types/payment_balance_activity_hold_adjustment_detail' +require_relative 'square/types/payment_balance_activity_open_dispute_detail' +require_relative 'square/types/payment_balance_activity_other_adjustment_detail' +require_relative 'square/types/payment_balance_activity_other_detail' +require_relative 'square/types/payment_balance_activity_refund_detail' +require_relative 'square/types/payment_balance_activity_release_adjustment_detail' +require_relative 'square/types/payment_balance_activity_reserve_hold_detail' +require_relative 'square/types/payment_balance_activity_reserve_release_detail' +require_relative 'square/types/payment_balance_activity_square_capital_payment_detail' +require_relative 'square/types/payment_balance_activity_square_capital_reversed_payment_detail' +require_relative 'square/types/payment_balance_activity_square_payroll_transfer_detail' +require_relative 'square/types/payment_balance_activity_square_payroll_transfer_reversed_detail' +require_relative 'square/types/payment_balance_activity_tax_on_fee_detail' +require_relative 'square/types/payment_balance_activity_third_party_fee_detail' +require_relative 'square/types/payment_balance_activity_third_party_fee_refund_detail' +require_relative 'square/types/payout_entry' +require_relative 'square/types/list_payout_entries_response' +require_relative 'square/types/list_payouts_response' +require_relative 'square/types/site' +require_relative 'square/types/list_sites_response' +require_relative 'square/types/subscription_event_info_code' +require_relative 'square/types/subscription_event_info' +require_relative 'square/types/subscription_event_subscription_event_type' +require_relative 'square/types/subscription_event' +require_relative 'square/types/list_subscription_events_response' +require_relative 'square/types/list_team_member_booking_profiles_response' +require_relative 'square/types/list_team_member_wages_response' +require_relative 'square/types/transaction_product' +require_relative 'square/types/transaction' +require_relative 'square/types/list_transactions_response' +require_relative 'square/types/list_webhook_event_types_response' +require_relative 'square/types/list_webhook_subscriptions_response' +require_relative 'square/types/weekday' +require_relative 'square/types/workweek_config' +require_relative 'square/types/list_workweek_configs_response' +require_relative 'square/types/location_created_event_data' +require_relative 'square/types/location_created_event' +require_relative 'square/types/location_custom_attribute_definition_owned_created_event' +require_relative 'square/types/location_custom_attribute_definition_owned_deleted_event' +require_relative 'square/types/location_custom_attribute_definition_owned_updated_event' +require_relative 'square/types/location_custom_attribute_definition_visible_created_event' +require_relative 'square/types/location_custom_attribute_definition_visible_deleted_event' +require_relative 'square/types/location_custom_attribute_definition_visible_updated_event' +require_relative 'square/types/location_custom_attribute_owned_deleted_event' +require_relative 'square/types/location_custom_attribute_owned_updated_event' +require_relative 'square/types/location_custom_attribute_visible_deleted_event' +require_relative 'square/types/location_custom_attribute_visible_updated_event' +require_relative 'square/types/location_settings_updated_event_object' +require_relative 'square/types/location_settings_updated_event_data' +require_relative 'square/types/location_settings_updated_event' +require_relative 'square/types/location_updated_event_data' +require_relative 'square/types/location_updated_event' +require_relative 'square/types/loyalty_account_created_event_object' +require_relative 'square/types/loyalty_account_created_event_data' +require_relative 'square/types/loyalty_account_created_event' +require_relative 'square/types/loyalty_account_deleted_event_object' +require_relative 'square/types/loyalty_account_deleted_event_data' +require_relative 'square/types/loyalty_account_deleted_event' +require_relative 'square/types/loyalty_account_updated_event_object' +require_relative 'square/types/loyalty_account_updated_event_data' +require_relative 'square/types/loyalty_account_updated_event' +require_relative 'square/types/loyalty_event_created_event_object' +require_relative 'square/types/loyalty_event_created_event_data' +require_relative 'square/types/loyalty_event_created_event' +require_relative 'square/types/loyalty_event_date_time_filter' +require_relative 'square/types/loyalty_event_location_filter' +require_relative 'square/types/loyalty_event_loyalty_account_filter' +require_relative 'square/types/loyalty_event_order_filter' +require_relative 'square/types/loyalty_event_type_filter' +require_relative 'square/types/loyalty_event_filter' +require_relative 'square/types/loyalty_event_query' +require_relative 'square/types/loyalty_program_created_event_object' +require_relative 'square/types/loyalty_program_created_event_data' +require_relative 'square/types/loyalty_program_created_event' +require_relative 'square/types/loyalty_program_updated_event_object' +require_relative 'square/types/loyalty_program_updated_event_data' +require_relative 'square/types/loyalty_program_updated_event' +require_relative 'square/types/loyalty_promotion_created_event_object' +require_relative 'square/types/loyalty_promotion_created_event_data' +require_relative 'square/types/loyalty_promotion_created_event' +require_relative 'square/types/loyalty_promotion_updated_event_object' +require_relative 'square/types/loyalty_promotion_updated_event_data' +require_relative 'square/types/loyalty_promotion_updated_event' +require_relative 'square/types/merchant_custom_attribute_definition_owned_created_event' +require_relative 'square/types/merchant_custom_attribute_definition_owned_deleted_event' +require_relative 'square/types/merchant_custom_attribute_definition_owned_updated_event' +require_relative 'square/types/merchant_custom_attribute_definition_visible_created_event' +require_relative 'square/types/merchant_custom_attribute_definition_visible_deleted_event' +require_relative 'square/types/merchant_custom_attribute_definition_visible_updated_event' +require_relative 'square/types/merchant_custom_attribute_owned_deleted_event' +require_relative 'square/types/merchant_custom_attribute_owned_updated_event' +require_relative 'square/types/merchant_custom_attribute_visible_deleted_event' +require_relative 'square/types/merchant_custom_attribute_visible_updated_event' +require_relative 'square/types/merchant_settings_updated_event_object' +require_relative 'square/types/merchant_settings_updated_event_data' +require_relative 'square/types/merchant_settings_updated_event' +require_relative 'square/types/oauth_authorization_revoked_event_revoker_type' +require_relative 'square/types/oauth_authorization_revoked_event_revocation_object' +require_relative 'square/types/oauth_authorization_revoked_event_object' +require_relative 'square/types/oauth_authorization_revoked_event_data' +require_relative 'square/types/oauth_authorization_revoked_event' +require_relative 'square/types/obtain_token_response' +require_relative 'square/types/order_created' +require_relative 'square/types/order_created_object' +require_relative 'square/types/order_created_event_data' +require_relative 'square/types/order_created_event' +require_relative 'square/types/order_custom_attribute_definition_owned_created_event' +require_relative 'square/types/order_custom_attribute_definition_owned_deleted_event' +require_relative 'square/types/order_custom_attribute_definition_owned_updated_event' +require_relative 'square/types/order_custom_attribute_definition_visible_created_event' +require_relative 'square/types/order_custom_attribute_definition_visible_deleted_event' +require_relative 'square/types/order_custom_attribute_definition_visible_updated_event' +require_relative 'square/types/order_custom_attribute_owned_deleted_event' +require_relative 'square/types/order_custom_attribute_owned_updated_event' +require_relative 'square/types/order_custom_attribute_visible_deleted_event' +require_relative 'square/types/order_custom_attribute_visible_updated_event' +require_relative 'square/types/order_entry' +require_relative 'square/types/order_fulfillment_delivery_details_schedule_type' +require_relative 'square/types/order_fulfillment_fulfillment_line_item_application' +require_relative 'square/types/order_fulfillment_pickup_details_schedule_type' +require_relative 'square/types/order_fulfillment_state' +require_relative 'square/types/order_fulfillment_type' +require_relative 'square/types/order_fulfillment_updated_update' +require_relative 'square/types/order_fulfillment_updated' +require_relative 'square/types/order_fulfillment_updated_object' +require_relative 'square/types/order_fulfillment_updated_event_data' +require_relative 'square/types/order_fulfillment_updated_event' +require_relative 'square/types/order_updated' +require_relative 'square/types/order_updated_object' +require_relative 'square/types/order_updated_event_data' +require_relative 'square/types/order_updated_event' +require_relative 'square/types/pause_subscription_response' +require_relative 'square/types/pay_order_response' +require_relative 'square/types/payment_created_event_object' +require_relative 'square/types/payment_created_event_data' +require_relative 'square/types/payment_created_event' +require_relative 'square/types/payment_updated_event_object' +require_relative 'square/types/payment_updated_event_data' +require_relative 'square/types/payment_updated_event' +require_relative 'square/types/payout_failed_event_object' +require_relative 'square/types/payout_failed_event_data' +require_relative 'square/types/payout_failed_event' +require_relative 'square/types/payout_paid_event_object' +require_relative 'square/types/payout_paid_event_data' +require_relative 'square/types/payout_paid_event' +require_relative 'square/types/payout_sent_event_object' +require_relative 'square/types/payout_sent_event_data' +require_relative 'square/types/payout_sent_event' +require_relative 'square/types/phase_input' +require_relative 'square/types/publish_invoice_response' +require_relative 'square/types/quick_pay' +require_relative 'square/types/redeem_loyalty_reward_response' +require_relative 'square/types/refund_created_event_object' +require_relative 'square/types/refund_created_event_data' +require_relative 'square/types/refund_created_event' +require_relative 'square/types/refund_payment_response' +require_relative 'square/types/refund_updated_event_object' +require_relative 'square/types/refund_updated_event_data' +require_relative 'square/types/refund_updated_event' +require_relative 'square/types/register_domain_response_status' +require_relative 'square/types/register_domain_response' +require_relative 'square/types/remove_group_from_customer_response' +require_relative 'square/types/resume_subscription_response' +require_relative 'square/types/retrieve_booking_custom_attribute_definition_response' +require_relative 'square/types/retrieve_booking_custom_attribute_response' +require_relative 'square/types/get_business_booking_profile_response' +require_relative 'square/types/get_card_response' +require_relative 'square/types/get_cash_drawer_shift_response' +require_relative 'square/types/get_catalog_object_response' +require_relative 'square/types/get_customer_custom_attribute_definition_response' +require_relative 'square/types/get_customer_custom_attribute_response' +require_relative 'square/types/get_customer_group_response' +require_relative 'square/types/get_customer_segment_response' +require_relative 'square/types/get_dispute_evidence_response' +require_relative 'square/types/get_dispute_response' +require_relative 'square/types/get_employee_response' +require_relative 'square/types/get_gift_card_from_gan_response' +require_relative 'square/types/get_gift_card_from_nonce_response' +require_relative 'square/types/get_gift_card_response' +require_relative 'square/types/get_inventory_adjustment_response' +require_relative 'square/types/get_inventory_changes_response' +require_relative 'square/types/get_inventory_count_response' +require_relative 'square/types/get_inventory_physical_count_response' +require_relative 'square/types/get_inventory_transfer_response' +require_relative 'square/types/retrieve_job_response' +require_relative 'square/types/retrieve_location_booking_profile_response' +require_relative 'square/types/retrieve_location_custom_attribute_definition_response' +require_relative 'square/types/retrieve_location_custom_attribute_response' +require_relative 'square/types/get_location_response' +require_relative 'square/types/retrieve_location_settings_response' +require_relative 'square/types/get_loyalty_account_response' +require_relative 'square/types/get_loyalty_program_response' +require_relative 'square/types/get_loyalty_promotion_response' +require_relative 'square/types/get_loyalty_reward_response' +require_relative 'square/types/retrieve_merchant_custom_attribute_definition_response' +require_relative 'square/types/retrieve_merchant_custom_attribute_response' +require_relative 'square/types/get_merchant_response' +require_relative 'square/types/retrieve_merchant_settings_response' +require_relative 'square/types/retrieve_order_custom_attribute_definition_response' +require_relative 'square/types/retrieve_order_custom_attribute_response' +require_relative 'square/types/get_order_response' +require_relative 'square/types/get_payment_link_response' +require_relative 'square/types/retrieve_scheduled_shift_response' +require_relative 'square/types/snippet' +require_relative 'square/types/get_snippet_response' +require_relative 'square/types/get_subscription_response' +require_relative 'square/types/get_team_member_response' +require_relative 'square/types/retrieve_timecard_response' +require_relative 'square/types/retrieve_token_status_response' +require_relative 'square/types/get_transaction_response' +require_relative 'square/types/get_wage_setting_response' +require_relative 'square/types/get_webhook_subscription_response' +require_relative 'square/types/revoke_token_response' +require_relative 'square/types/scheduled_shift_filter_assignment_status' +require_relative 'square/types/scheduled_shift_filter_scheduled_shift_status' +require_relative 'square/types/scheduled_shift_workday_matcher' +require_relative 'square/types/scheduled_shift_workday' +require_relative 'square/types/scheduled_shift_filter' +require_relative 'square/types/scheduled_shift_notification_audience' +require_relative 'square/types/scheduled_shift_sort_field' +require_relative 'square/types/scheduled_shift_sort' +require_relative 'square/types/scheduled_shift_query' +require_relative 'square/types/segment_filter' +require_relative 'square/types/search_availability_filter' +require_relative 'square/types/search_availability_query' +require_relative 'square/types/search_availability_response' +require_relative 'square/types/search_catalog_items_request_stock_level' +require_relative 'square/types/search_catalog_items_response' +require_relative 'square/types/search_catalog_objects_response' +require_relative 'square/types/search_customers_response' +require_relative 'square/types/search_events_filter' +require_relative 'square/types/search_events_sort' +require_relative 'square/types/search_events_query' +require_relative 'square/types/search_events_response' +require_relative 'square/types/search_invoices_response' +require_relative 'square/types/search_loyalty_accounts_request_loyalty_account_query' +require_relative 'square/types/search_loyalty_accounts_response' +require_relative 'square/types/search_loyalty_events_response' +require_relative 'square/types/search_loyalty_rewards_request_loyalty_reward_query' +require_relative 'square/types/search_loyalty_rewards_response' +require_relative 'square/types/search_orders_customer_filter' +require_relative 'square/types/search_orders_date_time_filter' +require_relative 'square/types/search_orders_fulfillment_filter' +require_relative 'square/types/search_orders_source_filter' +require_relative 'square/types/search_orders_state_filter' +require_relative 'square/types/search_orders_filter' +require_relative 'square/types/search_orders_sort_field' +require_relative 'square/types/search_orders_sort' +require_relative 'square/types/search_orders_query' +require_relative 'square/types/search_orders_response' +require_relative 'square/types/search_scheduled_shifts_response' +require_relative 'square/types/search_shifts_response' +require_relative 'square/types/search_subscriptions_filter' +require_relative 'square/types/search_subscriptions_query' +require_relative 'square/types/search_subscriptions_response' +require_relative 'square/types/search_team_members_filter' +require_relative 'square/types/search_team_members_query' +require_relative 'square/types/search_team_members_response' +require_relative 'square/types/search_terminal_actions_response' +require_relative 'square/types/search_terminal_checkouts_response' +require_relative 'square/types/search_terminal_refunds_response' +require_relative 'square/types/search_timecards_response' +require_relative 'square/types/search_vendors_request_filter' +require_relative 'square/types/search_vendors_request_sort_field' +require_relative 'square/types/search_vendors_request_sort' +require_relative 'square/types/search_vendors_response' +require_relative 'square/types/shift_filter_status' +require_relative 'square/types/shift_workday_matcher' +require_relative 'square/types/shift_workday' +require_relative 'square/types/shift_filter' +require_relative 'square/types/shift_sort_field' +require_relative 'square/types/shift_sort' +require_relative 'square/types/shift_query' +require_relative 'square/types/submit_evidence_response' +require_relative 'square/types/subscription_created_event_object' +require_relative 'square/types/subscription_created_event_data' +require_relative 'square/types/subscription_created_event' +require_relative 'square/types/subscription_test_result' +require_relative 'square/types/subscription_updated_event_object' +require_relative 'square/types/subscription_updated_event_data' +require_relative 'square/types/subscription_updated_event' +require_relative 'square/types/swap_plan_response' +require_relative 'square/types/team_member_created_event_object' +require_relative 'square/types/team_member_created_event_data' +require_relative 'square/types/team_member_created_event' +require_relative 'square/types/team_member_invitation_status' +require_relative 'square/types/team_member_updated_event_object' +require_relative 'square/types/team_member_updated_event_data' +require_relative 'square/types/team_member_updated_event' +require_relative 'square/types/team_member_wage_setting_updated_event_object' +require_relative 'square/types/team_member_wage_setting_updated_event_data' +require_relative 'square/types/team_member_wage_setting_updated_event' +require_relative 'square/types/terminal_action_created_event_object' +require_relative 'square/types/terminal_action_created_event_data' +require_relative 'square/types/terminal_action_created_event' +require_relative 'square/types/terminal_action_query_filter' +require_relative 'square/types/terminal_action_query_sort' +require_relative 'square/types/terminal_action_query' +require_relative 'square/types/terminal_action_updated_event_object' +require_relative 'square/types/terminal_action_updated_event_data' +require_relative 'square/types/terminal_action_updated_event' +require_relative 'square/types/terminal_checkout_created_event_object' +require_relative 'square/types/terminal_checkout_created_event_data' +require_relative 'square/types/terminal_checkout_created_event' +require_relative 'square/types/terminal_checkout_query_filter' +require_relative 'square/types/terminal_checkout_query_sort' +require_relative 'square/types/terminal_checkout_query' +require_relative 'square/types/terminal_checkout_updated_event_object' +require_relative 'square/types/terminal_checkout_updated_event_data' +require_relative 'square/types/terminal_checkout_updated_event' +require_relative 'square/types/terminal_refund_created_event_object' +require_relative 'square/types/terminal_refund_created_event_data' +require_relative 'square/types/terminal_refund_created_event' +require_relative 'square/types/terminal_refund_query_filter' +require_relative 'square/types/terminal_refund_query_sort' +require_relative 'square/types/terminal_refund_query' +require_relative 'square/types/terminal_refund_updated_event_object' +require_relative 'square/types/terminal_refund_updated_event_data' +require_relative 'square/types/terminal_refund_updated_event' +require_relative 'square/types/test_webhook_subscription_response' +require_relative 'square/types/timecard_filter_status' +require_relative 'square/types/timecard_workday_matcher' +require_relative 'square/types/timecard_workday' +require_relative 'square/types/timecard_filter' +require_relative 'square/types/timecard_sort_field' +require_relative 'square/types/timecard_sort' +require_relative 'square/types/timecard_query' +require_relative 'square/types/transaction_type' +require_relative 'square/types/unlink_customer_from_gift_card_response' +require_relative 'square/types/update_booking_custom_attribute_definition_response' +require_relative 'square/types/update_booking_response' +require_relative 'square/types/update_break_type_response' +require_relative 'square/types/update_catalog_image_request' +require_relative 'square/types/update_catalog_image_response' +require_relative 'square/types/update_customer_custom_attribute_definition_response' +require_relative 'square/types/update_customer_group_response' +require_relative 'square/types/update_invoice_response' +require_relative 'square/types/update_item_modifier_lists_response' +require_relative 'square/types/update_item_taxes_response' +require_relative 'square/types/update_job_response' +require_relative 'square/types/update_location_custom_attribute_definition_response' +require_relative 'square/types/update_location_response' +require_relative 'square/types/update_location_settings_response' +require_relative 'square/types/update_merchant_custom_attribute_definition_response' +require_relative 'square/types/update_merchant_settings_response' +require_relative 'square/types/update_order_custom_attribute_definition_response' +require_relative 'square/types/update_order_response' +require_relative 'square/types/update_payment_link_response' +require_relative 'square/types/update_payment_response' +require_relative 'square/types/update_scheduled_shift_response' +require_relative 'square/types/update_shift_response' +require_relative 'square/types/update_subscription_response' +require_relative 'square/types/update_team_member_request' +require_relative 'square/types/update_timecard_response' +require_relative 'square/types/update_vendor_request' +require_relative 'square/types/update_wage_setting_response' +require_relative 'square/types/update_webhook_subscription_response' +require_relative 'square/types/update_webhook_subscription_signature_key_response' +require_relative 'square/types/update_workweek_config_response' +require_relative 'square/types/upsert_booking_custom_attribute_response' +require_relative 'square/types/upsert_catalog_object_response' +require_relative 'square/types/upsert_customer_custom_attribute_response' +require_relative 'square/types/upsert_location_custom_attribute_response' +require_relative 'square/types/upsert_merchant_custom_attribute_response' +require_relative 'square/types/upsert_snippet_response' +require_relative 'square/types/v_1_money' +require_relative 'square/types/v_1_order_history_entry_action' +require_relative 'square/types/v_1_order_history_entry' +require_relative 'square/types/v_1_order_state' +require_relative 'square/types/v_1_tender_card_brand' +require_relative 'square/types/v_1_tender_entry_method' +require_relative 'square/types/v_1_tender_type' +require_relative 'square/types/v_1_tender' +require_relative 'square/types/v_1_order' +require_relative 'square/types/v_1_update_order_request_action' +require_relative 'square/types/vendor_created_event_object' +require_relative 'square/types/vendor_created_event_data' +require_relative 'square/types/vendor_created_event' +require_relative 'square/types/vendor_updated_event_object' +require_relative 'square/types/vendor_updated_event_data' +require_relative 'square/types/vendor_updated_event' +require_relative 'square/types/visibility_filter' +require_relative 'square/types/void_transaction_response' +require_relative 'square/types/catalog_object_base' + +# Client Types +require_relative 'square/client' +require_relative 'square/mobile/client' +require_relative 'square/mobile/types/create_mobile_authorization_code_request' +require_relative 'square/o_auth/client' +require_relative 'square/o_auth/types/revoke_token_request' +require_relative 'square/o_auth/types/obtain_token_request' +require_relative 'square/v_1_transactions/client' +require_relative 'square/v_1_transactions/types/v_1_list_orders_request' +require_relative 'square/v_1_transactions/types/v_1_retrieve_order_request' +require_relative 'square/v_1_transactions/types/v_1_update_order_request' +require_relative 'square/apple_pay/client' +require_relative 'square/apple_pay/types/register_domain_request' +require_relative 'square/bank_accounts/client' +require_relative 'square/bank_accounts/types/list_bank_accounts_request' +require_relative 'square/bank_accounts/types/get_by_v_1_id_bank_accounts_request' +require_relative 'square/bank_accounts/types/get_bank_accounts_request' +require_relative 'square/bookings/client' +require_relative 'square/bookings/types/list_bookings_request' +require_relative 'square/bookings/types/create_booking_request' +require_relative 'square/bookings/types/search_availability_request' +require_relative 'square/bookings/types/bulk_retrieve_bookings_request' +require_relative 'square/bookings/types/retrieve_location_booking_profile_request' +require_relative 'square/bookings/types/bulk_retrieve_team_member_booking_profiles_request' +require_relative 'square/bookings/types/get_bookings_request' +require_relative 'square/bookings/types/update_booking_request' +require_relative 'square/bookings/types/cancel_booking_request' +require_relative 'square/cards/client' +require_relative 'square/cards/types/list_cards_request' +require_relative 'square/cards/types/create_card_request' +require_relative 'square/cards/types/get_cards_request' +require_relative 'square/cards/types/disable_cards_request' +require_relative 'square/catalog/client' +require_relative 'square/catalog/types/batch_delete_catalog_objects_request' +require_relative 'square/catalog/types/batch_get_catalog_objects_request' +require_relative 'square/catalog/types/batch_upsert_catalog_objects_request' +require_relative 'square/catalog/types/list_catalog_request' +require_relative 'square/catalog/types/search_catalog_objects_request' +require_relative 'square/catalog/types/search_catalog_items_request' +require_relative 'square/catalog/types/update_item_modifier_lists_request' +require_relative 'square/catalog/types/update_item_taxes_request' +require_relative 'square/customers/client' +require_relative 'square/customers/types/list_customers_request' +require_relative 'square/customers/types/create_customer_request' +require_relative 'square/customers/types/bulk_create_customers_request' +require_relative 'square/customers/types/bulk_delete_customers_request' +require_relative 'square/customers/types/bulk_retrieve_customers_request' +require_relative 'square/customers/types/bulk_update_customers_request' +require_relative 'square/customers/types/search_customers_request' +require_relative 'square/customers/types/get_customers_request' +require_relative 'square/customers/types/update_customer_request' +require_relative 'square/customers/types/delete_customers_request' +require_relative 'square/devices/client' +require_relative 'square/devices/types/list_devices_request' +require_relative 'square/devices/types/get_devices_request' +require_relative 'square/disputes/client' +require_relative 'square/disputes/types/list_disputes_request' +require_relative 'square/disputes/types/get_disputes_request' +require_relative 'square/disputes/types/accept_disputes_request' +require_relative 'square/disputes/types/create_evidence_file_disputes_request' +require_relative 'square/disputes/types/create_dispute_evidence_text_request' +require_relative 'square/disputes/types/submit_evidence_disputes_request' +require_relative 'square/employees/client' +require_relative 'square/employees/types/list_employees_request' +require_relative 'square/employees/types/get_employees_request' +require_relative 'square/events/client' +require_relative 'square/events/types/search_events_request' +require_relative 'square/events/types/list_event_types_request' +require_relative 'square/gift_cards/client' +require_relative 'square/gift_cards/types/list_gift_cards_request' +require_relative 'square/gift_cards/types/create_gift_card_request' +require_relative 'square/gift_cards/types/get_gift_card_from_gan_request' +require_relative 'square/gift_cards/types/get_gift_card_from_nonce_request' +require_relative 'square/gift_cards/types/link_customer_to_gift_card_request' +require_relative 'square/gift_cards/types/unlink_customer_from_gift_card_request' +require_relative 'square/gift_cards/types/get_gift_cards_request' +require_relative 'square/inventory/client' +require_relative 'square/inventory/types/deprecated_get_adjustment_inventory_request' +require_relative 'square/inventory/types/get_adjustment_inventory_request' +require_relative 'square/inventory/types/deprecated_get_physical_count_inventory_request' +require_relative 'square/inventory/types/get_physical_count_inventory_request' +require_relative 'square/inventory/types/get_transfer_inventory_request' +require_relative 'square/inventory/types/get_inventory_request' +require_relative 'square/inventory/types/changes_inventory_request' +require_relative 'square/invoices/client' +require_relative 'square/invoices/types/list_invoices_request' +require_relative 'square/invoices/types/create_invoice_request' +require_relative 'square/invoices/types/search_invoices_request' +require_relative 'square/invoices/types/get_invoices_request' +require_relative 'square/invoices/types/update_invoice_request' +require_relative 'square/invoices/types/delete_invoices_request' +require_relative 'square/invoices/types/create_invoice_attachment_request' +require_relative 'square/invoices/types/delete_invoice_attachment_request' +require_relative 'square/invoices/types/cancel_invoice_request' +require_relative 'square/invoices/types/publish_invoice_request' +require_relative 'square/labor/client' +require_relative 'square/labor/types/create_scheduled_shift_request' +require_relative 'square/labor/types/bulk_publish_scheduled_shifts_request' +require_relative 'square/labor/types/search_scheduled_shifts_request' +require_relative 'square/labor/types/retrieve_scheduled_shift_request' +require_relative 'square/labor/types/update_scheduled_shift_request' +require_relative 'square/labor/types/publish_scheduled_shift_request' +require_relative 'square/labor/types/create_timecard_request' +require_relative 'square/labor/types/search_timecards_request' +require_relative 'square/labor/types/retrieve_timecard_request' +require_relative 'square/labor/types/update_timecard_request' +require_relative 'square/labor/types/delete_timecard_request' +require_relative 'square/locations/client' +require_relative 'square/locations/types/create_location_request' +require_relative 'square/locations/types/get_locations_request' +require_relative 'square/locations/types/update_location_request' +require_relative 'square/locations/types/create_checkout_request' +require_relative 'square/loyalty/client' +require_relative 'square/loyalty/types/search_loyalty_events_request' +require_relative 'square/merchants/client' +require_relative 'square/merchants/types/list_merchants_request' +require_relative 'square/merchants/types/get_merchants_request' +require_relative 'square/checkout/client' +require_relative 'square/checkout/types/retrieve_location_settings_request' +require_relative 'square/checkout/types/update_location_settings_request' +require_relative 'square/checkout/types/update_merchant_settings_request' +require_relative 'square/orders/client' +require_relative 'square/orders/types/batch_get_orders_request' +require_relative 'square/orders/types/calculate_order_request' +require_relative 'square/orders/types/clone_order_request' +require_relative 'square/orders/types/search_orders_request' +require_relative 'square/orders/types/get_orders_request' +require_relative 'square/orders/types/update_order_request' +require_relative 'square/orders/types/pay_order_request' +require_relative 'square/payments/client' +require_relative 'square/payments/types/list_payments_request' +require_relative 'square/payments/types/create_payment_request' +require_relative 'square/payments/types/cancel_payment_by_idempotency_key_request' +require_relative 'square/payments/types/get_payments_request' +require_relative 'square/payments/types/update_payment_request' +require_relative 'square/payments/types/cancel_payments_request' +require_relative 'square/payments/types/complete_payment_request' +require_relative 'square/payouts/client' +require_relative 'square/payouts/types/list_payouts_request' +require_relative 'square/payouts/types/get_payouts_request' +require_relative 'square/payouts/types/list_entries_payouts_request' +require_relative 'square/refunds/client' +require_relative 'square/refunds/types/list_refunds_request' +require_relative 'square/refunds/types/refund_payment_request' +require_relative 'square/refunds/types/get_refunds_request' +require_relative 'square/sites/client' +require_relative 'square/snippets/client' +require_relative 'square/snippets/types/get_snippets_request' +require_relative 'square/snippets/types/upsert_snippet_request' +require_relative 'square/snippets/types/delete_snippets_request' +require_relative 'square/subscriptions/client' +require_relative 'square/subscriptions/types/create_subscription_request' +require_relative 'square/subscriptions/types/bulk_swap_plan_request' +require_relative 'square/subscriptions/types/search_subscriptions_request' +require_relative 'square/subscriptions/types/get_subscriptions_request' +require_relative 'square/subscriptions/types/update_subscription_request' +require_relative 'square/subscriptions/types/delete_action_subscriptions_request' +require_relative 'square/subscriptions/types/change_billing_anchor_date_request' +require_relative 'square/subscriptions/types/cancel_subscriptions_request' +require_relative 'square/subscriptions/types/list_events_subscriptions_request' +require_relative 'square/subscriptions/types/pause_subscription_request' +require_relative 'square/subscriptions/types/resume_subscription_request' +require_relative 'square/subscriptions/types/swap_plan_request' +require_relative 'square/team_members/client' +require_relative 'square/team_members/types/batch_create_team_members_request' +require_relative 'square/team_members/types/batch_update_team_members_request' +require_relative 'square/team_members/types/search_team_members_request' +require_relative 'square/team_members/types/get_team_members_request' +require_relative 'square/team_members/types/update_team_members_request' +require_relative 'square/team/client' +require_relative 'square/team/types/list_jobs_request' +require_relative 'square/team/types/create_job_request' +require_relative 'square/team/types/retrieve_job_request' +require_relative 'square/team/types/update_job_request' +require_relative 'square/terminal/client' +require_relative 'square/terminal/types/dismiss_terminal_action_request' +require_relative 'square/terminal/types/dismiss_terminal_checkout_request' +require_relative 'square/terminal/types/dismiss_terminal_refund_request' +require_relative 'square/vendors/client' +require_relative 'square/vendors/types/batch_create_vendors_request' +require_relative 'square/vendors/types/batch_get_vendors_request' +require_relative 'square/vendors/types/batch_update_vendors_request' +require_relative 'square/vendors/types/create_vendor_request' +require_relative 'square/vendors/types/search_vendors_request' +require_relative 'square/vendors/types/get_vendors_request' +require_relative 'square/vendors/types/update_vendors_request' +require_relative 'square/bookings/custom_attribute_definitions/client' +require_relative 'square/bookings/custom_attribute_definitions/types/list_custom_attribute_definitions_request' +require_relative 'square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request' +require_relative 'square/bookings/custom_attribute_definitions/types/get_custom_attribute_definitions_request' +require_relative 'square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request' +require_relative 'square/bookings/custom_attribute_definitions/types/delete_custom_attribute_definitions_request' +require_relative 'square/bookings/custom_attributes/client' +require_relative 'square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request' +require_relative 'square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request' +require_relative 'square/bookings/custom_attributes/types/list_custom_attributes_request' +require_relative 'square/bookings/custom_attributes/types/get_custom_attributes_request' +require_relative 'square/bookings/custom_attributes/types/upsert_booking_custom_attribute_request' +require_relative 'square/bookings/custom_attributes/types/delete_custom_attributes_request' +require_relative 'square/bookings/location_profiles/client' +require_relative 'square/bookings/location_profiles/types/list_location_profiles_request' +require_relative 'square/bookings/team_member_profiles/client' +require_relative 'square/bookings/team_member_profiles/types/list_team_member_profiles_request' +require_relative 'square/bookings/team_member_profiles/types/get_team_member_profiles_request' +require_relative 'square/cash_drawers/client' +require_relative 'square/cash_drawers/shifts/client' +require_relative 'square/cash_drawers/shifts/types/list_shifts_request' +require_relative 'square/cash_drawers/shifts/types/get_shifts_request' +require_relative 'square/cash_drawers/shifts/types/list_events_shifts_request' +require_relative 'square/catalog/images/client' +require_relative 'square/catalog/images/types/create_images_request' +require_relative 'square/catalog/images/types/update_images_request' +require_relative 'square/catalog/object/client' +require_relative 'square/catalog/object/types/upsert_catalog_object_request' +require_relative 'square/catalog/object/types/get_object_request' +require_relative 'square/catalog/object/types/delete_object_request' +require_relative 'square/checkout/payment_links/client' +require_relative 'square/checkout/payment_links/types/list_payment_links_request' +require_relative 'square/checkout/payment_links/types/create_payment_link_request' +require_relative 'square/checkout/payment_links/types/get_payment_links_request' +require_relative 'square/checkout/payment_links/types/update_payment_link_request' +require_relative 'square/checkout/payment_links/types/delete_payment_links_request' +require_relative 'square/customers/custom_attribute_definitions/client' +require_relative 'square/customers/custom_attribute_definitions/types/list_custom_attribute_definitions_request' +require_relative 'square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request' +require_relative 'square/customers/custom_attribute_definitions/types/get_custom_attribute_definitions_request' +require_relative 'square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request' +require_relative 'square/customers/custom_attribute_definitions/types/delete_custom_attribute_definitions_request' +require_relative 'square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request' +require_relative 'square/customers/groups/client' +require_relative 'square/customers/groups/types/list_groups_request' +require_relative 'square/customers/groups/types/create_customer_group_request' +require_relative 'square/customers/groups/types/get_groups_request' +require_relative 'square/customers/groups/types/update_customer_group_request' +require_relative 'square/customers/groups/types/delete_groups_request' +require_relative 'square/customers/groups/types/add_groups_request' +require_relative 'square/customers/groups/types/remove_groups_request' +require_relative 'square/customers/segments/client' +require_relative 'square/customers/segments/types/list_segments_request' +require_relative 'square/customers/segments/types/get_segments_request' +require_relative 'square/customers/cards/client' +require_relative 'square/customers/cards/types/create_customer_card_request' +require_relative 'square/customers/cards/types/delete_cards_request' +require_relative 'square/customers/custom_attributes/client' +require_relative 'square/customers/custom_attributes/types/list_custom_attributes_request' +require_relative 'square/customers/custom_attributes/types/get_custom_attributes_request' +require_relative 'square/customers/custom_attributes/types/upsert_customer_custom_attribute_request' +require_relative 'square/customers/custom_attributes/types/delete_custom_attributes_request' +require_relative 'square/devices/codes/client' +require_relative 'square/devices/codes/types/list_codes_request' +require_relative 'square/devices/codes/types/create_device_code_request' +require_relative 'square/devices/codes/types/get_codes_request' +require_relative 'square/disputes/evidence/client' +require_relative 'square/disputes/evidence/types/list_evidence_request' +require_relative 'square/disputes/evidence/types/get_evidence_request' +require_relative 'square/disputes/evidence/types/delete_evidence_request' +require_relative 'square/gift_cards/activities/client' +require_relative 'square/gift_cards/activities/types/list_activities_request' +require_relative 'square/gift_cards/activities/types/create_gift_card_activity_request' +require_relative 'square/labor/break_types/client' +require_relative 'square/labor/break_types/types/list_break_types_request' +require_relative 'square/labor/break_types/types/create_break_type_request' +require_relative 'square/labor/break_types/types/get_break_types_request' +require_relative 'square/labor/break_types/types/update_break_type_request' +require_relative 'square/labor/break_types/types/delete_break_types_request' +require_relative 'square/labor/employee_wages/client' +require_relative 'square/labor/employee_wages/types/list_employee_wages_request' +require_relative 'square/labor/employee_wages/types/get_employee_wages_request' +require_relative 'square/labor/shifts/client' +require_relative 'square/labor/shifts/types/create_shift_request' +require_relative 'square/labor/shifts/types/search_shifts_request' +require_relative 'square/labor/shifts/types/get_shifts_request' +require_relative 'square/labor/shifts/types/update_shift_request' +require_relative 'square/labor/shifts/types/delete_shifts_request' +require_relative 'square/labor/team_member_wages/client' +require_relative 'square/labor/team_member_wages/types/list_team_member_wages_request' +require_relative 'square/labor/team_member_wages/types/get_team_member_wages_request' +require_relative 'square/labor/workweek_configs/client' +require_relative 'square/labor/workweek_configs/types/list_workweek_configs_request' +require_relative 'square/labor/workweek_configs/types/update_workweek_config_request' +require_relative 'square/locations/custom_attribute_definitions/client' +require_relative 'square/locations/custom_attribute_definitions/types/list_custom_attribute_definitions_request' +require_relative 'square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request' +require_relative 'square/locations/custom_attribute_definitions/types/get_custom_attribute_definitions_request' +require_relative 'square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request' +require_relative 'square/locations/custom_attribute_definitions/types/delete_custom_attribute_definitions_request' +require_relative 'square/locations/custom_attributes/client' +require_relative 'square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request' +require_relative 'square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request' +require_relative 'square/locations/custom_attributes/types/list_custom_attributes_request' +require_relative 'square/locations/custom_attributes/types/get_custom_attributes_request' +require_relative 'square/locations/custom_attributes/types/upsert_location_custom_attribute_request' +require_relative 'square/locations/custom_attributes/types/delete_custom_attributes_request' +require_relative 'square/locations/transactions/client' +require_relative 'square/locations/transactions/types/list_transactions_request' +require_relative 'square/locations/transactions/types/get_transactions_request' +require_relative 'square/locations/transactions/types/capture_transactions_request' +require_relative 'square/locations/transactions/types/void_transactions_request' +require_relative 'square/loyalty/accounts/client' +require_relative 'square/loyalty/accounts/types/create_loyalty_account_request' +require_relative 'square/loyalty/accounts/types/search_loyalty_accounts_request' +require_relative 'square/loyalty/accounts/types/get_accounts_request' +require_relative 'square/loyalty/accounts/types/accumulate_loyalty_points_request' +require_relative 'square/loyalty/accounts/types/adjust_loyalty_points_request' +require_relative 'square/loyalty/programs/client' +require_relative 'square/loyalty/programs/types/get_programs_request' +require_relative 'square/loyalty/programs/types/calculate_loyalty_points_request' +require_relative 'square/loyalty/rewards/client' +require_relative 'square/loyalty/rewards/types/create_loyalty_reward_request' +require_relative 'square/loyalty/rewards/types/search_loyalty_rewards_request' +require_relative 'square/loyalty/rewards/types/get_rewards_request' +require_relative 'square/loyalty/rewards/types/delete_rewards_request' +require_relative 'square/loyalty/rewards/types/redeem_loyalty_reward_request' +require_relative 'square/loyalty/programs/promotions/client' +require_relative 'square/loyalty/programs/promotions/types/list_promotions_request' +require_relative 'square/loyalty/programs/promotions/types/create_loyalty_promotion_request' +require_relative 'square/loyalty/programs/promotions/types/get_promotions_request' +require_relative 'square/loyalty/programs/promotions/types/cancel_promotions_request' +require_relative 'square/merchants/custom_attribute_definitions/client' +require_relative 'square/merchants/custom_attribute_definitions/types/list_custom_attribute_definitions_request' +require_relative 'square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request' +require_relative 'square/merchants/custom_attribute_definitions/types/get_custom_attribute_definitions_request' +require_relative 'square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request' +require_relative 'square/merchants/custom_attribute_definitions/types/delete_custom_attribute_definitions_request' +require_relative 'square/merchants/custom_attributes/client' +require_relative 'square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request' +require_relative 'square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request' +require_relative 'square/merchants/custom_attributes/types/list_custom_attributes_request' +require_relative 'square/merchants/custom_attributes/types/get_custom_attributes_request' +require_relative 'square/merchants/custom_attributes/types/upsert_merchant_custom_attribute_request' +require_relative 'square/merchants/custom_attributes/types/delete_custom_attributes_request' +require_relative 'square/orders/custom_attribute_definitions/client' +require_relative 'square/orders/custom_attribute_definitions/types/list_custom_attribute_definitions_request' +require_relative 'square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request' +require_relative 'square/orders/custom_attribute_definitions/types/get_custom_attribute_definitions_request' +require_relative 'square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request' +require_relative 'square/orders/custom_attribute_definitions/types/delete_custom_attribute_definitions_request' +require_relative 'square/orders/custom_attributes/client' +require_relative 'square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request' +require_relative 'square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request' +require_relative 'square/orders/custom_attributes/types/list_custom_attributes_request' +require_relative 'square/orders/custom_attributes/types/get_custom_attributes_request' +require_relative 'square/orders/custom_attributes/types/upsert_order_custom_attribute_request' +require_relative 'square/orders/custom_attributes/types/delete_custom_attributes_request' +require_relative 'square/team_members/wage_setting/client' +require_relative 'square/team_members/wage_setting/types/get_wage_setting_request' +require_relative 'square/team_members/wage_setting/types/update_wage_setting_request' +require_relative 'square/terminal/actions/client' +require_relative 'square/terminal/actions/types/create_terminal_action_request' +require_relative 'square/terminal/actions/types/search_terminal_actions_request' +require_relative 'square/terminal/actions/types/get_actions_request' +require_relative 'square/terminal/actions/types/cancel_actions_request' +require_relative 'square/terminal/checkouts/client' +require_relative 'square/terminal/checkouts/types/create_terminal_checkout_request' +require_relative 'square/terminal/checkouts/types/search_terminal_checkouts_request' +require_relative 'square/terminal/checkouts/types/get_checkouts_request' +require_relative 'square/terminal/checkouts/types/cancel_checkouts_request' +require_relative 'square/terminal/refunds/client' +require_relative 'square/terminal/refunds/types/create_terminal_refund_request' +require_relative 'square/terminal/refunds/types/search_terminal_refunds_request' +require_relative 'square/terminal/refunds/types/get_refunds_request' +require_relative 'square/terminal/refunds/types/cancel_refunds_request' +require_relative 'square/webhooks/client' +require_relative 'square/webhooks/event_types/client' +require_relative 'square/webhooks/event_types/types/list_event_types_request' +require_relative 'square/webhooks/subscriptions/client' +require_relative 'square/webhooks/subscriptions/types/list_subscriptions_request' +require_relative 'square/webhooks/subscriptions/types/create_webhook_subscription_request' +require_relative 'square/webhooks/subscriptions/types/get_subscriptions_request' +require_relative 'square/webhooks/subscriptions/types/update_webhook_subscription_request' +require_relative 'square/webhooks/subscriptions/types/delete_subscriptions_request' +require_relative 'square/webhooks/subscriptions/types/update_webhook_subscription_signature_key_request' +require_relative 'square/webhooks/subscriptions/types/test_webhook_subscription_request' +require_relative 'square/environment' \ No newline at end of file diff --git a/lib/square/apple_pay/client.rb b/lib/square/apple_pay/client.rb new file mode 100644 index 000000000..484be8098 --- /dev/null +++ b/lib/square/apple_pay/client.rb @@ -0,0 +1,40 @@ + +module Square + module ApplePay + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::ApplePay::Client] + def initialize(client) + @client = client + end + + # Activates a domain for use with Apple Pay on the Web and Square. A validation + # is performed on this domain by Apple to ensure that it is properly set up as + # an Apple Pay enabled domain. + # + # This endpoint provides an easy way for platform developers to bulk activate + # Apple Pay on the Web with Square for merchants using their platform. + # + # Note: You will need to host a valid domain verification file on your domain to support Apple Pay. The + # current version of this file is always available at https://app.squareup.com/digital-wallets/apple-pay/apple-developer-merchantid-domain-association, + # and should be hosted at `.well_known/apple-developer-merchantid-domain-association` on your + # domain. This file is subject to change; we strongly recommend checking for updates regularly and avoiding + # long-lived caches that might not keep in sync with the correct file version. + # + # To learn more about the Web Payments SDK and how to add Apple Pay, see [Take an Apple Pay Payment](https://developer.squareup.com/docs/web-payments/apple-pay). + # + # @return [Square::Types::RegisterDomainResponse] + def register_domain(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RegisterDomainResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/apple_pay/types/register_domain_request.rb b/lib/square/apple_pay/types/register_domain_request.rb new file mode 100644 index 000000000..f7399ecc8 --- /dev/null +++ b/lib/square/apple_pay/types/register_domain_request.rb @@ -0,0 +1,11 @@ + +module Square + module ApplePay + module Types + class RegisterDomainRequest < Internal::Types::Model + field :domain_name, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bank_accounts/client.rb b/lib/square/bank_accounts/client.rb new file mode 100644 index 000000000..910b59a8a --- /dev/null +++ b/lib/square/bank_accounts/client.rb @@ -0,0 +1,54 @@ + +module Square + module BankAccounts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::BankAccounts::Client] + def initialize(client) + @client = client + end + + # Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account. + # + # @return [Square::Types::ListBankAccountsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListBankAccountsResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID. + # + # @return [Square::Types::GetBankAccountByV1IdResponse] + def get_by_v_1_id(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetBankAccountByV1IdResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns details of a [BankAccount](entity:BankAccount) + # linked to a Square account. + # + # @return [Square::Types::GetBankAccountResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetBankAccountResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/bank_accounts/types/get_bank_accounts_request.rb b/lib/square/bank_accounts/types/get_bank_accounts_request.rb new file mode 100644 index 000000000..44373698a --- /dev/null +++ b/lib/square/bank_accounts/types/get_bank_accounts_request.rb @@ -0,0 +1,11 @@ + +module Square + module BankAccounts + module Types + class GetBankAccountsRequest < Internal::Types::Model + field :bank_account_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bank_accounts/types/get_by_v_1_id_bank_accounts_request.rb b/lib/square/bank_accounts/types/get_by_v_1_id_bank_accounts_request.rb new file mode 100644 index 000000000..988095356 --- /dev/null +++ b/lib/square/bank_accounts/types/get_by_v_1_id_bank_accounts_request.rb @@ -0,0 +1,11 @@ + +module Square + module BankAccounts + module Types + class GetByV1IdBankAccountsRequest < Internal::Types::Model + field :v_1_bank_account_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bank_accounts/types/list_bank_accounts_request.rb b/lib/square/bank_accounts/types/list_bank_accounts_request.rb new file mode 100644 index 000000000..0e267f040 --- /dev/null +++ b/lib/square/bank_accounts/types/list_bank_accounts_request.rb @@ -0,0 +1,13 @@ + +module Square + module BankAccounts + module Types + class ListBankAccountsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/client.rb b/lib/square/bookings/client.rb new file mode 100644 index 000000000..ef5aa20e6 --- /dev/null +++ b/lib/square/bookings/client.rb @@ -0,0 +1,181 @@ + +module Square + module Bookings + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Bookings::Client] + def initialize(client) + @client = client + end + + # Retrieve a collection of bookings. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::ListBookingsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListBookingsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a booking. + # + # The required input must include the following: + # - `Booking.location_id` + # - `Booking.start_at` + # - `Booking.AppointmentSegment.team_member_id` + # - `Booking.AppointmentSegment.service_variation_id` + # - `Booking.AppointmentSegment.service_variation_version` + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::CreateBookingResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateBookingResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for availabilities for booking. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::SearchAvailabilityResponse] + def search_availability(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchAvailabilityResponse.load(_response.body) + else + raise _response.body + end + end + + # Bulk-Retrieves a list of bookings by booking IDs. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::BulkRetrieveBookingsResponse] + def bulk_retrieve_bookings(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkRetrieveBookingsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a seller's booking profile. + # + # @return [Square::Types::GetBusinessBookingProfileResponse] + def get_business_profile(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetBusinessBookingProfileResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a seller's location booking profile. + # + # @return [Square::Types::RetrieveLocationBookingProfileResponse] + def retrieve_location_booking_profile(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveLocationBookingProfileResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves one or more team members' booking profiles. + # + # @return [Square::Types::BulkRetrieveTeamMemberBookingProfilesResponse] + def bulk_retrieve_team_member_booking_profiles(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkRetrieveTeamMemberBookingProfilesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a booking. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::GetBookingResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetBookingResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a booking. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::UpdateBookingResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateBookingResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels an existing booking. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::CancelBookingResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelBookingResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/client.rb b/lib/square/bookings/custom_attribute_definitions/client.rb new file mode 100644 index 000000000..9eca1f4f8 --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/client.rb @@ -0,0 +1,105 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Bookings::CustomAttributeDefinitions::Client] + def initialize(client) + @client = client + end + + # Get all bookings custom attribute definitions. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::ListBookingCustomAttributeDefinitionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListBookingCustomAttributeDefinitionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a bookings custom attribute definition. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::CreateBookingCustomAttributeDefinitionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateBookingCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a bookings custom attribute definition. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::RetrieveBookingCustomAttributeDefinitionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveBookingCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a bookings custom attribute definition. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::UpdateBookingCustomAttributeDefinitionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateBookingCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a bookings custom attribute definition. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::DeleteBookingCustomAttributeDefinitionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteBookingCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request.rb b/lib/square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request.rb new file mode 100644 index 000000000..bdc6ffd94 --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/types/create_booking_custom_attribute_definition_request.rb @@ -0,0 +1,14 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + module Types + class CreateBookingCustomAttributeDefinitionRequest < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb b/lib/square/bookings/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..a29648516 --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + module Types + class DeleteCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb b/lib/square/bookings/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..d83e87e5e --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + module Types + class GetCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb b/lib/square/bookings/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..328fc8e31 --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + module Types + class ListCustomAttributeDefinitionsRequest < Internal::Types::Model + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request.rb b/lib/square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request.rb new file mode 100644 index 000000000..f6dbdf6c2 --- /dev/null +++ b/lib/square/bookings/custom_attribute_definitions/types/update_booking_custom_attribute_definition_request.rb @@ -0,0 +1,15 @@ + +module Square + module Bookings + module CustomAttributeDefinitions + module Types + class UpdateBookingCustomAttributeDefinitionRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/client.rb b/lib/square/bookings/custom_attributes/client.rb new file mode 100644 index 000000000..b9779f648 --- /dev/null +++ b/lib/square/bookings/custom_attributes/client.rb @@ -0,0 +1,124 @@ + +module Square + module Bookings + module CustomAttributes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Bookings::CustomAttributes::Client] + def initialize(client) + @client = client + end + + # Bulk deletes bookings custom attributes. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::BulkDeleteBookingCustomAttributesResponse] + def batch_delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkDeleteBookingCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Bulk upserts bookings custom attributes. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::BulkUpsertBookingCustomAttributesResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkUpsertBookingCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists a booking's custom attributes. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::ListBookingCustomAttributesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListBookingCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a bookings custom attribute. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_READ` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` for the OAuth scope. + # + # @return [Square::Types::RetrieveBookingCustomAttributeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveBookingCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Upserts a bookings custom attribute. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::UpsertBookingCustomAttributeResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertBookingCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a bookings custom attribute. + # + # To call this endpoint with buyer-level permissions, set `APPOINTMENTS_WRITE` for the OAuth scope. + # To call this endpoint with seller-level permissions, set `APPOINTMENTS_ALL_WRITE` and `APPOINTMENTS_WRITE` for the OAuth scope. + # + # For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to *Appointments Plus* + # or *Appointments Premium*. + # + # @return [Square::Types::DeleteBookingCustomAttributeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteBookingCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request.rb b/lib/square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request.rb new file mode 100644 index 000000000..e08536fc7 --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/bulk_delete_booking_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class BulkDeleteBookingCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BookingCustomAttributeDeleteRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request.rb b/lib/square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request.rb new file mode 100644 index 000000000..55700a895 --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/bulk_upsert_booking_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class BulkUpsertBookingCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BookingCustomAttributeUpsertRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/delete_custom_attributes_request.rb b/lib/square/bookings/custom_attributes/types/delete_custom_attributes_request.rb new file mode 100644 index 000000000..fda73c838 --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/delete_custom_attributes_request.rb @@ -0,0 +1,14 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class DeleteCustomAttributesRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/get_custom_attributes_request.rb b/lib/square/bookings/custom_attributes/types/get_custom_attributes_request.rb new file mode 100644 index 000000000..6cab54b1f --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/get_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class GetCustomAttributesRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :with_definition, Internal::Types::Boolean, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/list_custom_attributes_request.rb b/lib/square/bookings/custom_attributes/types/list_custom_attributes_request.rb new file mode 100644 index 000000000..e299e1906 --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/list_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class ListCustomAttributesRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :with_definitions, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/custom_attributes/types/upsert_booking_custom_attribute_request.rb b/lib/square/bookings/custom_attributes/types/upsert_booking_custom_attribute_request.rb new file mode 100644 index 000000000..1ed08057f --- /dev/null +++ b/lib/square/bookings/custom_attributes/types/upsert_booking_custom_attribute_request.rb @@ -0,0 +1,16 @@ + +module Square + module Bookings + module CustomAttributes + module Types + class UpsertBookingCustomAttributeRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/location_profiles/client.rb b/lib/square/bookings/location_profiles/client.rb new file mode 100644 index 000000000..7a0909f40 --- /dev/null +++ b/lib/square/bookings/location_profiles/client.rb @@ -0,0 +1,29 @@ + +module Square + module Bookings + module LocationProfiles + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Bookings::LocationProfiles::Client] + def initialize(client) + @client = client + end + + # Lists location booking profiles of a seller. + # + # @return [Square::Types::ListLocationBookingProfilesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLocationBookingProfilesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/bookings/location_profiles/types/list_location_profiles_request.rb b/lib/square/bookings/location_profiles/types/list_location_profiles_request.rb new file mode 100644 index 000000000..a282cde1f --- /dev/null +++ b/lib/square/bookings/location_profiles/types/list_location_profiles_request.rb @@ -0,0 +1,14 @@ + +module Square + module Bookings + module LocationProfiles + module Types + class ListLocationProfilesRequest < Internal::Types::Model + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/team_member_profiles/client.rb b/lib/square/bookings/team_member_profiles/client.rb new file mode 100644 index 000000000..7439747b9 --- /dev/null +++ b/lib/square/bookings/team_member_profiles/client.rb @@ -0,0 +1,42 @@ + +module Square + module Bookings + module TeamMemberProfiles + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Bookings::TeamMemberProfiles::Client] + def initialize(client) + @client = client + end + + # Lists booking profiles for team members. + # + # @return [Square::Types::ListTeamMemberBookingProfilesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListTeamMemberBookingProfilesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a team member's booking profile. + # + # @return [Square::Types::GetTeamMemberBookingProfileResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTeamMemberBookingProfileResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/bookings/team_member_profiles/types/get_team_member_profiles_request.rb b/lib/square/bookings/team_member_profiles/types/get_team_member_profiles_request.rb new file mode 100644 index 000000000..32ca5c55c --- /dev/null +++ b/lib/square/bookings/team_member_profiles/types/get_team_member_profiles_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module TeamMemberProfiles + module Types + class GetTeamMemberProfilesRequest < Internal::Types::Model + field :team_member_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/team_member_profiles/types/list_team_member_profiles_request.rb b/lib/square/bookings/team_member_profiles/types/list_team_member_profiles_request.rb new file mode 100644 index 000000000..c500a7b9f --- /dev/null +++ b/lib/square/bookings/team_member_profiles/types/list_team_member_profiles_request.rb @@ -0,0 +1,16 @@ + +module Square + module Bookings + module TeamMemberProfiles + module Types + class ListTeamMemberProfilesRequest < Internal::Types::Model + field :bookable_only, Internal::Types::Boolean, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/bookings/types/bulk_retrieve_bookings_request.rb b/lib/square/bookings/types/bulk_retrieve_bookings_request.rb new file mode 100644 index 000000000..fa64ffec6 --- /dev/null +++ b/lib/square/bookings/types/bulk_retrieve_bookings_request.rb @@ -0,0 +1,11 @@ + +module Square + module Bookings + module Types + class BulkRetrieveBookingsRequest < Internal::Types::Model + field :booking_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/bulk_retrieve_team_member_booking_profiles_request.rb b/lib/square/bookings/types/bulk_retrieve_team_member_booking_profiles_request.rb new file mode 100644 index 000000000..ec6a7d66c --- /dev/null +++ b/lib/square/bookings/types/bulk_retrieve_team_member_booking_profiles_request.rb @@ -0,0 +1,11 @@ + +module Square + module Bookings + module Types + class BulkRetrieveTeamMemberBookingProfilesRequest < Internal::Types::Model + field :team_member_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/cancel_booking_request.rb b/lib/square/bookings/types/cancel_booking_request.rb new file mode 100644 index 000000000..6d68d7ebf --- /dev/null +++ b/lib/square/bookings/types/cancel_booking_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module Types + class CancelBookingRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + field :booking_version, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/create_booking_request.rb b/lib/square/bookings/types/create_booking_request.rb new file mode 100644 index 000000000..365cff967 --- /dev/null +++ b/lib/square/bookings/types/create_booking_request.rb @@ -0,0 +1,12 @@ + +module Square + module Bookings + module Types + class CreateBookingRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :booking, Square::Types::Booking, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/get_bookings_request.rb b/lib/square/bookings/types/get_bookings_request.rb new file mode 100644 index 000000000..f0adb430d --- /dev/null +++ b/lib/square/bookings/types/get_bookings_request.rb @@ -0,0 +1,11 @@ + +module Square + module Bookings + module Types + class GetBookingsRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/list_bookings_request.rb b/lib/square/bookings/types/list_bookings_request.rb new file mode 100644 index 000000000..18ee87b7a --- /dev/null +++ b/lib/square/bookings/types/list_bookings_request.rb @@ -0,0 +1,17 @@ + +module Square + module Bookings + module Types + class ListBookingsRequest < Internal::Types::Model + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :start_at_min, String, optional: true, nullable: false + field :start_at_max, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/retrieve_location_booking_profile_request.rb b/lib/square/bookings/types/retrieve_location_booking_profile_request.rb new file mode 100644 index 000000000..deabe3051 --- /dev/null +++ b/lib/square/bookings/types/retrieve_location_booking_profile_request.rb @@ -0,0 +1,11 @@ + +module Square + module Bookings + module Types + class RetrieveLocationBookingProfileRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/search_availability_request.rb b/lib/square/bookings/types/search_availability_request.rb new file mode 100644 index 000000000..144b6d22b --- /dev/null +++ b/lib/square/bookings/types/search_availability_request.rb @@ -0,0 +1,11 @@ + +module Square + module Bookings + module Types + class SearchAvailabilityRequest < Internal::Types::Model + field :query, Square::Types::SearchAvailabilityQuery, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/bookings/types/update_booking_request.rb b/lib/square/bookings/types/update_booking_request.rb new file mode 100644 index 000000000..e26b6db80 --- /dev/null +++ b/lib/square/bookings/types/update_booking_request.rb @@ -0,0 +1,13 @@ + +module Square + module Bookings + module Types + class UpdateBookingRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + field :booking, Square::Types::Booking, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/cards/client.rb b/lib/square/cards/client.rb new file mode 100644 index 000000000..1ad0cd73f --- /dev/null +++ b/lib/square/cards/client.rb @@ -0,0 +1,68 @@ + +module Square + module Cards + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Cards::Client] + def initialize(client) + @client = client + end + + # Retrieves a list of cards owned by the account making the request. + # A max of 25 cards will be returned. + # + # @return [Square::Types::ListCardsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCardsResponse.load(_response.body) + else + raise _response.body + end + end + + # Adds a card on file to an existing merchant. + # + # @return [Square::Types::CreateCardResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves details for a specific Card. + # + # @return [Square::Types::GetCardResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Disables the card, preventing any further updates or charges. + # Disabling an already disabled card is allowed but has no effect. + # + # @return [Square::Types::DisableCardResponse] + def disable(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DisableCardResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/cards/types/create_card_request.rb b/lib/square/cards/types/create_card_request.rb new file mode 100644 index 000000000..88b89f70e --- /dev/null +++ b/lib/square/cards/types/create_card_request.rb @@ -0,0 +1,14 @@ + +module Square + module Cards + module Types + class CreateCardRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :source_id, String, optional: false, nullable: false + field :verification_token, String, optional: true, nullable: false + field :card, Square::Types::Card, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/cards/types/disable_cards_request.rb b/lib/square/cards/types/disable_cards_request.rb new file mode 100644 index 000000000..64952c9ab --- /dev/null +++ b/lib/square/cards/types/disable_cards_request.rb @@ -0,0 +1,11 @@ + +module Square + module Cards + module Types + class DisableCardsRequest < Internal::Types::Model + field :card_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/cards/types/get_cards_request.rb b/lib/square/cards/types/get_cards_request.rb new file mode 100644 index 000000000..37635253f --- /dev/null +++ b/lib/square/cards/types/get_cards_request.rb @@ -0,0 +1,11 @@ + +module Square + module Cards + module Types + class GetCardsRequest < Internal::Types::Model + field :card_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/cards/types/list_cards_request.rb b/lib/square/cards/types/list_cards_request.rb new file mode 100644 index 000000000..ce2973eed --- /dev/null +++ b/lib/square/cards/types/list_cards_request.rb @@ -0,0 +1,15 @@ + +module Square + module Cards + module Types + class ListCardsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :include_disabled, Internal::Types::Boolean, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/cash_drawers/client.rb b/lib/square/cash_drawers/client.rb new file mode 100644 index 000000000..fe352b083 --- /dev/null +++ b/lib/square/cash_drawers/client.rb @@ -0,0 +1,14 @@ + +module Square + module CashDrawers + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::CashDrawers::Client] + def initialize(client) + @client = client + end + + end + end +end diff --git a/lib/square/cash_drawers/shifts/client.rb b/lib/square/cash_drawers/shifts/client.rb new file mode 100644 index 000000000..5cd1c3a3f --- /dev/null +++ b/lib/square/cash_drawers/shifts/client.rb @@ -0,0 +1,57 @@ + +module Square + module CashDrawers + module Shifts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::CashDrawers::Shifts::Client] + def initialize(client) + @client = client + end + + # Provides the details for all of the cash drawer shifts for a location + # in a date range. + # + # @return [Square::Types::ListCashDrawerShiftsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCashDrawerShiftsResponse.load(_response.body) + else + raise _response.body + end + end + + # Provides the summary details for a single cash drawer shift. See + # [ListCashDrawerShiftEvents](api-endpoint:CashDrawers-ListCashDrawerShiftEvents) for a list of cash drawer shift events. + # + # @return [Square::Types::GetCashDrawerShiftResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCashDrawerShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Provides a paginated list of events for a single cash drawer shift. + # + # @return [Square::Types::ListCashDrawerShiftEventsResponse] + def list_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCashDrawerShiftEventsResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/cash_drawers/shifts/types/get_shifts_request.rb b/lib/square/cash_drawers/shifts/types/get_shifts_request.rb new file mode 100644 index 000000000..0df930719 --- /dev/null +++ b/lib/square/cash_drawers/shifts/types/get_shifts_request.rb @@ -0,0 +1,14 @@ + +module Square + module CashDrawers + module Shifts + module Types + class GetShiftsRequest < Internal::Types::Model + field :shift_id, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/cash_drawers/shifts/types/list_events_shifts_request.rb b/lib/square/cash_drawers/shifts/types/list_events_shifts_request.rb new file mode 100644 index 000000000..9be68a699 --- /dev/null +++ b/lib/square/cash_drawers/shifts/types/list_events_shifts_request.rb @@ -0,0 +1,16 @@ + +module Square + module CashDrawers + module Shifts + module Types + class ListEventsShiftsRequest < Internal::Types::Model + field :shift_id, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/cash_drawers/shifts/types/list_shifts_request.rb b/lib/square/cash_drawers/shifts/types/list_shifts_request.rb new file mode 100644 index 000000000..31ec275a2 --- /dev/null +++ b/lib/square/cash_drawers/shifts/types/list_shifts_request.rb @@ -0,0 +1,18 @@ + +module Square + module CashDrawers + module Shifts + module Types + class ListShiftsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/catalog/client.rb b/lib/square/catalog/client.rb new file mode 100644 index 000000000..a44310f88 --- /dev/null +++ b/lib/square/catalog/client.rb @@ -0,0 +1,191 @@ + +module Square + module Catalog + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Catalog::Client] + def initialize(client) + @client = client + end + + # Deletes a set of [CatalogItem](entity:CatalogItem)s based on the + # provided list of target IDs and returns a set of successfully deleted IDs in + # the response. Deletion is a cascading event such that all children of the + # targeted object are also deleted. For example, deleting a CatalogItem will + # also delete all of its [CatalogItemVariation](entity:CatalogItemVariation) + # children. + # + # `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted + # IDs can be deleted. The response will only include IDs that were + # actually deleted. + # + # To ensure consistency, only one delete request is processed at a time per seller account. + # While one (batch or non-batch) delete request is being processed, other (batched and non-batched) + # delete requests are rejected with the `429` error code. + # + # @return [Square::Types::BatchDeleteCatalogObjectsResponse] + def batch_delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchDeleteCatalogObjectsResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a set of objects based on the provided ID. + # Each [CatalogItem](entity:CatalogItem) returned in the set includes all of its + # child information including: all of its + # [CatalogItemVariation](entity:CatalogItemVariation) objects, references to + # its [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of + # any [CatalogTax](entity:CatalogTax) objects that apply to it. + # + # @return [Square::Types::BatchGetCatalogObjectsResponse] + def batch_get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetCatalogObjectsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates up to 10,000 target objects based on the provided + # list of objects. The target objects are grouped into batches and each batch is + # inserted/updated in an all-or-nothing manner. If an object within a batch is + # malformed in some way, or violates a database constraint, the entire batch + # containing that item will be disregarded. However, other batches in the same + # request may still succeed. Each batch may contain up to 1,000 objects, and + # batches will be processed in order as long as the total object count for the + # request (items, variations, modifier lists, discounts, and taxes) is no more + # than 10,000. + # + # To ensure consistency, only one update request is processed at a time per seller account. + # While one (batch or non-batch) update request is being processed, other (batched and non-batched) + # update requests are rejected with the `429` error code. + # + # @return [Square::Types::BatchUpsertCatalogObjectsResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchUpsertCatalogObjectsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves information about the Square Catalog API, such as batch size + # limits that can be used by the `BatchUpsertCatalogObjects` endpoint. + # + # @return [Square::Types::CatalogInfoResponse] + def info(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CatalogInfoResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified types in the catalog. + # + # The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values, + # for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`". + # + # __Important:__ ListCatalog does not return deleted catalog items. To retrieve + # deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) + # and set the `include_deleted_objects` attribute value to `true`. + # + # @return [Square::Types::ListCatalogResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCatalogResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for [CatalogObject](entity:CatalogObject) of any type by matching supported search attribute values, + # excluding custom attribute values on items or item variations, against one or more of the specified query filters. + # + # This (`SearchCatalogObjects`) endpoint differs from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) + # endpoint in the following aspects: + # + # - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. + # - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. + # - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. + # - The both endpoints have different call conventions, including the query filter formats. + # + # @return [Square::Types::SearchCatalogObjectsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchCatalogObjectsResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for catalog items or item variations by matching supported search attribute values, including + # custom attribute values, against one or more of the specified query filters. + # + # This (`SearchCatalogItems`) endpoint differs from the [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects) + # endpoint in the following aspects: + # + # - `SearchCatalogItems` can only search for items or item variations, whereas `SearchCatalogObjects` can search for any type of catalog objects. + # - `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not. + # - `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does. + # - The both endpoints use different call conventions, including the query filter formats. + # + # @return [Square::Types::SearchCatalogItemsResponse] + def search_items(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchCatalogItemsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the [CatalogModifierList](entity:CatalogModifierList) objects + # that apply to the targeted [CatalogItem](entity:CatalogItem) without having + # to perform an upsert on the entire item. + # + # @return [Square::Types::UpdateItemModifierListsResponse] + def update_item_modifier_lists(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateItemModifierListsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the [CatalogTax](entity:CatalogTax) objects that apply to the + # targeted [CatalogItem](entity:CatalogItem) without having to perform an + # upsert on the entire item. + # + # @return [Square::Types::UpdateItemTaxesResponse] + def update_item_taxes(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateItemTaxesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/catalog/images/client.rb b/lib/square/catalog/images/client.rb new file mode 100644 index 000000000..361598537 --- /dev/null +++ b/lib/square/catalog/images/client.rb @@ -0,0 +1,50 @@ + +module Square + module Catalog + module Images + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Catalog::Images::Client] + def initialize(client) + @client = client + end + + # Uploads an image file to be represented by a [CatalogImage](entity:CatalogImage) object that can be linked to an existing + # [CatalogObject](entity:CatalogObject) instance. The resulting `CatalogImage` is unattached to any `CatalogObject` if the `object_id` + # is not specified. + # + # This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + # + # @return [Square::Types::CreateCatalogImageResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCatalogImageResponse.load(_response.body) + else + raise _response.body + end + end + + # Uploads a new image file to replace the existing one in the specified [CatalogImage](entity:CatalogImage) object. + # + # This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB. + # + # @return [Square::Types::UpdateCatalogImageResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateCatalogImageResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/catalog/images/types/create_images_request.rb b/lib/square/catalog/images/types/create_images_request.rb new file mode 100644 index 000000000..3b3922883 --- /dev/null +++ b/lib/square/catalog/images/types/create_images_request.rb @@ -0,0 +1,10 @@ + +module Square + module Catalog + module Images + module Types + class CreateImagesRequest < Internal::Types::Model; end + end + end + end +end diff --git a/lib/square/catalog/images/types/update_images_request.rb b/lib/square/catalog/images/types/update_images_request.rb new file mode 100644 index 000000000..2e11b6fe8 --- /dev/null +++ b/lib/square/catalog/images/types/update_images_request.rb @@ -0,0 +1,13 @@ + +module Square + module Catalog + module Images + module Types + class UpdateImagesRequest < Internal::Types::Model + field :image_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/catalog/object/client.rb b/lib/square/catalog/object/client.rb new file mode 100644 index 000000000..7cb8ae535 --- /dev/null +++ b/lib/square/catalog/object/client.rb @@ -0,0 +1,74 @@ + +module Square + module Catalog + module Object_ + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Catalog::Object_::Client] + def initialize(client) + @client = client + end + + # Creates a new or updates the specified [CatalogObject](entity:CatalogObject). + # + # To ensure consistency, only one update request is processed at a time per seller account. + # While one (batch or non-batch) update request is being processed, other (batched and non-batched) + # update requests are rejected with the `429` error code. + # + # @return [Square::Types::UpsertCatalogObjectResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertCatalogObjectResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single [CatalogItem](entity:CatalogItem) as a + # [CatalogObject](entity:CatalogObject) based on the provided ID. The returned + # object includes all of the relevant [CatalogItem](entity:CatalogItem) + # information including: [CatalogItemVariation](entity:CatalogItemVariation) + # children, references to its + # [CatalogModifierList](entity:CatalogModifierList) objects, and the ids of + # any [CatalogTax](entity:CatalogTax) objects that apply to it. + # + # @return [Square::Types::GetCatalogObjectResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCatalogObjectResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a single [CatalogObject](entity:CatalogObject) based on the + # provided ID and returns the set of successfully deleted IDs in the response. + # Deletion is a cascading event such that all children of the targeted object + # are also deleted. For example, deleting a [CatalogItem](entity:CatalogItem) + # will also delete all of its + # [CatalogItemVariation](entity:CatalogItemVariation) children. + # + # To ensure consistency, only one delete request is processed at a time per seller account. + # While one (batch or non-batch) delete request is being processed, other (batched and non-batched) + # delete requests are rejected with the `429` error code. + # + # @return [Square::Types::DeleteCatalogObjectResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCatalogObjectResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/catalog/object/types/delete_object_request.rb b/lib/square/catalog/object/types/delete_object_request.rb new file mode 100644 index 000000000..db8dc1ea0 --- /dev/null +++ b/lib/square/catalog/object/types/delete_object_request.rb @@ -0,0 +1,13 @@ + +module Square + module Catalog + module Object_ + module Types + class DeleteObjectRequest < Internal::Types::Model + field :object_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/catalog/object/types/get_object_request.rb b/lib/square/catalog/object/types/get_object_request.rb new file mode 100644 index 000000000..ae8747bad --- /dev/null +++ b/lib/square/catalog/object/types/get_object_request.rb @@ -0,0 +1,16 @@ + +module Square + module Catalog + module Object_ + module Types + class GetObjectRequest < Internal::Types::Model + field :object_id, String, optional: false, nullable: false + field :include_related_objects, Internal::Types::Boolean, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :include_category_path_to_root, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/catalog/object/types/upsert_catalog_object_request.rb b/lib/square/catalog/object/types/upsert_catalog_object_request.rb new file mode 100644 index 000000000..521b76602 --- /dev/null +++ b/lib/square/catalog/object/types/upsert_catalog_object_request.rb @@ -0,0 +1,14 @@ + +module Square + module Catalog + module Object_ + module Types + class UpsertCatalogObjectRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :object, Square::Types::CatalogObject, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/catalog/types/batch_delete_catalog_objects_request.rb b/lib/square/catalog/types/batch_delete_catalog_objects_request.rb new file mode 100644 index 000000000..aae79f360 --- /dev/null +++ b/lib/square/catalog/types/batch_delete_catalog_objects_request.rb @@ -0,0 +1,11 @@ + +module Square + module Catalog + module Types + class BatchDeleteCatalogObjectsRequest < Internal::Types::Model + field :object_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/batch_get_catalog_objects_request.rb b/lib/square/catalog/types/batch_get_catalog_objects_request.rb new file mode 100644 index 000000000..7a2af4b56 --- /dev/null +++ b/lib/square/catalog/types/batch_get_catalog_objects_request.rb @@ -0,0 +1,15 @@ + +module Square + module Catalog + module Types + class BatchGetCatalogObjectsRequest < Internal::Types::Model + field :object_ids, Internal::Types::Array[String], optional: false, nullable: false + field :include_related_objects, Internal::Types::Boolean, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :include_deleted_objects, Internal::Types::Boolean, optional: true, nullable: false + field :include_category_path_to_root, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/batch_upsert_catalog_objects_request.rb b/lib/square/catalog/types/batch_upsert_catalog_objects_request.rb new file mode 100644 index 000000000..fb690befb --- /dev/null +++ b/lib/square/catalog/types/batch_upsert_catalog_objects_request.rb @@ -0,0 +1,12 @@ + +module Square + module Catalog + module Types + class BatchUpsertCatalogObjectsRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :batches, Internal::Types::Array[Square::Types::CatalogObjectBatch], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/list_catalog_request.rb b/lib/square/catalog/types/list_catalog_request.rb new file mode 100644 index 000000000..a7172e0ee --- /dev/null +++ b/lib/square/catalog/types/list_catalog_request.rb @@ -0,0 +1,13 @@ + +module Square + module Catalog + module Types + class ListCatalogRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :types, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/search_catalog_items_request.rb b/lib/square/catalog/types/search_catalog_items_request.rb new file mode 100644 index 000000000..a9d14db2d --- /dev/null +++ b/lib/square/catalog/types/search_catalog_items_request.rb @@ -0,0 +1,20 @@ + +module Square + module Catalog + module Types + class SearchCatalogItemsRequest < Internal::Types::Model + field :text_filter, String, optional: true, nullable: false + field :category_ids, Internal::Types::Array[String], optional: true, nullable: false + field :stock_levels, Internal::Types::Array[Square::Types::SearchCatalogItemsRequestStockLevel], optional: true, nullable: false + field :enabled_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :product_types, Internal::Types::Array[Square::Types::CatalogItemProductType], optional: true, nullable: false + field :custom_attribute_filters, Internal::Types::Array[Square::Types::CustomAttributeFilter], optional: true, nullable: false + field :archived_state, Square::Types::ArchivedState, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/search_catalog_objects_request.rb b/lib/square/catalog/types/search_catalog_objects_request.rb new file mode 100644 index 000000000..8ecd58d34 --- /dev/null +++ b/lib/square/catalog/types/search_catalog_objects_request.rb @@ -0,0 +1,18 @@ + +module Square + module Catalog + module Types + class SearchCatalogObjectsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :object_types, Internal::Types::Array[Square::Types::CatalogObjectType], optional: true, nullable: false + field :include_deleted_objects, Internal::Types::Boolean, optional: true, nullable: false + field :include_related_objects, Internal::Types::Boolean, optional: true, nullable: false + field :begin_time, String, optional: true, nullable: false + field :query, Square::Types::CatalogQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :include_category_path_to_root, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/update_item_modifier_lists_request.rb b/lib/square/catalog/types/update_item_modifier_lists_request.rb new file mode 100644 index 000000000..97414a247 --- /dev/null +++ b/lib/square/catalog/types/update_item_modifier_lists_request.rb @@ -0,0 +1,13 @@ + +module Square + module Catalog + module Types + class UpdateItemModifierListsRequest < Internal::Types::Model + field :item_ids, Internal::Types::Array[String], optional: false, nullable: false + field :modifier_lists_to_enable, Internal::Types::Array[String], optional: true, nullable: false + field :modifier_lists_to_disable, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/catalog/types/update_item_taxes_request.rb b/lib/square/catalog/types/update_item_taxes_request.rb new file mode 100644 index 000000000..d4e55e4c1 --- /dev/null +++ b/lib/square/catalog/types/update_item_taxes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Catalog + module Types + class UpdateItemTaxesRequest < Internal::Types::Model + field :item_ids, Internal::Types::Array[String], optional: false, nullable: false + field :taxes_to_enable, Internal::Types::Array[String], optional: true, nullable: false + field :taxes_to_disable, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/checkout/client.rb b/lib/square/checkout/client.rb new file mode 100644 index 000000000..6bb2521b4 --- /dev/null +++ b/lib/square/checkout/client.rb @@ -0,0 +1,66 @@ + +module Square + module Checkout + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Checkout::Client] + def initialize(client) + @client = client + end + + # Retrieves the location-level settings for a Square-hosted checkout page. + # + # @return [Square::Types::RetrieveLocationSettingsResponse] + def retrieve_location_settings(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveLocationSettingsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the location-level settings for a Square-hosted checkout page. + # + # @return [Square::Types::UpdateLocationSettingsResponse] + def update_location_settings(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateLocationSettingsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves the merchant-level settings for a Square-hosted checkout page. + # + # @return [Square::Types::RetrieveMerchantSettingsResponse] + def retrieve_merchant_settings(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveMerchantSettingsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the merchant-level settings for a Square-hosted checkout page. + # + # @return [Square::Types::UpdateMerchantSettingsResponse] + def update_merchant_settings(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateMerchantSettingsResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/checkout/payment_links/client.rb b/lib/square/checkout/payment_links/client.rb new file mode 100644 index 000000000..7a216d0b0 --- /dev/null +++ b/lib/square/checkout/payment_links/client.rb @@ -0,0 +1,83 @@ + +module Square + module Checkout + module PaymentLinks + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Checkout::PaymentLinks::Client] + def initialize(client) + @client = client + end + + # Lists all payment links. + # + # @return [Square::Types::ListPaymentLinksResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListPaymentLinksResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + # + # @return [Square::Types::CreatePaymentLinkResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreatePaymentLinkResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a payment link. + # + # @return [Square::Types::GetPaymentLinkResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetPaymentLinkResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a payment link. You can update the `payment_link` fields such as + # `description`, `checkout_options`, and `pre_populated_data`. + # You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. + # + # @return [Square::Types::UpdatePaymentLinkResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdatePaymentLinkResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a payment link. + # + # @return [Square::Types::DeletePaymentLinkResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeletePaymentLinkResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/checkout/payment_links/types/create_payment_link_request.rb b/lib/square/checkout/payment_links/types/create_payment_link_request.rb new file mode 100644 index 000000000..1fa939ef3 --- /dev/null +++ b/lib/square/checkout/payment_links/types/create_payment_link_request.rb @@ -0,0 +1,19 @@ + +module Square + module Checkout + module PaymentLinks + module Types + class CreatePaymentLinkRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :quick_pay, Square::Types::QuickPay, optional: true, nullable: false + field :order, Square::Types::Order, optional: true, nullable: false + field :checkout_options, Square::Types::CheckoutOptions, optional: true, nullable: false + field :pre_populated_data, Square::Types::PrePopulatedData, optional: true, nullable: false + field :payment_note, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/checkout/payment_links/types/delete_payment_links_request.rb b/lib/square/checkout/payment_links/types/delete_payment_links_request.rb new file mode 100644 index 000000000..f9fedb1b7 --- /dev/null +++ b/lib/square/checkout/payment_links/types/delete_payment_links_request.rb @@ -0,0 +1,13 @@ + +module Square + module Checkout + module PaymentLinks + module Types + class DeletePaymentLinksRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/checkout/payment_links/types/get_payment_links_request.rb b/lib/square/checkout/payment_links/types/get_payment_links_request.rb new file mode 100644 index 000000000..60036564c --- /dev/null +++ b/lib/square/checkout/payment_links/types/get_payment_links_request.rb @@ -0,0 +1,13 @@ + +module Square + module Checkout + module PaymentLinks + module Types + class GetPaymentLinksRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/checkout/payment_links/types/list_payment_links_request.rb b/lib/square/checkout/payment_links/types/list_payment_links_request.rb new file mode 100644 index 000000000..1a08d510c --- /dev/null +++ b/lib/square/checkout/payment_links/types/list_payment_links_request.rb @@ -0,0 +1,14 @@ + +module Square + module Checkout + module PaymentLinks + module Types + class ListPaymentLinksRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/checkout/payment_links/types/update_payment_link_request.rb b/lib/square/checkout/payment_links/types/update_payment_link_request.rb new file mode 100644 index 000000000..046d83b4a --- /dev/null +++ b/lib/square/checkout/payment_links/types/update_payment_link_request.rb @@ -0,0 +1,14 @@ + +module Square + module Checkout + module PaymentLinks + module Types + class UpdatePaymentLinkRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :payment_link, Square::Types::PaymentLink, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/checkout/types/retrieve_location_settings_request.rb b/lib/square/checkout/types/retrieve_location_settings_request.rb new file mode 100644 index 000000000..41e6a7d4f --- /dev/null +++ b/lib/square/checkout/types/retrieve_location_settings_request.rb @@ -0,0 +1,11 @@ + +module Square + module Checkout + module Types + class RetrieveLocationSettingsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/checkout/types/update_location_settings_request.rb b/lib/square/checkout/types/update_location_settings_request.rb new file mode 100644 index 000000000..39144b0c2 --- /dev/null +++ b/lib/square/checkout/types/update_location_settings_request.rb @@ -0,0 +1,12 @@ + +module Square + module Checkout + module Types + class UpdateLocationSettingsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :location_settings, Square::Types::CheckoutLocationSettings, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/checkout/types/update_merchant_settings_request.rb b/lib/square/checkout/types/update_merchant_settings_request.rb new file mode 100644 index 000000000..919b27e30 --- /dev/null +++ b/lib/square/checkout/types/update_merchant_settings_request.rb @@ -0,0 +1,11 @@ + +module Square + module Checkout + module Types + class UpdateMerchantSettingsRequest < Internal::Types::Model + field :merchant_settings, Square::Types::CheckoutMerchantSettings, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/client.rb b/lib/square/client.rb new file mode 100644 index 000000000..4140dc64c --- /dev/null +++ b/lib/square/client.rb @@ -0,0 +1,152 @@ + + +module Square + class Client + # @return [Square::Client] + def initialize(base_url:, token: ENV.fetch("SQUARE_TOKEN", nil)) + @raw_client = Square::Internal::Http::RawClient.new( + base_url: base_url, + headers: { + 'X-Fern-Language':'Ruby', + Authorization:"Bearer #{token}" + } + ) + end + # @return [Square::Mobile::Client] + def mobile + @mobile ||= Square::Mobile::Client.new(client: @raw_client) + end + # @return [Square::OAuth::Client] + def oAuth + @oAuth ||= Square::OAuth::Client.new(client: @raw_client) + end + # @return [Square::V1Transactions::Client] + def v1Transactions + @v1Transactions ||= Square::V1Transactions::Client.new(client: @raw_client) + end + # @return [Square::ApplePay::Client] + def applePay + @applePay ||= Square::ApplePay::Client.new(client: @raw_client) + end + # @return [Square::BankAccounts::Client] + def bankAccounts + @bankAccounts ||= Square::BankAccounts::Client.new(client: @raw_client) + end + # @return [Square::Bookings::Client] + def bookings + @bookings ||= Square::Bookings::Client.new(client: @raw_client) + end + # @return [Square::Cards::Client] + def cards + @cards ||= Square::Cards::Client.new(client: @raw_client) + end + # @return [Square::Catalog::Client] + def catalog + @catalog ||= Square::Catalog::Client.new(client: @raw_client) + end + # @return [Square::Customers::Client] + def customers + @customers ||= Square::Customers::Client.new(client: @raw_client) + end + # @return [Square::Devices::Client] + def devices + @devices ||= Square::Devices::Client.new(client: @raw_client) + end + # @return [Square::Disputes::Client] + def disputes + @disputes ||= Square::Disputes::Client.new(client: @raw_client) + end + # @return [Square::Employees::Client] + def employees + @employees ||= Square::Employees::Client.new(client: @raw_client) + end + # @return [Square::Events::Client] + def events + @events ||= Square::Events::Client.new(client: @raw_client) + end + # @return [Square::GiftCards::Client] + def giftCards + @giftCards ||= Square::GiftCards::Client.new(client: @raw_client) + end + # @return [Square::Inventory::Client] + def inventory + @inventory ||= Square::Inventory::Client.new(client: @raw_client) + end + # @return [Square::Invoices::Client] + def invoices + @invoices ||= Square::Invoices::Client.new(client: @raw_client) + end + # @return [Square::Labor::Client] + def labor + @labor ||= Square::Labor::Client.new(client: @raw_client) + end + # @return [Square::Locations::Client] + def locations + @locations ||= Square::Locations::Client.new(client: @raw_client) + end + # @return [Square::Loyalty::Client] + def loyalty + @loyalty ||= Square::Loyalty::Client.new(client: @raw_client) + end + # @return [Square::Merchants::Client] + def merchants + @merchants ||= Square::Merchants::Client.new(client: @raw_client) + end + # @return [Square::Checkout::Client] + def checkout + @checkout ||= Square::Checkout::Client.new(client: @raw_client) + end + # @return [Square::Orders::Client] + def orders + @orders ||= Square::Orders::Client.new(client: @raw_client) + end + # @return [Square::Payments::Client] + def payments + @payments ||= Square::Payments::Client.new(client: @raw_client) + end + # @return [Square::Payouts::Client] + def payouts + @payouts ||= Square::Payouts::Client.new(client: @raw_client) + end + # @return [Square::Refunds::Client] + def refunds + @refunds ||= Square::Refunds::Client.new(client: @raw_client) + end + # @return [Square::Sites::Client] + def sites + @sites ||= Square::Sites::Client.new(client: @raw_client) + end + # @return [Square::Snippets::Client] + def snippets + @snippets ||= Square::Snippets::Client.new(client: @raw_client) + end + # @return [Square::Subscriptions::Client] + def subscriptions + @subscriptions ||= Square::Subscriptions::Client.new(client: @raw_client) + end + # @return [Square::TeamMembers::Client] + def teamMembers + @teamMembers ||= Square::TeamMembers::Client.new(client: @raw_client) + end + # @return [Square::Team::Client] + def team + @team ||= Square::Team::Client.new(client: @raw_client) + end + # @return [Square::Terminal::Client] + def terminal + @terminal ||= Square::Terminal::Client.new(client: @raw_client) + end + # @return [Square::Vendors::Client] + def vendors + @vendors ||= Square::Vendors::Client.new(client: @raw_client) + end + # @return [Square::CashDrawers::Client] + def cashDrawers + @cashDrawers ||= Square::CashDrawers::Client.new(client: @raw_client) + end + # @return [Square::Webhooks::Client] + def webhooks + @webhooks ||= Square::Webhooks::Client.new(client: @raw_client) + end + end +end diff --git a/lib/square/customers/cards/client.rb b/lib/square/customers/cards/client.rb new file mode 100644 index 000000000..399da0833 --- /dev/null +++ b/lib/square/customers/cards/client.rb @@ -0,0 +1,46 @@ + +module Square + module Customers + module Cards + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::Cards::Client] + def initialize(client) + @client = client + end + + # Adds a card on file to an existing customer. + # + # As with charges, calls to `CreateCustomerCard` are idempotent. Multiple + # calls with the same card nonce return the same card record that was created + # with the provided nonce during the _first_ call. + # + # @return [Square::Types::CreateCustomerCardResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCustomerCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Removes a card on file from a customer. + # + # @return [Square::Types::DeleteCustomerCardResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCustomerCardResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/customers/cards/types/create_customer_card_request.rb b/lib/square/customers/cards/types/create_customer_card_request.rb new file mode 100644 index 000000000..00a7b2ddb --- /dev/null +++ b/lib/square/customers/cards/types/create_customer_card_request.rb @@ -0,0 +1,17 @@ + +module Square + module Customers + module Cards + module Types + class CreateCustomerCardRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :card_nonce, String, optional: false, nullable: false + field :billing_address, Square::Types::Address, optional: true, nullable: false + field :cardholder_name, String, optional: true, nullable: false + field :verification_token, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/cards/types/delete_cards_request.rb b/lib/square/customers/cards/types/delete_cards_request.rb new file mode 100644 index 000000000..00443ae3a --- /dev/null +++ b/lib/square/customers/cards/types/delete_cards_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Cards + module Types + class DeleteCardsRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :card_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/client.rb b/lib/square/customers/client.rb new file mode 100644 index 000000000..06549bef6 --- /dev/null +++ b/lib/square/customers/client.rb @@ -0,0 +1,186 @@ + +module Square + module Customers + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::Client] + def initialize(client) + @client = client + end + + # Lists customer profiles associated with a Square account. + # + # Under normal operating conditions, newly created or updated customer profiles become available + # for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + # profiles can take closer to one minute or longer, especially during network incidents and outages. + # + # @return [Square::Types::ListCustomersResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a new customer for a business. + # + # You must provide at least one of the following values in your request to this + # endpoint: + # + # - `given_name` + # - `family_name` + # - `company_name` + # - `email_address` + # - `phone_number` + # + # @return [Square::Types::CreateCustomerResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates multiple [customer profiles](entity:Customer) for a business. + # + # This endpoint takes a map of individual create requests and returns a map of responses. + # + # You must provide at least one of the following values in each create request: + # + # - `given_name` + # - `family_name` + # - `company_name` + # - `email_address` + # - `phone_number` + # + # @return [Square::Types::BulkCreateCustomersResponse] + def batch_create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkCreateCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes multiple customer profiles. + # + # The endpoint takes a list of customer IDs and returns a map of responses. + # + # @return [Square::Types::BulkDeleteCustomersResponse] + def bulk_delete_customers(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkDeleteCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves multiple customer profiles. + # + # This endpoint takes a list of customer IDs and returns a map of responses. + # + # @return [Square::Types::BulkRetrieveCustomersResponse] + def bulk_retrieve_customers(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkRetrieveCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates multiple customer profiles. + # + # This endpoint takes a map of individual update requests and returns a map of responses. + # + # @return [Square::Types::BulkUpdateCustomersResponse] + def bulk_update_customers(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkUpdateCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches the customer profiles associated with a Square account using one or more supported query filters. + # + # Calling `SearchCustomers` without any explicit query filter returns all + # customer profiles ordered alphabetically based on `given_name` and + # `family_name`. + # + # Under normal operating conditions, newly created or updated customer profiles become available + # for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + # profiles can take closer to one minute or longer, especially during network incidents and outages. + # + # @return [Square::Types::SearchCustomersResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchCustomersResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns details for a single customer. + # + # @return [Square::Types::GetCustomerResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request. + # To add or update a field, specify the new value. To remove a field, specify `null`. + # + # To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + # + # @return [Square::Types::UpdateCustomerResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a customer profile from a business. + # + # To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile. + # + # @return [Square::Types::DeleteCustomerResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/client.rb b/lib/square/customers/custom_attribute_definitions/client.rb new file mode 100644 index 000000000..9d555fe92 --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/client.rb @@ -0,0 +1,137 @@ + +module Square + module Customers + module CustomAttributeDefinitions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::CustomAttributeDefinitions::Client] + def initialize(client) + @client = client + end + + # Lists the customer-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + # + # When all response pages are retrieved, the results include all custom attribute definitions + # that are visible to the requesting application, including those that are created by other + # applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that + # seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListCustomerCustomAttributeDefinitionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCustomerCustomAttributeDefinitionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # Use this endpoint to define a custom attribute that can be associated with customer profiles. + # + # A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + # for a custom attribute. After the definition is created, you can call + # [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) or + # [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) + # to set the custom attribute for customer profiles in the seller's Customer Directory. + # + # Sellers can view all custom attributes in exported customer data, including those set to + # `VISIBILITY_HIDDEN`. + # + # @return [Square::Types::CreateCustomerCustomAttributeDefinitionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCustomerCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # + # To retrieve a custom attribute definition created by another application, the `visibility` + # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::GetCustomerCustomAttributeDefinitionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCustomerCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a customer-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # + # Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + # `schema` for a `Selection` data type. + # + # Only the definition owner can update a custom attribute definition. Note that sellers can view + # all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + # + # @return [Square::Types::UpdateCustomerCustomAttributeDefinitionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateCustomerCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a customer-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # + # Deleting a custom attribute definition also deletes the corresponding custom attribute from + # all customer profiles in the seller's Customer Directory. + # + # Only the definition owner can delete a custom attribute definition. + # + # @return [Square::Types::DeleteCustomerCustomAttributeDefinitionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCustomerCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates [custom attributes](entity:CustomAttribute) for customer profiles as a bulk operation. + # + # Use this endpoint to set the value of one or more custom attributes for one or more customer profiles. + # A custom attribute is based on a custom attribute definition in a Square seller account, which is + # created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + # + # This `BulkUpsertCustomerCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + # requests and returns a map of individual upsert responses. Each upsert request has a unique ID + # and provides a customer ID and custom attribute. Each upsert response is returned with the ID + # of the corresponding request. + # + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BatchUpsertCustomerCustomAttributesResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchUpsertCustomerCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request.rb b/lib/square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request.rb new file mode 100644 index 000000000..aafaf32cc --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/batch_upsert_customer_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class BatchUpsertCustomerCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request.rb b/lib/square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request.rb new file mode 100644 index 000000000..8db3c29a8 --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/create_customer_custom_attribute_definition_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class CreateCustomerCustomAttributeDefinitionRequest < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb b/lib/square/customers/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..7a2dcaf15 --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class DeleteCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb b/lib/square/customers/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..d44d53be1 --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class GetCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb b/lib/square/customers/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..87a5fa063 --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class ListCustomAttributeDefinitionsRequest < Internal::Types::Model + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request.rb b/lib/square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request.rb new file mode 100644 index 000000000..6bea9614d --- /dev/null +++ b/lib/square/customers/custom_attribute_definitions/types/update_customer_custom_attribute_definition_request.rb @@ -0,0 +1,15 @@ + +module Square + module Customers + module CustomAttributeDefinitions + module Types + class UpdateCustomerCustomAttributeDefinitionRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attributes/client.rb b/lib/square/customers/custom_attributes/client.rb new file mode 100644 index 000000000..5739ab53c --- /dev/null +++ b/lib/square/customers/custom_attributes/client.rb @@ -0,0 +1,94 @@ + +module Square + module Customers + module CustomAttributes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::CustomAttributes::Client] + def initialize(client) + @client = client + end + + # Lists the [custom attributes](entity:CustomAttribute) associated with a customer profile. + # + # You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + # in the same call. + # + # When all response pages are retrieved, the results include all custom attributes that are + # visible to the requesting application, including those that are owned by other applications + # and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListCustomerCustomAttributesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCustomerCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a [custom attribute](entity:CustomAttribute) associated with a customer profile. + # + # You can use the `with_definition` query parameter to also retrieve the custom attribute definition + # in the same call. + # + # To retrieve a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::GetCustomerCustomAttributeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCustomerCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates a [custom attribute](entity:CustomAttribute) for a customer profile. + # + # Use this endpoint to set the value of a custom attribute for a specified customer profile. + # A custom attribute is based on a custom attribute definition in a Square seller account, which + # is created using the [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) endpoint. + # + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::UpsertCustomerCustomAttributeResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertCustomerCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + # + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::DeleteCustomerCustomAttributeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCustomerCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/customers/custom_attributes/types/delete_custom_attributes_request.rb b/lib/square/customers/custom_attributes/types/delete_custom_attributes_request.rb new file mode 100644 index 000000000..f7331fc7e --- /dev/null +++ b/lib/square/customers/custom_attributes/types/delete_custom_attributes_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module CustomAttributes + module Types + class DeleteCustomAttributesRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attributes/types/get_custom_attributes_request.rb b/lib/square/customers/custom_attributes/types/get_custom_attributes_request.rb new file mode 100644 index 000000000..67aeeb152 --- /dev/null +++ b/lib/square/customers/custom_attributes/types/get_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Customers + module CustomAttributes + module Types + class GetCustomAttributesRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :with_definition, Internal::Types::Boolean, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attributes/types/list_custom_attributes_request.rb b/lib/square/customers/custom_attributes/types/list_custom_attributes_request.rb new file mode 100644 index 000000000..9d9bfb2a7 --- /dev/null +++ b/lib/square/customers/custom_attributes/types/list_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Customers + module CustomAttributes + module Types + class ListCustomAttributesRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :with_definitions, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/custom_attributes/types/upsert_customer_custom_attribute_request.rb b/lib/square/customers/custom_attributes/types/upsert_customer_custom_attribute_request.rb new file mode 100644 index 000000000..7214e5089 --- /dev/null +++ b/lib/square/customers/custom_attributes/types/upsert_customer_custom_attribute_request.rb @@ -0,0 +1,16 @@ + +module Square + module Customers + module CustomAttributes + module Types + class UpsertCustomerCustomAttributeRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/client.rb b/lib/square/customers/groups/client.rb new file mode 100644 index 000000000..f2446a1c0 --- /dev/null +++ b/lib/square/customers/groups/client.rb @@ -0,0 +1,115 @@ + +module Square + module Customers + module Groups + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::Groups::Client] + def initialize(client) + @client = client + end + + # Retrieves the list of customer groups of a business. + # + # @return [Square::Types::ListCustomerGroupsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCustomerGroupsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a new customer group for a business. + # + # The request must include the `name` value of the group. + # + # @return [Square::Types::CreateCustomerGroupResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCustomerGroupResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a specific customer group as identified by the `group_id` value. + # + # @return [Square::Types::GetCustomerGroupResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCustomerGroupResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a customer group as identified by the `group_id` value. + # + # @return [Square::Types::UpdateCustomerGroupResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateCustomerGroupResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a customer group as identified by the `group_id` value. + # + # @return [Square::Types::DeleteCustomerGroupResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteCustomerGroupResponse.load(_response.body) + else + raise _response.body + end + end + + # Adds a group membership to a customer. + # + # The customer is identified by the `customer_id` value + # and the customer group is identified by the `group_id` value. + # + # @return [Square::Types::AddGroupToCustomerResponse] + def add(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::AddGroupToCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + # Removes a group membership from a customer. + # + # The customer is identified by the `customer_id` value + # and the customer group is identified by the `group_id` value. + # + # @return [Square::Types::RemoveGroupFromCustomerResponse] + def remove(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RemoveGroupFromCustomerResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/customers/groups/types/add_groups_request.rb b/lib/square/customers/groups/types/add_groups_request.rb new file mode 100644 index 000000000..2ad98cb2c --- /dev/null +++ b/lib/square/customers/groups/types/add_groups_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Groups + module Types + class AddGroupsRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :group_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/create_customer_group_request.rb b/lib/square/customers/groups/types/create_customer_group_request.rb new file mode 100644 index 000000000..274870d2e --- /dev/null +++ b/lib/square/customers/groups/types/create_customer_group_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Groups + module Types + class CreateCustomerGroupRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :group, Square::Types::CustomerGroup, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/delete_groups_request.rb b/lib/square/customers/groups/types/delete_groups_request.rb new file mode 100644 index 000000000..83a9219d5 --- /dev/null +++ b/lib/square/customers/groups/types/delete_groups_request.rb @@ -0,0 +1,13 @@ + +module Square + module Customers + module Groups + module Types + class DeleteGroupsRequest < Internal::Types::Model + field :group_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/get_groups_request.rb b/lib/square/customers/groups/types/get_groups_request.rb new file mode 100644 index 000000000..ef805964b --- /dev/null +++ b/lib/square/customers/groups/types/get_groups_request.rb @@ -0,0 +1,13 @@ + +module Square + module Customers + module Groups + module Types + class GetGroupsRequest < Internal::Types::Model + field :group_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/list_groups_request.rb b/lib/square/customers/groups/types/list_groups_request.rb new file mode 100644 index 000000000..709587316 --- /dev/null +++ b/lib/square/customers/groups/types/list_groups_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Groups + module Types + class ListGroupsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/remove_groups_request.rb b/lib/square/customers/groups/types/remove_groups_request.rb new file mode 100644 index 000000000..db29d8ad9 --- /dev/null +++ b/lib/square/customers/groups/types/remove_groups_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Groups + module Types + class RemoveGroupsRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :group_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/groups/types/update_customer_group_request.rb b/lib/square/customers/groups/types/update_customer_group_request.rb new file mode 100644 index 000000000..1eb38dda0 --- /dev/null +++ b/lib/square/customers/groups/types/update_customer_group_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Groups + module Types + class UpdateCustomerGroupRequest < Internal::Types::Model + field :group_id, String, optional: false, nullable: false + field :group, Square::Types::CustomerGroup, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/segments/client.rb b/lib/square/customers/segments/client.rb new file mode 100644 index 000000000..531806097 --- /dev/null +++ b/lib/square/customers/segments/client.rb @@ -0,0 +1,42 @@ + +module Square + module Customers + module Segments + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Customers::Segments::Client] + def initialize(client) + @client = client + end + + # Retrieves the list of customer segments of a business. + # + # @return [Square::Types::ListCustomerSegmentsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListCustomerSegmentsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a specific customer segment as identified by the `segment_id` value. + # + # @return [Square::Types::GetCustomerSegmentResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetCustomerSegmentResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/customers/segments/types/get_segments_request.rb b/lib/square/customers/segments/types/get_segments_request.rb new file mode 100644 index 000000000..31fce5091 --- /dev/null +++ b/lib/square/customers/segments/types/get_segments_request.rb @@ -0,0 +1,13 @@ + +module Square + module Customers + module Segments + module Types + class GetSegmentsRequest < Internal::Types::Model + field :segment_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/segments/types/list_segments_request.rb b/lib/square/customers/segments/types/list_segments_request.rb new file mode 100644 index 000000000..445f3010e --- /dev/null +++ b/lib/square/customers/segments/types/list_segments_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Segments + module Types + class ListSegmentsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/customers/types/bulk_create_customers_request.rb b/lib/square/customers/types/bulk_create_customers_request.rb new file mode 100644 index 000000000..db730c890 --- /dev/null +++ b/lib/square/customers/types/bulk_create_customers_request.rb @@ -0,0 +1,11 @@ + +module Square + module Customers + module Types + class BulkCreateCustomersRequest < Internal::Types::Model + field :customers, Internal::Types::Hash[String, Square::Types::BulkCreateCustomerData], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/bulk_delete_customers_request.rb b/lib/square/customers/types/bulk_delete_customers_request.rb new file mode 100644 index 000000000..7ee99f847 --- /dev/null +++ b/lib/square/customers/types/bulk_delete_customers_request.rb @@ -0,0 +1,11 @@ + +module Square + module Customers + module Types + class BulkDeleteCustomersRequest < Internal::Types::Model + field :customer_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/bulk_retrieve_customers_request.rb b/lib/square/customers/types/bulk_retrieve_customers_request.rb new file mode 100644 index 000000000..f7b198a9e --- /dev/null +++ b/lib/square/customers/types/bulk_retrieve_customers_request.rb @@ -0,0 +1,11 @@ + +module Square + module Customers + module Types + class BulkRetrieveCustomersRequest < Internal::Types::Model + field :customer_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/bulk_update_customers_request.rb b/lib/square/customers/types/bulk_update_customers_request.rb new file mode 100644 index 000000000..a4c609eab --- /dev/null +++ b/lib/square/customers/types/bulk_update_customers_request.rb @@ -0,0 +1,11 @@ + +module Square + module Customers + module Types + class BulkUpdateCustomersRequest < Internal::Types::Model + field :customers, Internal::Types::Hash[String, Square::Types::BulkUpdateCustomerData], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/create_customer_request.rb b/lib/square/customers/types/create_customer_request.rb new file mode 100644 index 000000000..001183610 --- /dev/null +++ b/lib/square/customers/types/create_customer_request.rb @@ -0,0 +1,22 @@ + +module Square + module Customers + module Types + class CreateCustomerRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :nickname, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :birthday, String, optional: true, nullable: false + field :tax_ids, Square::Types::CustomerTaxIds, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/delete_customers_request.rb b/lib/square/customers/types/delete_customers_request.rb new file mode 100644 index 000000000..2988123d7 --- /dev/null +++ b/lib/square/customers/types/delete_customers_request.rb @@ -0,0 +1,12 @@ + +module Square + module Customers + module Types + class DeleteCustomersRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/get_customers_request.rb b/lib/square/customers/types/get_customers_request.rb new file mode 100644 index 000000000..358c55fcc --- /dev/null +++ b/lib/square/customers/types/get_customers_request.rb @@ -0,0 +1,11 @@ + +module Square + module Customers + module Types + class GetCustomersRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/list_customers_request.rb b/lib/square/customers/types/list_customers_request.rb new file mode 100644 index 000000000..230ab3bb9 --- /dev/null +++ b/lib/square/customers/types/list_customers_request.rb @@ -0,0 +1,15 @@ + +module Square + module Customers + module Types + class ListCustomersRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :sort_field, Square::Types::CustomerSortField, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :count, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/search_customers_request.rb b/lib/square/customers/types/search_customers_request.rb new file mode 100644 index 000000000..96257bd70 --- /dev/null +++ b/lib/square/customers/types/search_customers_request.rb @@ -0,0 +1,14 @@ + +module Square + module Customers + module Types + class SearchCustomersRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :query, Square::Types::CustomerQuery, optional: true, nullable: false + field :count, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/customers/types/update_customer_request.rb b/lib/square/customers/types/update_customer_request.rb new file mode 100644 index 000000000..a9e64a454 --- /dev/null +++ b/lib/square/customers/types/update_customer_request.rb @@ -0,0 +1,23 @@ + +module Square + module Customers + module Types + class UpdateCustomerRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :nickname, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :birthday, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :tax_ids, Square::Types::CustomerTaxIds, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/devices/client.rb b/lib/square/devices/client.rb new file mode 100644 index 000000000..cbf36237b --- /dev/null +++ b/lib/square/devices/client.rb @@ -0,0 +1,41 @@ + +module Square + module Devices + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Devices::Client] + def initialize(client) + @client = client + end + + # List devices associated with the merchant. Currently, only Terminal API + # devices are supported. + # + # @return [Square::Types::ListDevicesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListDevicesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves Device with the associated `device_id`. + # + # @return [Square::Types::GetDeviceResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetDeviceResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/devices/codes/client.rb b/lib/square/devices/codes/client.rb new file mode 100644 index 000000000..960495e64 --- /dev/null +++ b/lib/square/devices/codes/client.rb @@ -0,0 +1,56 @@ + +module Square + module Devices + module Codes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Devices::Codes::Client] + def initialize(client) + @client = client + end + + # Lists all DeviceCodes associated with the merchant. + # + # @return [Square::Types::ListDeviceCodesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListDeviceCodesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected + # terminal mode. + # + # @return [Square::Types::CreateDeviceCodeResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateDeviceCodeResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves DeviceCode with the associated ID. + # + # @return [Square::Types::GetDeviceCodeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetDeviceCodeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/devices/codes/types/create_device_code_request.rb b/lib/square/devices/codes/types/create_device_code_request.rb new file mode 100644 index 000000000..9c36b2580 --- /dev/null +++ b/lib/square/devices/codes/types/create_device_code_request.rb @@ -0,0 +1,14 @@ + +module Square + module Devices + module Codes + module Types + class CreateDeviceCodeRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :device_code, Square::Types::DeviceCode, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/devices/codes/types/get_codes_request.rb b/lib/square/devices/codes/types/get_codes_request.rb new file mode 100644 index 000000000..3d482d128 --- /dev/null +++ b/lib/square/devices/codes/types/get_codes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Devices + module Codes + module Types + class GetCodesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/devices/codes/types/list_codes_request.rb b/lib/square/devices/codes/types/list_codes_request.rb new file mode 100644 index 000000000..0e56cc400 --- /dev/null +++ b/lib/square/devices/codes/types/list_codes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Devices + module Codes + module Types + class ListCodesRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :product_type, String, optional: true, nullable: false + field :status, Square::Types::DeviceCodeStatus, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/devices/types/get_devices_request.rb b/lib/square/devices/types/get_devices_request.rb new file mode 100644 index 000000000..9ef45ee70 --- /dev/null +++ b/lib/square/devices/types/get_devices_request.rb @@ -0,0 +1,11 @@ + +module Square + module Devices + module Types + class GetDevicesRequest < Internal::Types::Model + field :device_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/devices/types/list_devices_request.rb b/lib/square/devices/types/list_devices_request.rb new file mode 100644 index 000000000..61f0f0d08 --- /dev/null +++ b/lib/square/devices/types/list_devices_request.rb @@ -0,0 +1,14 @@ + +module Square + module Devices + module Types + class ListDevicesRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/client.rb b/lib/square/disputes/client.rb new file mode 100644 index 000000000..2c79dc0bd --- /dev/null +++ b/lib/square/disputes/client.rb @@ -0,0 +1,103 @@ + +module Square + module Disputes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Disputes::Client] + def initialize(client) + @client = client + end + + # Returns a list of disputes associated with a particular account. + # + # @return [Square::Types::ListDisputesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListDisputesResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns details about a specific dispute. + # + # @return [Square::Types::GetDisputeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetDisputeResponse.load(_response.body) + else + raise _response.body + end + end + + # Accepts the loss on a dispute. Square returns the disputed amount to the cardholder and + # updates the dispute state to ACCEPTED. + # + # Square debits the disputed amount from the seller’s Square account. If the Square account + # does not have sufficient funds, Square debits the associated bank account. + # + # @return [Square::Types::AcceptDisputeResponse] + def accept(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::AcceptDisputeResponse.load(_response.body) + else + raise _response.body + end + end + + # Uploads a file to use as evidence in a dispute challenge. The endpoint accepts HTTP + # multipart/form-data file uploads in HEIC, HEIF, JPEG, PDF, PNG, and TIFF formats. + # + # @return [Square::Types::CreateDisputeEvidenceFileResponse] + def create_evidence_file(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateDisputeEvidenceFileResponse.load(_response.body) + else + raise _response.body + end + end + + # Uploads text to use as evidence for a dispute challenge. + # + # @return [Square::Types::CreateDisputeEvidenceTextResponse] + def create_evidence_text(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateDisputeEvidenceTextResponse.load(_response.body) + else + raise _response.body + end + end + + # Submits evidence to the cardholder's bank. + # + # The evidence submitted by this endpoint includes evidence uploaded + # using the [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) and + # [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText) endpoints and + # evidence automatically provided by Square, when available. Evidence cannot be removed from + # a dispute after submission. + # + # @return [Square::Types::SubmitEvidenceResponse] + def submit_evidence(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SubmitEvidenceResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/disputes/evidence/client.rb b/lib/square/disputes/evidence/client.rb new file mode 100644 index 000000000..d8daa07c1 --- /dev/null +++ b/lib/square/disputes/evidence/client.rb @@ -0,0 +1,58 @@ + +module Square + module Disputes + module Evidence + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Disputes::Evidence::Client] + def initialize(client) + @client = client + end + + # Returns a list of evidence associated with a dispute. + # + # @return [Square::Types::ListDisputeEvidenceResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListDisputeEvidenceResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns the metadata for the evidence specified in the request URL path. + # + # You must maintain a copy of any evidence uploaded if you want to reference it later. Evidence cannot be downloaded after you upload it. + # + # @return [Square::Types::GetDisputeEvidenceResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetDisputeEvidenceResponse.load(_response.body) + else + raise _response.body + end + end + + # Removes specified evidence from a dispute. + # Square does not send the bank any evidence that is removed. + # + # @return [Square::Types::DeleteDisputeEvidenceResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteDisputeEvidenceResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/disputes/evidence/types/delete_evidence_request.rb b/lib/square/disputes/evidence/types/delete_evidence_request.rb new file mode 100644 index 000000000..7cb4679e2 --- /dev/null +++ b/lib/square/disputes/evidence/types/delete_evidence_request.rb @@ -0,0 +1,14 @@ + +module Square + module Disputes + module Evidence + module Types + class DeleteEvidenceRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + field :evidence_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/disputes/evidence/types/get_evidence_request.rb b/lib/square/disputes/evidence/types/get_evidence_request.rb new file mode 100644 index 000000000..61f38a339 --- /dev/null +++ b/lib/square/disputes/evidence/types/get_evidence_request.rb @@ -0,0 +1,14 @@ + +module Square + module Disputes + module Evidence + module Types + class GetEvidenceRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + field :evidence_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/disputes/evidence/types/list_evidence_request.rb b/lib/square/disputes/evidence/types/list_evidence_request.rb new file mode 100644 index 000000000..07683a95f --- /dev/null +++ b/lib/square/disputes/evidence/types/list_evidence_request.rb @@ -0,0 +1,14 @@ + +module Square + module Disputes + module Evidence + module Types + class ListEvidenceRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/disputes/types/accept_disputes_request.rb b/lib/square/disputes/types/accept_disputes_request.rb new file mode 100644 index 000000000..6d3c16b9b --- /dev/null +++ b/lib/square/disputes/types/accept_disputes_request.rb @@ -0,0 +1,11 @@ + +module Square + module Disputes + module Types + class AcceptDisputesRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/types/create_dispute_evidence_text_request.rb b/lib/square/disputes/types/create_dispute_evidence_text_request.rb new file mode 100644 index 000000000..e8db5e777 --- /dev/null +++ b/lib/square/disputes/types/create_dispute_evidence_text_request.rb @@ -0,0 +1,14 @@ + +module Square + module Disputes + module Types + class CreateDisputeEvidenceTextRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :evidence_type, Square::Types::DisputeEvidenceType, optional: true, nullable: false + field :evidence_text, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/types/create_evidence_file_disputes_request.rb b/lib/square/disputes/types/create_evidence_file_disputes_request.rb new file mode 100644 index 000000000..57c67e979 --- /dev/null +++ b/lib/square/disputes/types/create_evidence_file_disputes_request.rb @@ -0,0 +1,11 @@ + +module Square + module Disputes + module Types + class CreateEvidenceFileDisputesRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/types/get_disputes_request.rb b/lib/square/disputes/types/get_disputes_request.rb new file mode 100644 index 000000000..fe90c3c25 --- /dev/null +++ b/lib/square/disputes/types/get_disputes_request.rb @@ -0,0 +1,11 @@ + +module Square + module Disputes + module Types + class GetDisputesRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/types/list_disputes_request.rb b/lib/square/disputes/types/list_disputes_request.rb new file mode 100644 index 000000000..4469ebd70 --- /dev/null +++ b/lib/square/disputes/types/list_disputes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Disputes + module Types + class ListDisputesRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :states, Square::Types::DisputeState, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/disputes/types/submit_evidence_disputes_request.rb b/lib/square/disputes/types/submit_evidence_disputes_request.rb new file mode 100644 index 000000000..c48ab1054 --- /dev/null +++ b/lib/square/disputes/types/submit_evidence_disputes_request.rb @@ -0,0 +1,11 @@ + +module Square + module Disputes + module Types + class SubmitEvidenceDisputesRequest < Internal::Types::Model + field :dispute_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/employees/client.rb b/lib/square/employees/client.rb new file mode 100644 index 000000000..1b88f63f6 --- /dev/null +++ b/lib/square/employees/client.rb @@ -0,0 +1,36 @@ + +module Square + module Employees + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Employees::Client] + def initialize(client) + @client = client + end + + # @return [Square::Types::ListEmployeesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListEmployeesResponse.load(_response.body) + else + raise _response.body + end + end + + # @return [Square::Types::GetEmployeeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetEmployeeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/employees/types/get_employees_request.rb b/lib/square/employees/types/get_employees_request.rb new file mode 100644 index 000000000..2b4ec7887 --- /dev/null +++ b/lib/square/employees/types/get_employees_request.rb @@ -0,0 +1,11 @@ + +module Square + module Employees + module Types + class GetEmployeesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/employees/types/list_employees_request.rb b/lib/square/employees/types/list_employees_request.rb new file mode 100644 index 000000000..1898e7d07 --- /dev/null +++ b/lib/square/employees/types/list_employees_request.rb @@ -0,0 +1,14 @@ + +module Square + module Employees + module Types + class ListEmployeesRequest < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :status, Square::Types::EmployeeStatus, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/environment.rb b/lib/square/environment.rb new file mode 100644 index 000000000..19f045c04 --- /dev/null +++ b/lib/square/environment.rb @@ -0,0 +1,9 @@ + +module Square + class Environment + PRODUCTION = "https://connect.squareup.com" + SANDBOX = "https://connect.squareupsandbox.com" + + + end +end diff --git a/lib/square/events/client.rb b/lib/square/events/client.rb new file mode 100644 index 000000000..a511e28d2 --- /dev/null +++ b/lib/square/events/client.rb @@ -0,0 +1,68 @@ + +module Square + module Events + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Events::Client] + def initialize(client) + @client = client + end + + # Search for Square API events that occur within a 28-day timeframe. + # + # @return [Square::Types::SearchEventsResponse] + def search_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchEventsResponse.load(_response.body) + else + raise _response.body + end + end + + # Disables events to prevent them from being searchable. + # All events are disabled by default. You must enable events to make them searchable. + # Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later. + # + # @return [Square::Types::DisableEventsResponse] + def disable_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DisableEventsResponse.load(_response.body) + else + raise _response.body + end + end + + # Enables events to make them searchable. Only events that occur while in the enabled state are searchable. + # + # @return [Square::Types::EnableEventsResponse] + def enable_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::EnableEventsResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists all event types that you can subscribe to as webhooks or query using the Events API. + # + # @return [Square::Types::ListEventTypesResponse] + def list_event_types(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListEventTypesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/events/types/list_event_types_request.rb b/lib/square/events/types/list_event_types_request.rb new file mode 100644 index 000000000..f389573eb --- /dev/null +++ b/lib/square/events/types/list_event_types_request.rb @@ -0,0 +1,11 @@ + +module Square + module Events + module Types + class ListEventTypesRequest < Internal::Types::Model + field :api_version, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/events/types/search_events_request.rb b/lib/square/events/types/search_events_request.rb new file mode 100644 index 000000000..39345c14a --- /dev/null +++ b/lib/square/events/types/search_events_request.rb @@ -0,0 +1,13 @@ + +module Square + module Events + module Types + class SearchEventsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :query, Square::Types::SearchEventsQuery, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/activities/client.rb b/lib/square/gift_cards/activities/client.rb new file mode 100644 index 000000000..bbd286963 --- /dev/null +++ b/lib/square/gift_cards/activities/client.rb @@ -0,0 +1,46 @@ + +module Square + module GiftCards + module Activities + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::GiftCards::Activities::Client] + def initialize(client) + @client = client + end + + # Lists gift card activities. By default, you get gift card activities for all + # gift cards in the seller's account. You can optionally specify query parameters to + # filter the list. For example, you can get a list of gift card activities for a gift card, + # for all gift cards in a specific region, or for activities within a time window. + # + # @return [Square::Types::ListGiftCardActivitiesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListGiftCardActivitiesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a gift card activity to manage the balance or state of a [gift card](entity:GiftCard). + # For example, create an `ACTIVATE` activity to activate a gift card with an initial balance before first use. + # + # @return [Square::Types::CreateGiftCardActivityResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateGiftCardActivityResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/gift_cards/activities/types/create_gift_card_activity_request.rb b/lib/square/gift_cards/activities/types/create_gift_card_activity_request.rb new file mode 100644 index 000000000..8241bc462 --- /dev/null +++ b/lib/square/gift_cards/activities/types/create_gift_card_activity_request.rb @@ -0,0 +1,14 @@ + +module Square + module GiftCards + module Activities + module Types + class CreateGiftCardActivityRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :gift_card_activity, Square::Types::GiftCardActivity, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/gift_cards/activities/types/list_activities_request.rb b/lib/square/gift_cards/activities/types/list_activities_request.rb new file mode 100644 index 000000000..2cde4dd6f --- /dev/null +++ b/lib/square/gift_cards/activities/types/list_activities_request.rb @@ -0,0 +1,20 @@ + +module Square + module GiftCards + module Activities + module Types + class ListActivitiesRequest < Internal::Types::Model + field :gift_card_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :sort_order, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/gift_cards/client.rb b/lib/square/gift_cards/client.rb new file mode 100644 index 000000000..8476046ce --- /dev/null +++ b/lib/square/gift_cards/client.rb @@ -0,0 +1,110 @@ + +module Square + module GiftCards + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::GiftCards::Client] + def initialize(client) + @client = client + end + + # Lists all gift cards. You can specify optional filters to retrieve + # a subset of the gift cards. Results are sorted by `created_at` in ascending order. + # + # @return [Square::Types::ListGiftCardsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListGiftCardsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a digital gift card or registers a physical (plastic) gift card. The resulting gift card + # has a `PENDING` state. To activate a gift card so that it can be redeemed for purchases, call + # [CreateGiftCardActivity](api-endpoint:GiftCardActivities-CreateGiftCardActivity) and create an `ACTIVATE` + # activity with the initial balance. Alternatively, you can use [RefundPayment](api-endpoint:Refunds-RefundPayment) + # to refund a payment to the new gift card. + # + # @return [Square::Types::CreateGiftCardResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateGiftCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a gift card using the gift card account number (GAN). + # + # @return [Square::Types::GetGiftCardFromGanResponse] + def get_from_gan(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetGiftCardFromGanResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a gift card using a secure payment token that represents the gift card. + # + # @return [Square::Types::GetGiftCardFromNonceResponse] + def get_from_nonce(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetGiftCardFromNonceResponse.load(_response.body) + else + raise _response.body + end + end + + # Links a customer to a gift card, which is also referred to as adding a card on file. + # + # @return [Square::Types::LinkCustomerToGiftCardResponse] + def link_customer(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::LinkCustomerToGiftCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Unlinks a customer from a gift card, which is also referred to as removing a card on file. + # + # @return [Square::Types::UnlinkCustomerFromGiftCardResponse] + def unlink_customer(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UnlinkCustomerFromGiftCardResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a gift card using the gift card ID. + # + # @return [Square::Types::GetGiftCardResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetGiftCardResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/gift_cards/types/create_gift_card_request.rb b/lib/square/gift_cards/types/create_gift_card_request.rb new file mode 100644 index 000000000..8e314425a --- /dev/null +++ b/lib/square/gift_cards/types/create_gift_card_request.rb @@ -0,0 +1,13 @@ + +module Square + module GiftCards + module Types + class CreateGiftCardRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + field :gift_card, Square::Types::GiftCard, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/get_gift_card_from_gan_request.rb b/lib/square/gift_cards/types/get_gift_card_from_gan_request.rb new file mode 100644 index 000000000..3eebeb1d6 --- /dev/null +++ b/lib/square/gift_cards/types/get_gift_card_from_gan_request.rb @@ -0,0 +1,11 @@ + +module Square + module GiftCards + module Types + class GetGiftCardFromGanRequest < Internal::Types::Model + field :gan, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/get_gift_card_from_nonce_request.rb b/lib/square/gift_cards/types/get_gift_card_from_nonce_request.rb new file mode 100644 index 000000000..d1c975ceb --- /dev/null +++ b/lib/square/gift_cards/types/get_gift_card_from_nonce_request.rb @@ -0,0 +1,11 @@ + +module Square + module GiftCards + module Types + class GetGiftCardFromNonceRequest < Internal::Types::Model + field :nonce, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/get_gift_cards_request.rb b/lib/square/gift_cards/types/get_gift_cards_request.rb new file mode 100644 index 000000000..0b1bf1b40 --- /dev/null +++ b/lib/square/gift_cards/types/get_gift_cards_request.rb @@ -0,0 +1,11 @@ + +module Square + module GiftCards + module Types + class GetGiftCardsRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/link_customer_to_gift_card_request.rb b/lib/square/gift_cards/types/link_customer_to_gift_card_request.rb new file mode 100644 index 000000000..1b0212900 --- /dev/null +++ b/lib/square/gift_cards/types/link_customer_to_gift_card_request.rb @@ -0,0 +1,12 @@ + +module Square + module GiftCards + module Types + class LinkCustomerToGiftCardRequest < Internal::Types::Model + field :gift_card_id, String, optional: false, nullable: false + field :customer_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/list_gift_cards_request.rb b/lib/square/gift_cards/types/list_gift_cards_request.rb new file mode 100644 index 000000000..ab68a7fc2 --- /dev/null +++ b/lib/square/gift_cards/types/list_gift_cards_request.rb @@ -0,0 +1,15 @@ + +module Square + module GiftCards + module Types + class ListGiftCardsRequest < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :state, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/gift_cards/types/unlink_customer_from_gift_card_request.rb b/lib/square/gift_cards/types/unlink_customer_from_gift_card_request.rb new file mode 100644 index 000000000..1f77cf03e --- /dev/null +++ b/lib/square/gift_cards/types/unlink_customer_from_gift_card_request.rb @@ -0,0 +1,12 @@ + +module Square + module GiftCards + module Types + class UnlinkCustomerFromGiftCardRequest < Internal::Types::Model + field :gift_card_id, String, optional: false, nullable: false + field :customer_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/internal/errors/constraint_error.rb b/lib/square/internal/errors/constraint_error.rb new file mode 100644 index 000000000..1def656aa --- /dev/null +++ b/lib/square/internal/errors/constraint_error.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Internal + module Errors + class ConstraintError < StandardError + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/errors/type_error.rb b/lib/square/internal/errors/type_error.rb new file mode 100644 index 000000000..c72468ba5 --- /dev/null +++ b/lib/square/internal/errors/type_error.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Internal + module Errors + class TypeError < StandardError + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/http/base_request.rb b/lib/square/internal/http/base_request.rb new file mode 100644 index 000000000..60036951e --- /dev/null +++ b/lib/square/internal/http/base_request.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Square + module Internal + module Http + # @api private + class BaseRequest + attr_reader :base_url, :path, :method, :headers, :query, :request_options + + # @param base_url [String] The base URL for the request + # @param path [String] The path for the request + # @param method [String] The HTTP method for the request (:get, :post, etc.) + # @param headers [Hash] Additional headers for the request (optional) + # @param query [Hash] Query parameters for the request (optional) + # @param request_options [Square::RequestOptions, Hash{Symbol=>Object}, nil] + def initialize(base_url:, path:, method:, headers: {}, query: {}, request_options: {}) + @base_url = base_url + @path = path + @method = method + @headers = headers + @query = query + @request_options = request_options + end + + # Child classes should implement: + # - encode_headers: Returns the encoded HTTP request headers. + # - encode_body: Returns the encoded HTTP request body. + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/http/raw_client.rb b/lib/square/internal/http/raw_client.rb new file mode 100644 index 000000000..ed7a9423d --- /dev/null +++ b/lib/square/internal/http/raw_client.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module Square + module Internal + module Http + # @api private + class RawClient + # @param base_url [String] The base url for the request. + # @param max_retries [Integer] The number of times to retry a failed request, defaults to 2. + # @param timeout [Float] The timeout for the request, defaults to 60.0 seconds. + # @param headers [Hash] The headers for the request. + def initialize(base_url:, max_retries: 2, timeout: 60.0, headers: {}) + @base_url = base_url + @max_retries = max_retries + @timeout = timeout + @default_headers = { + "X-Fern-Language": "Ruby", + "X-Fern-SDK-Name": "square", + "X-Fern-SDK-Version": "0.0.1" + }.merge(headers) + end + + # @param request [Square::Internal::Http::BaseRequest] The HTTP request. + # @return [HTTP::Response] The HTTP response. + def send(request) + url = build_url(request) + + http_request = build_http_request( + url:, + method: request.method, + headers: request.encode_headers, + body: request.encode_body + ) + + conn = connect(url) + conn.open_timeout = @timeout + conn.read_timeout = @timeout + conn.write_timeout = @timeout + conn.continue_timeout = @timeout + + conn.request(http_request) + # begin + # conn.request(http_request) + # rescue StandardError => e + # raise HttpError, "HTTP request failed: #{e.message}" + # end + end + + # @param request [Square::Internal::Http::BaseRequest] The HTTP request. + # @return [URI::Generic] The URL. + def build_url(request) + path = request.path.start_with?("/") ? request.path[1..] : request.path + url = "#{@base_url.chomp("/")}/#{path}" + url = "#{url}?#{encode_query(request.query)}" if request.query + URI.parse(url) + end + + # @param url [URI::Generic] The url to the resource. + # @param method [String] The HTTP method to use. + # @param headers [Hash] The headers for the request. + # @param body [String, nil] The body for the request. + # @return [HTTP::Request] The HTTP request. + def build_http_request(url:, method:, headers: {}, body: nil) + request = Net::HTTPGenericRequest.new( + method, + !body.nil?, + method != "HEAD", + url + ) + + request_headers = @default_headers.merge(headers) + request_headers.each { |name, value| request[name] = value } + request.body = body if body + + request + end + + # @param query [Hash] The query for the request. + # @return [String, nil] The encoded query. + def encode_query(query) + query.to_h.empty? ? nil : URI.encode_www_form(query) + end + + # @param url [URI::Generic] The url to connect to. + # @return [Net::HTTP] The HTTP connection. + def connect(url) + is_https = (url.scheme == "https") + + port = if url.port + url.port + elsif is_https + Net::HTTP.https_default_port + else + Net::HTTP.http_default_port + end + + http = Net::HTTP.new(url.host, port) + http.use_ssl = is_https + http.max_retries = 0 + http + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/json/request.rb b/lib/square/internal/json/request.rb new file mode 100644 index 000000000..86d7fc087 --- /dev/null +++ b/lib/square/internal/json/request.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module Square + module Internal + module Multipart + # @api private + class Request < Square::Internal::Http::BaseRequest + attr_reader :body + + # @param base_url [String] The base URL for the request + # @param path [String] The path for the request + # @param method [Symbol] The HTTP method for the request (:get, :post, etc.) + # @param headers [Hash] Additional headers for the request (optional) + # @param query [Hash] Query parameters for the request (optional) + # @param body [Object, nil] The JSON request body (optional) + # @param request_options [Square::RequestOptions, Hash{Symbol=>Object}, nil] + def initialize(base_url:, path:, method:, headers: {}, query: {}, body: nil, request_options: {}) + super(base_url:, path:, method:, headers:, query:, request_options:) + + @body = body + end + + # @return [Hash] The encoded HTTP request headers. + def encode_headers + { + "Content-Type" => "application/json", + "Accept" => "application/json" + }.merge(@headers) + end + + # @return [String, nil] The encoded HTTP request body. + def encode_body + @body.nil? ? nil : ::JSON.generate(@body) + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/json/serializable.rb b/lib/square/internal/json/serializable.rb new file mode 100644 index 000000000..e9e664184 --- /dev/null +++ b/lib/square/internal/json/serializable.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Internal + module JSON + module Serializable + # Loads data from JSON into its deserialized form + # + # @param str [String] Raw JSON to load into an object + # @return [Object] + def load(str) + raise NotImplementedError + end + + # Dumps data from its deserialized form into JSON + # + # @param value [Object] The deserialized value + # @return [String] + def dump(value) + raise NotImplementedError + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/multipart/multipart_encoder.rb b/lib/square/internal/multipart/multipart_encoder.rb new file mode 100644 index 000000000..d182c743e --- /dev/null +++ b/lib/square/internal/multipart/multipart_encoder.rb @@ -0,0 +1,141 @@ +# frozen_string_literal: true + +module Square + module Internal + module Multipart + # Encodes parameters into a `multipart/form-data` payload as described by RFC + # 2388: + # + # https://tools.ietf.org/html/rfc2388 + # + # This is most useful for transferring file-like objects. + # + # Parameters should be added with `#encode`. When ready, use `#body` to get + # the encoded result and `#content_type` to get the value that should be + # placed in the `Content-Type` header of a subsequent request (which includes + # a boundary value). + # + # This abstraction is heavily inspired by Stripe's multipart/form-data implementation, + # which can be found here: + # + # https://github.com/stripe/stripe-ruby/blob/ca00b676f04ac421cf5cb5ff0325f243651677b6/lib/stripe/multipart_encoder.rb#L18 + # + # @api private + class Encoder + CONTENT_TYPE = "multipart/form-data" + CRLF = "\r\n" + + attr_reader :boundary, :body + + def initialize + # Chose the same number of random bytes that Go uses in its standard + # library implementation. Easily enough entropy to ensure that it won't + # be present in a file we're sending. + @boundary = SecureRandom.hex(30) + + @body = String.new + @closed = false + @first_field = true + end + + # Gets the content type string including the boundary. + # + # @return [String] The content type with boundary + def content_type + "#{CONTENT_TYPE}; boundary=#{@boundary}" + end + + # Encode the given FormData object into a multipart/form-data payload. + # + # @param form_data [FormData] The form data to encode + # @return [String] The encoded body. + def encode(form_data) + return "" if form_data.parts.empty? + + form_data.parts.each do |part| + write_part(part) + end + close + + @body + end + + # Writes a FormDataPart to the encoder. + # + # @param part [FormDataPart] The part to write + # @return [nil] + def write_part(part) + raise "Cannot write to closed encoder" if @closed + + write_field( + name: part.name, + data: part.contents, + filename: part.filename, + headers: part.headers + ) + + nil + end + + # Writes a field to the encoder. + # + # @param name [String] The field name + # @param data [String] The field data + # @param filename [String, nil] Optional filename + # @param headers [Hash, nil] Optional additional headers + # @return [nil] + def write_field(name:, data:, filename: nil, headers: nil) + raise "Cannot write to closed encoder" if @closed + + if @first_field + @first_field = false + else + @body << CRLF + end + + @body << "--#{@boundary}#{CRLF}" + @body << %(Content-Disposition: form-data; name="#{escape(name.to_s)}") + @body << %(; filename="#{escape(filename)}") if filename + @body << CRLF + + if headers + headers.each do |key, value| + @body << "#{key}: #{value}#{CRLF}" + end + elsif filename + # Default content type for files. + @body << "Content-Type: application/octet-stream#{CRLF}" + end + + @body << CRLF + @body << data.to_s + + nil + end + + # Finalizes the encoder by writing the final boundary. + # + # @return [nil] + def close + raise "Encoder already closed" if @closed + + @body << CRLF + @body << "--#{@boundary}--" + @closed = true + + nil + end + + private + + # Escapes quotes for use in header values and replaces line breaks with spaces. + # + # @param str [String] The string to escape + # @return [String] The escaped string + def escape(str) + str.to_s.gsub('"', "%22").tr("\n", " ").tr("\r", " ") + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/multipart/multipart_form_data.rb b/lib/square/internal/multipart/multipart_form_data.rb new file mode 100644 index 000000000..b807463af --- /dev/null +++ b/lib/square/internal/multipart/multipart_form_data.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +module Square + module Internal + module Multipart + # @api private + class FormData + # @return [Array] The parts in this multipart form data. + attr_reader :parts + + # @return [Encoder] The encoder for this multipart form data. + private attr_reader :encoder + + def initialize + @encoder = Encoder.new + @parts = [] + end + + # Adds a new part to the multipart form data. + # + # @param name [String] The name of the form field + # @param value [String, Integer, Float, Boolean, #read] The value of the field + # @param content_type [String, nil] Optional content type + # @return [self] Returns self for chaining + def add(name:, value:, content_type: nil) + headers = content_type ? { "Content-Type" => content_type } : nil + add_part(FormDataPart.new(name:, value:, headers:)) + end + + # Adds a file to the multipart form data. + # + # @param name [String] The name of the form field + # @param file [#read] The file or readable object + # @param filename [String, nil] Optional filename (defaults to basename of path for File objects) + # @param content_type [String, nil] Optional content type (e.g. "image/png") + # @return [self] Returns self for chaining + def add_file(name:, file:, filename: nil, content_type: nil) + headers = content_type ? { "Content-Type" => content_type } : nil + filename ||= filename_for(file) + add_part(FormDataPart.new(name:, value: file, filename:, headers:)) + end + + # Adds a pre-created part to the multipart form data. + # + # @param part [FormDataPart] The part to add + # @return [self] Returns self for chaining + def add_part(part) + @parts << part + self + end + + # Gets the content type string including the boundary. + # + # @return [String] The content type with boundary. + def content_type + @encoder.content_type + end + + # Encode the multipart form data into a multipart/form-data payload. + # + # @return [String] The encoded body. + def encode + @encoder.encode(self) + end + + private + + def filename_for(file) + if file.is_a?(::File) || file.respond_to?(:path) + ::File.basename(file.path) + elsif file.respond_to?(:name) + file.name + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/multipart/multipart_form_data_part.rb b/lib/square/internal/multipart/multipart_form_data_part.rb new file mode 100644 index 000000000..ae1d26b1c --- /dev/null +++ b/lib/square/internal/multipart/multipart_form_data_part.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require "securerandom" + +module Square + module Internal + module Multipart + # @api private + class FormDataPart + attr_reader :name, :contents, :filename, :headers + + # @param name [String] The name of the form field + # @param value [String, Integer, Float, Boolean, File, #read] The value of the field + # @param filename [String, nil] Optional filename for file uploads + # @param headers [Hash, nil] Optional additional headers + def initialize(name:, value:, filename: nil, headers: nil) + @name = name + @contents = convert_to_content(value) + @filename = filename + @headers = headers + end + + # Converts the part to a hash suitable for serialization. + # + # @return [Hash] A hash representation of the part + def to_hash + result = { + name: @name, + contents: @contents + } + result[:filename] = @filename if @filename + result[:headers] = @headers if @headers + result + end + + private + + # Converts various types of values to a content representation + # @param value [String, Integer, Float, Boolean, #read] The value to convert + # @return [String] The string representation of the value + def convert_to_content(value) + if value.respond_to?(:read) + value.read + else + value.to_s + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/multipart/multipart_request.rb b/lib/square/internal/multipart/multipart_request.rb new file mode 100644 index 000000000..e6fd33615 --- /dev/null +++ b/lib/square/internal/multipart/multipart_request.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Square + module Internal + module Multipart + # @api private + class Request Square::Internal::Http::BaseRequest + attr_reader :body + + # @param base_url [String] The base URL for the request + # @param path [String] The path for the request + # @param method [Symbol] The HTTP method for the request (:get, :post, etc.) + # @param headers [Hash] Additional headers for the request (optional) + # @param query [Hash] Query parameters for the request (optional) + # @param body [MultipartFormData, nil] The multipart form data for the request (optional) + # @param request_options [Square::RequestOptions, Hash{Symbol=>Object}, nil] + def initialize(base_url:, path:, method:, headers: {}, query: {}, body: nil, request_options: {}) + super(base_url:, path:, method:, headers:, query:, request_options:) + + @body = body + end + + # @return [Hash] The encoded HTTP request headers. + def encode_headers + { + "Content-Type" => @body.content_type + }.merge(@headers) + end + + # @return [String, nil] The encoded HTTP request body. + def encode_body + @body&.encode + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/array.rb b/lib/square/internal/types/array.rb new file mode 100644 index 000000000..0d9c5805c --- /dev/null +++ b/lib/square/internal/types/array.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # An array of a specific type + class Array + include Square::Internal::Types::Type + + attr_reader :type + + class << self + # Instantiates a new `Array` of a given type + # + # @param type [Object] The member type of this array + # + # @return [Square::Internal::Types::Array] + def [](type) + new(type) + end + end + + # @api private + def initialize(type) + @type = type + end + + # Coerces a value into this array + # + # @param value [Object] + # @option strict [Boolean] + # @return [::Array] + def coerce(value, strict: strict?) + unless value.is_a?(::Array) + raise Errors::TypeError, "cannot coerce `#{value.class}` to Array<#{type}>" if strict + + return value + end + + value.map do |element| + Utils.coerce(type, element, strict: strict) + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/boolean.rb b/lib/square/internal/types/boolean.rb new file mode 100644 index 000000000..5562ddd05 --- /dev/null +++ b/lib/square/internal/types/boolean.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + module Boolean + extend Square::Internal::Types::Union + + member TrueClass + member FalseClass + + # Overrides the base coercion method for enums to allow integer and string values to become booleans + # + # @param value [Object] + # @option strict [Boolean] + # @return [Object] + def self.coerce(value, strict: strict?) + case value + when TrueClass, FalseClass + value + when Integer + return value == 1 + when String + return %w[1 true].include?(value) + end + + raise Errors::TypeError, "cannot coerce `#{value.class}` to Boolean" if strict + + value + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/enum.rb b/lib/square/internal/types/enum.rb new file mode 100644 index 000000000..ad2bdb251 --- /dev/null +++ b/lib/square/internal/types/enum.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # Module for defining enums + module Enum + include Square::Internal::Types::Type + + # @api private + # + # @return [Array] + def values + @values ||= constants.map { |c| const_get(c) } + end + + # @api private + def finalize! + values + end + + # @api private + def strict? + @strict ||= false + end + + # @api private + def strict! + @strict = true + end + + def coerce(value, strict: strict?) + coerced_value = Utils.coerce(Symbol, value) + + return coerced_value if values.include?(coerced_value) + + raise Errors::TypeError, "`#{value}` not in enum #{self}" if strict + + value + end + + def inspect + "#{name}[#{values.join(", ")}]" + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/hash.rb b/lib/square/internal/types/hash.rb new file mode 100644 index 000000000..9d61b8815 --- /dev/null +++ b/lib/square/internal/types/hash.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + class Hash + include Type + + attr_reader :key_type, :value_type + + class << self + def [](key_type, value_type) + new(key_type, value_type) + end + end + + def initialize(key_type, value_type) + @key_type = key_type + @value_type = value_type + end + + def coerce(value, strict: strict?) + unless value.is_a?(::Hash) + raise Errors::TypeError, "not hash" if strict + + return value + end + + value.to_h do |k, v| + [Utils.coerce(key_type, k, strict: strict), Utils.coerce(value_type, v, strict: strict)] + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/model.rb b/lib/square/internal/types/model.rb new file mode 100644 index 000000000..3707af1ad --- /dev/null +++ b/lib/square/internal/types/model.rb @@ -0,0 +1,192 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # @abstract + # + # An abstract model that all data objects will inherit from + class Model + include Type + + class << self + # The defined fields for this model + # + # @api private + # + # @return [Hash] + def fields + @fields ||= if self < Square::Internal::Types::Model + superclass.fields.dup + else + {} + end + end + + # Any extra fields that have been created from instantiation + # + # @api private + # + # @return [Hash] + def extra_fields + @extra_fields ||= {} + end + + # Define a new field on this model + # + # @param name [Symbol] The name of the field + # @param type [Class] Type of the field + # @option optional [Boolean] If it is an optional field + # @option nullable [Boolean] If it is a nullable field + # @option api_name [Symbol, String] Name in the API of this field. When serializing/deserializing, will use + # this field name + # @return [void] + def field(name, type, optional: false, nullable: false, api_name: nil, default: nil) + add_field_definition(name: name, type: type, optional: optional, nullable: nullable, api_name: api_name, + default: default) + + define_accessor(name) + define_setter(name) + end + + # Define a new literal for this model + # + # @param name [Symbol] + # @param value [Object] + # @option api_name [Symbol, String] + # @return [void] + def literal(name, value, api_name: nil) + add_field_definition(name: name, type: value.class, optional: false, nullable: false, api_name: api_name, + value: value) + + define_accessor(name) + end + + # Adds a new field definition into the class's fields registry + # + # @api private + # + # @param name [Symbol] + # @param type [Class] + # @option optional [Boolean] + # @return [void] + private def add_field_definition(name:, type:, optional:, nullable:, api_name:, default: nil, value: nil) + fields[name.to_sym] = + Field.new(name: name, type: type, optional: optional, nullable: nullable, api_name: api_name, + value: value, default: default) + end + + # Adds a new field definition into the class's extra fields registry + # + # @api private + # + # @param name [Symbol] + # @param type [Class] + # @option required [Boolean] + # @option optional [Boolean] + # @return [void] + def add_extra_field_definition(name:, type:) + return if extra_fields.key?(name.to_sym) + + extra_fields[name.to_sym] = Field.new(name: name, type: type, optional: true, nullable: false) + + define_accessor(name) + define_setter(name) + end + + # @api private + private def define_accessor(name) + method_name = name.to_sym + + define_method(method_name) do + @data[name] + end + end + + # @api private + private def define_setter(name) + method_name = :"#{name}=" + + define_method(method_name) do |val| + @data[name] = val + end + end + + def coerce(value, strict: strict?) + return value if value.is_a?(self) + + return value unless value.is_a?(::Hash) + + new(value) + end + + def load(str) + coerce(::JSON.parse(str, symbolize_names: true)) + end + + def ===(instance) + instance.class.ancestors.include?(self) + end + end + + # Creates a new instance of this model + # TODO: Should all this logic be in `#coerce` instead? + # + # @param values [Hash] + # @option strict [Boolean] + # @return [self] + def initialize(values = {}) + @data = {} + + values = Utils.symbolize_keys(values.dup) + + self.class.fields.each do |field_name, field| + value = values.delete(field.api_name) + + field_value = value || (if field.literal? + field.value + elsif field.default + field.default + end) + + @data[field_name] = Utils.coerce(field.type, field_value) + end + + # Any remaining values in the input become extra fields + values.each do |name, value| + self.class.add_extra_field_definition(name: name, type: value.class) + + @data[name.to_sym] = value + end + end + + def to_h + self.class.fields.merge(self.class.extra_fields).each_with_object({}) do |(name, field), acc| + # If there is a value present in the data, use that value + # If there is a `nil` value present in the data, and it is optional but NOT nullable, exclude key altogether + # If there is a `nil` value present in the data, and it is optional and nullable, use the nil value + + value = @data[name] + + next if value.nil? && field.optional && !field.nullable + + acc[field.api_name] = value + end + end + + def ==(other) + self.class == other.class && to_h == other.to_h + end + + # @return [String] + def inspect + attrs = @data.map do |name, value| + "#{name}=#{value.inspect}" + end + + "#<#{self.class.name}:0x#{object_id&.to_s(16)} #{attrs.join(" ")}>" + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/model/field.rb b/lib/square/internal/types/model/field.rb new file mode 100644 index 000000000..01ac747a4 --- /dev/null +++ b/lib/square/internal/types/model/field.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +module Square + module Internal + module Types + class Model + # Definition of a field on a model + class Field + attr_reader :name, :type, :optional, :nullable, :api_name, :value, :default + + def initialize(name:, type:, optional: false, nullable: false, api_name: nil, value: nil, default: nil) + @name = name.to_sym + @type = type + @optional = optional + @nullable = nullable + @api_name = (api_name || name).to_sym + @value = value + @default = default + end + + def literal? + !value.nil? + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/type.rb b/lib/square/internal/types/type.rb new file mode 100644 index 000000000..29004dd6f --- /dev/null +++ b/lib/square/internal/types/type.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # @abstract + module Type + include Square::Internal::JSON::Serializable + + # Coerces a value to this type + # + # @param value [unknown] + # @option strict [Boolean] If we should strictly coerce this value + def coerce(value, strict: strict?) + raise NotImplementedError + end + + # Returns if strictness is on for this type, defaults to `false` + # + # @return [Boolean] + def strict? + @strict ||= false + end + + # Enable strictness by default for this type + # + # @return [void] + def strict! + @strict = true + self + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/union.rb b/lib/square/internal/types/union.rb new file mode 100644 index 000000000..3fea19c7e --- /dev/null +++ b/lib/square/internal/types/union.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # Define a union between two types + module Union + include Square::Internal::Types::Type + + def members + @members ||= [] + end + + # Add a member to this union + # + # @param type [Object] + # @option key [Symbol, String] + # @return [void] + def member(type, key: nil) + members.push([key, Utils.wrap_type(type)]) + self + end + + def member?(type) + members.any? { |_key, type_fn| type == type_fn.call } + end + + # Set the discriminant for this union + # + # @param key [Symbol, String] + # @return [void] + def discriminant(key) + @discriminant = key + end + + # @api private + private def discriminated? + !@discriminant.nil? + end + + # Resolves the type of a value to be one of the members + # + # @param value [Object] + # @return [Class] + private def resolve_member(value) + if discriminated? && value.is_a?(::Hash) + disciminant_value = value.fetch(@discriminant, nil) + + return if disciminant_value.nil? + + members.to_h[disciminant_value]&.call + else + members.find do |_key, mem| + member_type = Utils.unwrap_type(mem) + + value.is_a?(member_type) + end&.last&.call + end + end + + def coerce(value, strict: strict?) + type = resolve_member(value) + + unless type + return value unless strict + + if discriminated? + raise Errors::TypeError, + "value of type `#{value.class}` not member of union #{self}" + end + + raise Errors::TypeError, "could not resolve to member of union #{self}" + end + + value = value.except(@discriminant) if type <= Model && value.is_a?(::Hash) + + Utils.coerce(type, value, strict: strict) + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/unknown.rb b/lib/square/internal/types/unknown.rb new file mode 100644 index 000000000..658562fac --- /dev/null +++ b/lib/square/internal/types/unknown.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + module Unknown + include Square::Internal::Types::Type + + def coerce(value) + value + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/internal/types/utils.rb b/lib/square/internal/types/utils.rb new file mode 100644 index 000000000..7c368361e --- /dev/null +++ b/lib/square/internal/types/utils.rb @@ -0,0 +1,100 @@ +# frozen_string_literal: true + +module Square + module Internal + module Types + # Utilities for dealing with and checking types + module Utils + # Wraps a type into a type function + # + # @param type [Proc, Object] + # @return [Proc] + def self.wrap_type(type) + case type + when Proc + type + else + -> { type } + end + end + + # Resolves a type or type function into a type + # + # @param type [Proc, Object] + # @return [Object] + def self.unwrap_type(type) + type.is_a?(Proc) ? type.call : type + end + + def self.coerce(target, value, strict: false) # rubocop:disable Metrics/CyclomaticComplexity + type = unwrap_type(target) + + case type + in Array + case value + when ::Array + return type.coerce(value, strict: strict) + when Set, ::Hash + return coerce(type, value.to_a) + end + in Hash + case value + when ::Hash + return type.coerce(value, strict: strict) + when ::Array + return coerce(type, value.to_h) + end + in ->(t) { t <= NilClass } + return nil + in ->(t) { t <= String } + case value + when String, Symbol, Numeric, TrueClass, FalseClass + return value.to_s + end + in ->(t) { t <= Symbol } + case value + when Symbol, String + return value.to_sym + end + in ->(t) { t <= Integer } + case value + when Numeric, String, Time + return value.to_i + end + in ->(t) { t <= Float } + case value + when Numeric, Time, String + return value.to_f + end + in ->(t) { t <= Model } + case value + when type + return value + when ::Hash + return type.coerce(value, strict: strict) + end + in Module + case type + in ->(t) { t.singleton_class.included_modules.include?(Enum) } + return type.coerce(value, strict: strict) + in ->(t) { t.singleton_class.included_modules.include?(Union) } + return type.coerce(value, strict: strict) + else + value + end + else + value + end + + raise Errors::TypeError, "cannot coerce value of type `#{value.class}` to `#{target}`" if strict + + value + end + + def self.symbolize_keys(hash) + hash.transform_keys(&:to_sym) + end + end + end + end +end \ No newline at end of file diff --git a/lib/square/inventory/client.rb b/lib/square/inventory/client.rb new file mode 100644 index 000000000..66fbaeead --- /dev/null +++ b/lib/square/inventory/client.rb @@ -0,0 +1,245 @@ + +module Square + module Inventory + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Inventory::Client] + def initialize(client) + @client = client + end + + # Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL + # is updated to conform to the standard convention. + # + # @return [Square::Types::GetInventoryAdjustmentResponse] + def deprecated_get_adjustment(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryAdjustmentResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns the [InventoryAdjustment](entity:InventoryAdjustment) object + # with the provided `adjustment_id`. + # + # @return [Square::Types::GetInventoryAdjustmentResponse] + def get_adjustment(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryAdjustmentResponse.load(_response.body) + else + raise _response.body + end + end + + # Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL + # is updated to conform to the standard convention. + # + # @return [Square::Types::BatchChangeInventoryResponse] + def deprecated_batch_change(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/batch-change" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchChangeInventoryResponse.load(_response.body) + else + raise _response.body + end + end + + # Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL + # is updated to conform to the standard convention. + # + # @return [Square::Types::BatchGetInventoryChangesResponse] + def deprecated_batch_get_changes(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/batch-retrieve-changes" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetInventoryChangesResponse.load(_response.body) + else + raise _response.body + end + end + + # Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL + # is updated to conform to the standard convention. + # + # @return [Square::Types::BatchGetInventoryCountsResponse] + def deprecated_batch_get_counts(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/batch-retrieve-counts" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetInventoryCountsResponse.load(_response.body) + else + raise _response.body + end + end + + # Applies adjustments and counts to the provided item quantities. + # + # On success: returns the current calculated counts for all objects + # referenced in the request. + # On failure: returns a list of related errors. + # + # @return [Square::Types::BatchChangeInventoryResponse] + def batch_create_changes(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/changes/batch-create" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchChangeInventoryResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns historical physical counts and adjustments based on the + # provided filter criteria. + # + # Results are paginated and sorted in ascending order according their + # `occurred_at` timestamp (oldest first). + # + # BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + # that cannot be handled by other, simpler endpoints. + # + # @return [Square::Types::BatchGetInventoryChangesResponse] + def batch_get_changes(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/changes/batch-retrieve" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetInventoryChangesResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns current counts for the provided + # [CatalogObject](entity:CatalogObject)s at the requested + # [Location](entity:Location)s. + # + # Results are paginated and sorted in descending order according to their + # `calculated_at` timestamp (newest first). + # + # When `updated_after` is specified, only counts that have changed since that + # time (based on the server timestamp for the most recent change) are + # returned. This allows clients to perform a "sync" operation, for example + # in response to receiving a Webhook notification. + # + # @return [Square::Types::BatchGetInventoryCountsResponse] + def batch_get_counts(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/inventory/counts/batch-retrieve" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetInventoryCountsResponse.load(_response.body) + else + raise _response.body + end + end + + # Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL + # is updated to conform to the standard convention. + # + # @return [Square::Types::GetInventoryPhysicalCountResponse] + def deprecated_get_physical_count(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryPhysicalCountResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount) + # object with the provided `physical_count_id`. + # + # @return [Square::Types::GetInventoryPhysicalCountResponse] + def get_physical_count(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryPhysicalCountResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns the [InventoryTransfer](entity:InventoryTransfer) object + # with the provided `transfer_id`. + # + # @return [Square::Types::GetInventoryTransferResponse] + def get_transfer(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryTransferResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves the current calculated stock count for a given + # [CatalogObject](entity:CatalogObject) at a given set of + # [Location](entity:Location)s. Responses are paginated and unsorted. + # For more sophisticated queries, use a batch endpoint. + # + # @return [Square::Types::GetInventoryCountResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryCountResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a set of physical counts and inventory adjustments for the + # provided [CatalogObject](entity:CatalogObject) at the requested + # [Location](entity:Location)s. + # + # You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) + # and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID. + # + # Results are paginated and sorted in descending order according to their + # `occurred_at` timestamp (newest first). + # + # There are no limits on how far back the caller can page. This endpoint can be + # used to display recent changes for a specific item. For more + # sophisticated queries, use a batch endpoint. + # + # @return [Square::Types::GetInventoryChangesResponse] + def changes(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInventoryChangesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/inventory/types/changes_inventory_request.rb b/lib/square/inventory/types/changes_inventory_request.rb new file mode 100644 index 000000000..627e328ee --- /dev/null +++ b/lib/square/inventory/types/changes_inventory_request.rb @@ -0,0 +1,13 @@ + +module Square + module Inventory + module Types + class ChangesInventoryRequest < Internal::Types::Model + field :catalog_object_id, String, optional: false, nullable: false + field :location_ids, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/deprecated_get_adjustment_inventory_request.rb b/lib/square/inventory/types/deprecated_get_adjustment_inventory_request.rb new file mode 100644 index 000000000..8af0572d2 --- /dev/null +++ b/lib/square/inventory/types/deprecated_get_adjustment_inventory_request.rb @@ -0,0 +1,11 @@ + +module Square + module Inventory + module Types + class DeprecatedGetAdjustmentInventoryRequest < Internal::Types::Model + field :adjustment_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/deprecated_get_physical_count_inventory_request.rb b/lib/square/inventory/types/deprecated_get_physical_count_inventory_request.rb new file mode 100644 index 000000000..81c9290ac --- /dev/null +++ b/lib/square/inventory/types/deprecated_get_physical_count_inventory_request.rb @@ -0,0 +1,11 @@ + +module Square + module Inventory + module Types + class DeprecatedGetPhysicalCountInventoryRequest < Internal::Types::Model + field :physical_count_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/get_adjustment_inventory_request.rb b/lib/square/inventory/types/get_adjustment_inventory_request.rb new file mode 100644 index 000000000..ac28a3cae --- /dev/null +++ b/lib/square/inventory/types/get_adjustment_inventory_request.rb @@ -0,0 +1,11 @@ + +module Square + module Inventory + module Types + class GetAdjustmentInventoryRequest < Internal::Types::Model + field :adjustment_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/get_inventory_request.rb b/lib/square/inventory/types/get_inventory_request.rb new file mode 100644 index 000000000..729b3632b --- /dev/null +++ b/lib/square/inventory/types/get_inventory_request.rb @@ -0,0 +1,13 @@ + +module Square + module Inventory + module Types + class GetInventoryRequest < Internal::Types::Model + field :catalog_object_id, String, optional: false, nullable: false + field :location_ids, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/get_physical_count_inventory_request.rb b/lib/square/inventory/types/get_physical_count_inventory_request.rb new file mode 100644 index 000000000..9a01bc7d1 --- /dev/null +++ b/lib/square/inventory/types/get_physical_count_inventory_request.rb @@ -0,0 +1,11 @@ + +module Square + module Inventory + module Types + class GetPhysicalCountInventoryRequest < Internal::Types::Model + field :physical_count_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/inventory/types/get_transfer_inventory_request.rb b/lib/square/inventory/types/get_transfer_inventory_request.rb new file mode 100644 index 000000000..fe02cff75 --- /dev/null +++ b/lib/square/inventory/types/get_transfer_inventory_request.rb @@ -0,0 +1,11 @@ + +module Square + module Inventory + module Types + class GetTransferInventoryRequest < Internal::Types::Model + field :transfer_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/client.rb b/lib/square/invoices/client.rb new file mode 100644 index 000000000..39031cea1 --- /dev/null +++ b/lib/square/invoices/client.rb @@ -0,0 +1,185 @@ + +module Square + module Invoices + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Invoices::Client] + def initialize(client) + @client = client + end + + # Returns a list of invoices for a given location. The response + # is paginated. If truncated, the response includes a `cursor` that you + # use in a subsequent request to retrieve the next set of invoices. + # + # @return [Square::Types::ListInvoicesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListInvoicesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a draft [invoice](entity:Invoice) + # for an order created using the Orders API. + # + # A draft invoice remains in your account and no action is taken. + # You must publish the invoice before Square can process it (send it to the customer's email address or charge the customer’s card on file). + # + # @return [Square::Types::CreateInvoiceResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for invoices from a location specified in + # the filter. You can optionally specify customers in the filter for whom to + # retrieve invoices. In the current implementation, you can only specify one location and + # optionally one customer. + # + # The response is paginated. If truncated, the response includes a `cursor` + # that you use in a subsequent request to retrieve the next set of invoices. + # + # @return [Square::Types::SearchInvoicesResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchInvoicesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves an invoice by invoice ID. + # + # @return [Square::Types::GetInvoiceResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an invoice. This endpoint supports sparse updates, so you only need + # to specify the fields you want to change along with the required `version` field. + # Some restrictions apply to updating invoices. For example, you cannot change the + # `order_id` or `location_id` field. + # + # @return [Square::Types::UpdateInvoiceResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes the specified invoice. When an invoice is deleted, the + # associated order status changes to CANCELED. You can only delete a draft + # invoice (you cannot delete a published invoice, including one that is scheduled for processing). + # + # @return [Square::Types::DeleteInvoiceResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + # Uploads a file and attaches it to an invoice. This endpoint accepts HTTP multipart/form-data file uploads + # with a JSON `request` part and a `file` part. The `file` part must be a `readable stream` that contains a file + # in a supported format: GIF, JPEG, PNG, TIFF, BMP, or PDF. + # + # Invoices can have up to 10 attachments with a total file size of 25 MB. Attachments can be added only to invoices + # in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + # + # __NOTE:__ When testing in the Sandbox environment, the total file size is limited to 1 KB. + # + # @return [Square::Types::CreateInvoiceAttachmentResponse] + def create_invoice_attachment(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateInvoiceAttachmentResponse.load(_response.body) + else + raise _response.body + end + end + + # Removes an attachment from an invoice and permanently deletes the file. Attachments can be removed only + # from invoices in the `DRAFT`, `SCHEDULED`, `UNPAID`, or `PARTIALLY_PAID` state. + # + # @return [Square::Types::DeleteInvoiceAttachmentResponse] + def delete_invoice_attachment(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteInvoiceAttachmentResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels an invoice. The seller cannot collect payments for + # the canceled invoice. + # + # You cannot cancel an invoice in the `DRAFT` state or in a terminal state: `PAID`, `REFUNDED`, `CANCELED`, or `FAILED`. + # + # @return [Square::Types::CancelInvoiceResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + # Publishes the specified draft invoice. + # + # After an invoice is published, Square + # follows up based on the invoice configuration. For example, Square + # sends the invoice to the customer's email address, charges the customer's card on file, or does + # nothing. Square also makes the invoice available on a Square-hosted invoice page. + # + # The invoice `status` also changes from `DRAFT` to a status + # based on the invoice configuration. For example, the status changes to `UNPAID` if + # Square emails the invoice or `PARTIALLY_PAID` if Square charges a card on file for a portion of the + # invoice amount. + # + # In addition to the required `ORDERS_WRITE` and `INVOICES_WRITE` permissions, `CUSTOMERS_READ` + # and `PAYMENTS_WRITE` are required when publishing invoices configured for card-on-file payments. + # + # @return [Square::Types::PublishInvoiceResponse] + def publish(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::PublishInvoiceResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/invoices/types/cancel_invoice_request.rb b/lib/square/invoices/types/cancel_invoice_request.rb new file mode 100644 index 000000000..d13c712e4 --- /dev/null +++ b/lib/square/invoices/types/cancel_invoice_request.rb @@ -0,0 +1,12 @@ + +module Square + module Invoices + module Types + class CancelInvoiceRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + field :version, Integer, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/create_invoice_attachment_request.rb b/lib/square/invoices/types/create_invoice_attachment_request.rb new file mode 100644 index 000000000..f16db4305 --- /dev/null +++ b/lib/square/invoices/types/create_invoice_attachment_request.rb @@ -0,0 +1,11 @@ + +module Square + module Invoices + module Types + class CreateInvoiceAttachmentRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/create_invoice_request.rb b/lib/square/invoices/types/create_invoice_request.rb new file mode 100644 index 000000000..2f4339d00 --- /dev/null +++ b/lib/square/invoices/types/create_invoice_request.rb @@ -0,0 +1,12 @@ + +module Square + module Invoices + module Types + class CreateInvoiceRequest < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/delete_invoice_attachment_request.rb b/lib/square/invoices/types/delete_invoice_attachment_request.rb new file mode 100644 index 000000000..5c0abb0f1 --- /dev/null +++ b/lib/square/invoices/types/delete_invoice_attachment_request.rb @@ -0,0 +1,12 @@ + +module Square + module Invoices + module Types + class DeleteInvoiceAttachmentRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + field :attachment_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/delete_invoices_request.rb b/lib/square/invoices/types/delete_invoices_request.rb new file mode 100644 index 000000000..3ccc7e68b --- /dev/null +++ b/lib/square/invoices/types/delete_invoices_request.rb @@ -0,0 +1,12 @@ + +module Square + module Invoices + module Types + class DeleteInvoicesRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/get_invoices_request.rb b/lib/square/invoices/types/get_invoices_request.rb new file mode 100644 index 000000000..21634496d --- /dev/null +++ b/lib/square/invoices/types/get_invoices_request.rb @@ -0,0 +1,11 @@ + +module Square + module Invoices + module Types + class GetInvoicesRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/list_invoices_request.rb b/lib/square/invoices/types/list_invoices_request.rb new file mode 100644 index 000000000..56e88ca9b --- /dev/null +++ b/lib/square/invoices/types/list_invoices_request.rb @@ -0,0 +1,13 @@ + +module Square + module Invoices + module Types + class ListInvoicesRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/publish_invoice_request.rb b/lib/square/invoices/types/publish_invoice_request.rb new file mode 100644 index 000000000..f9d850215 --- /dev/null +++ b/lib/square/invoices/types/publish_invoice_request.rb @@ -0,0 +1,13 @@ + +module Square + module Invoices + module Types + class PublishInvoiceRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + field :version, Integer, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/search_invoices_request.rb b/lib/square/invoices/types/search_invoices_request.rb new file mode 100644 index 000000000..af7d6c1ac --- /dev/null +++ b/lib/square/invoices/types/search_invoices_request.rb @@ -0,0 +1,13 @@ + +module Square + module Invoices + module Types + class SearchInvoicesRequest < Internal::Types::Model + field :query, Square::Types::InvoiceQuery, optional: false, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/invoices/types/update_invoice_request.rb b/lib/square/invoices/types/update_invoice_request.rb new file mode 100644 index 000000000..3a86b25ef --- /dev/null +++ b/lib/square/invoices/types/update_invoice_request.rb @@ -0,0 +1,14 @@ + +module Square + module Invoices + module Types + class UpdateInvoiceRequest < Internal::Types::Model + field :invoice_id, String, optional: false, nullable: false + field :invoice, Square::Types::Invoice, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + field :fields_to_clear, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/labor/break_types/client.rb b/lib/square/labor/break_types/client.rb new file mode 100644 index 000000000..f3985f71f --- /dev/null +++ b/lib/square/labor/break_types/client.rb @@ -0,0 +1,96 @@ + +module Square + module Labor + module BreakTypes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::BreakTypes::Client] + def initialize(client) + @client = client + end + + # Returns a paginated list of `BreakType` instances for a business. + # + # @return [Square::Types::ListBreakTypesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListBreakTypesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a new `BreakType`. + # + # A `BreakType` is a template for creating `Break` objects. + # You must provide the following values in your request to this + # endpoint: + # + # - `location_id` + # - `break_name` + # - `expected_duration` + # - `is_paid` + # + # You can only have three `BreakType` instances per location. If you attempt to add a fourth + # `BreakType` for a location, an `INVALID_REQUEST_ERROR` "Exceeded limit of 3 breaks per location." + # is returned. + # + # @return [Square::Types::CreateBreakTypeResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateBreakTypeResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single `BreakType` specified by `id`. + # + # @return [Square::Types::GetBreakTypeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetBreakTypeResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an existing `BreakType`. + # + # @return [Square::Types::UpdateBreakTypeResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateBreakTypeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes an existing `BreakType`. + # + # A `BreakType` can be deleted even if it is referenced from a `Shift`. + # + # @return [Square::Types::DeleteBreakTypeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteBreakTypeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/labor/break_types/types/create_break_type_request.rb b/lib/square/labor/break_types/types/create_break_type_request.rb new file mode 100644 index 000000000..d6f5c4cc9 --- /dev/null +++ b/lib/square/labor/break_types/types/create_break_type_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module BreakTypes + module Types + class CreateBreakTypeRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :break_type, Square::Types::BreakType, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/break_types/types/delete_break_types_request.rb b/lib/square/labor/break_types/types/delete_break_types_request.rb new file mode 100644 index 000000000..af31c4a41 --- /dev/null +++ b/lib/square/labor/break_types/types/delete_break_types_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module BreakTypes + module Types + class DeleteBreakTypesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/break_types/types/get_break_types_request.rb b/lib/square/labor/break_types/types/get_break_types_request.rb new file mode 100644 index 000000000..3c3a40e7a --- /dev/null +++ b/lib/square/labor/break_types/types/get_break_types_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module BreakTypes + module Types + class GetBreakTypesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/break_types/types/list_break_types_request.rb b/lib/square/labor/break_types/types/list_break_types_request.rb new file mode 100644 index 000000000..5b2e3cda0 --- /dev/null +++ b/lib/square/labor/break_types/types/list_break_types_request.rb @@ -0,0 +1,15 @@ + +module Square + module Labor + module BreakTypes + module Types + class ListBreakTypesRequest < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/break_types/types/update_break_type_request.rb b/lib/square/labor/break_types/types/update_break_type_request.rb new file mode 100644 index 000000000..e28d44a35 --- /dev/null +++ b/lib/square/labor/break_types/types/update_break_type_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module BreakTypes + module Types + class UpdateBreakTypeRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :break_type, Square::Types::BreakType, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/client.rb b/lib/square/labor/client.rb new file mode 100644 index 000000000..75dd101b8 --- /dev/null +++ b/lib/square/labor/client.rb @@ -0,0 +1,216 @@ + +module Square + module Labor + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::Client] + def initialize(client) + @client = client + end + + # Creates a scheduled shift by providing draft shift details such as job ID, + # team member assignment, and start and end times. + # + # The following `draft_shift_details` fields are required: + # - `location_id` + # - `job_id` + # - `start_at` + # - `end_at` + # + # @return [Square::Types::CreateScheduledShiftResponse] + def create_scheduled_shift(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateScheduledShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Publishes 1 - 100 scheduled shifts. This endpoint takes a map of individual publish + # requests and returns a map of responses. When a scheduled shift is published, Square keeps + # the `draft_shift_details` field as is and copies it to the `published_shift_details` field. + # + # The minimum `start_at` and maximum `end_at` timestamps of all shifts in a + # `BulkPublishScheduledShifts` request must fall within a two-week period. + # + # @return [Square::Types::BulkPublishScheduledShiftsResponse] + def bulk_publish_scheduled_shifts(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkPublishScheduledShiftsResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a paginated list of scheduled shifts, with optional filter and sort settings. + # By default, results are sorted by `start_at` in ascending order. + # + # @return [Square::Types::SearchScheduledShiftsResponse] + def search_scheduled_shifts(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchScheduledShiftsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a scheduled shift by ID. + # + # @return [Square::Types::RetrieveScheduledShiftResponse] + def retrieve_scheduled_shift(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveScheduledShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the draft shift details for a scheduled shift. This endpoint supports + # sparse updates, so only new, changed, or removed fields are required in the request. + # You must publish the shift to make updates public. + # + # You can make the following updates to `draft_shift_details`: + # - Change the `location_id`, `job_id`, `start_at`, and `end_at` fields. + # - Add, change, or clear the `team_member_id` and `notes` fields. To clear these fields, + # set the value to null. + # - Change the `is_deleted` field. To delete a scheduled shift, set `is_deleted` to true + # and then publish the shift. + # + # @return [Square::Types::UpdateScheduledShiftResponse] + def update_scheduled_shift(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateScheduledShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Publishes a scheduled shift. When a scheduled shift is published, Square keeps the + # `draft_shift_details` field as is and copies it to the `published_shift_details` field. + # + # @return [Square::Types::PublishScheduledShiftResponse] + def publish_scheduled_shift(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::PublishScheduledShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a new `Timecard`. + # + # A `Timecard` represents a complete workday for a single team member. + # You must provide the following values in your request to this + # endpoint: + # + # - `location_id` + # - `team_member_id` + # - `start_at` + # + # An attempt to create a new `Timecard` can result in a `BAD_REQUEST` error when: + # - The `status` of the new `Timecard` is `OPEN` and the team member has another + # timecard with an `OPEN` status. + # - The `start_at` date is in the future. + # - The `start_at` or `end_at` date overlaps another timecard for the same team member. + # - The `Break` instances are set in the request and a break `start_at` + # is before the `Timecard.start_at`, a break `end_at` is after + # the `Timecard.end_at`, or both. + # + # @return [Square::Types::CreateTimecardResponse] + def create_timecard(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateTimecardResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a paginated list of `Timecard` records for a business. + # The list to be returned can be filtered by: + # - Location IDs + # - Team member IDs + # - Timecard status (`OPEN` or `CLOSED`) + # - Timecard start + # - Timecard end + # - Workday details + # + # The list can be sorted by: + # - `START_AT` + # - `END_AT` + # - `CREATED_AT` + # - `UPDATED_AT` + # + # @return [Square::Types::SearchTimecardsResponse] + def search_timecards(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchTimecardsResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single `Timecard` specified by `id`. + # + # @return [Square::Types::RetrieveTimecardResponse] + def retrieve_timecard(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveTimecardResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an existing `Timecard`. + # + # When adding a `Break` to a `Timecard`, any earlier `Break` instances in the `Timecard` have + # the `end_at` property set to a valid RFC-3339 datetime string. + # + # When closing a `Timecard`, all `Break` instances in the `Timecard` must be complete with `end_at` + # set on each `Break`. + # + # @return [Square::Types::UpdateTimecardResponse] + def update_timecard(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateTimecardResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a `Timecard`. + # + # @return [Square::Types::DeleteTimecardResponse] + def delete_timecard(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteTimecardResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/labor/employee_wages/client.rb b/lib/square/labor/employee_wages/client.rb new file mode 100644 index 000000000..6dc7c316d --- /dev/null +++ b/lib/square/labor/employee_wages/client.rb @@ -0,0 +1,42 @@ + +module Square + module Labor + module EmployeeWages + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::EmployeeWages::Client] + def initialize(client) + @client = client + end + + # Returns a paginated list of `EmployeeWage` instances for a business. + # + # @return [Square::Types::ListEmployeeWagesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListEmployeeWagesResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single `EmployeeWage` specified by `id`. + # + # @return [Square::Types::GetEmployeeWageResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetEmployeeWageResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/labor/employee_wages/types/get_employee_wages_request.rb b/lib/square/labor/employee_wages/types/get_employee_wages_request.rb new file mode 100644 index 000000000..94ed63452 --- /dev/null +++ b/lib/square/labor/employee_wages/types/get_employee_wages_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module EmployeeWages + module Types + class GetEmployeeWagesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/employee_wages/types/list_employee_wages_request.rb b/lib/square/labor/employee_wages/types/list_employee_wages_request.rb new file mode 100644 index 000000000..5332a6857 --- /dev/null +++ b/lib/square/labor/employee_wages/types/list_employee_wages_request.rb @@ -0,0 +1,15 @@ + +module Square + module Labor + module EmployeeWages + module Types + class ListEmployeeWagesRequest < Internal::Types::Model + field :employee_id, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/shifts/client.rb b/lib/square/labor/shifts/client.rb new file mode 100644 index 000000000..d6a27de73 --- /dev/null +++ b/lib/square/labor/shifts/client.rb @@ -0,0 +1,117 @@ + +module Square + module Labor + module Shifts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::Shifts::Client] + def initialize(client) + @client = client + end + + # Creates a new `Shift`. + # + # A `Shift` represents a complete workday for a single team member. + # You must provide the following values in your request to this + # endpoint: + # + # - `location_id` + # - `team_member_id` + # - `start_at` + # + # An attempt to create a new `Shift` can result in a `BAD_REQUEST` error when: + # - The `status` of the new `Shift` is `OPEN` and the team member has another + # shift with an `OPEN` status. + # - The `start_at` date is in the future. + # - The `start_at` or `end_at` date overlaps another shift for the same team member. + # - The `Break` instances are set in the request and a break `start_at` + # is before the `Shift.start_at`, a break `end_at` is after + # the `Shift.end_at`, or both. + # + # @return [Square::Types::CreateShiftResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a paginated list of `Shift` records for a business. + # The list to be returned can be filtered by: + # - Location IDs + # - Team member IDs + # - Shift status (`OPEN` or `CLOSED`) + # - Shift start + # - Shift end + # - Workday details + # + # The list can be sorted by: + # - `START_AT` + # - `END_AT` + # - `CREATED_AT` + # - `UPDATED_AT` + # + # @return [Square::Types::SearchShiftsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchShiftsResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single `Shift` specified by `id`. + # + # @return [Square::Types::GetShiftResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an existing `Shift`. + # + # When adding a `Break` to a `Shift`, any earlier `Break` instances in the `Shift` have + # the `end_at` property set to a valid RFC-3339 datetime string. + # + # When closing a `Shift`, all `Break` instances in the `Shift` must be complete with `end_at` + # set on each `Break`. + # + # @return [Square::Types::UpdateShiftResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateShiftResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a `Shift`. + # + # @return [Square::Types::DeleteShiftResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteShiftResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/labor/shifts/types/create_shift_request.rb b/lib/square/labor/shifts/types/create_shift_request.rb new file mode 100644 index 000000000..7a746bdf3 --- /dev/null +++ b/lib/square/labor/shifts/types/create_shift_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module Shifts + module Types + class CreateShiftRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :shift, Square::Types::Shift, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/shifts/types/delete_shifts_request.rb b/lib/square/labor/shifts/types/delete_shifts_request.rb new file mode 100644 index 000000000..fc50ae845 --- /dev/null +++ b/lib/square/labor/shifts/types/delete_shifts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module Shifts + module Types + class DeleteShiftsRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/shifts/types/get_shifts_request.rb b/lib/square/labor/shifts/types/get_shifts_request.rb new file mode 100644 index 000000000..0d6662adf --- /dev/null +++ b/lib/square/labor/shifts/types/get_shifts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module Shifts + module Types + class GetShiftsRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/shifts/types/search_shifts_request.rb b/lib/square/labor/shifts/types/search_shifts_request.rb new file mode 100644 index 000000000..550fd56c2 --- /dev/null +++ b/lib/square/labor/shifts/types/search_shifts_request.rb @@ -0,0 +1,15 @@ + +module Square + module Labor + module Shifts + module Types + class SearchShiftsRequest < Internal::Types::Model + field :query, Square::Types::ShiftQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/shifts/types/update_shift_request.rb b/lib/square/labor/shifts/types/update_shift_request.rb new file mode 100644 index 000000000..5b8457af5 --- /dev/null +++ b/lib/square/labor/shifts/types/update_shift_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module Shifts + module Types + class UpdateShiftRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :shift, Square::Types::Shift, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/team_member_wages/client.rb b/lib/square/labor/team_member_wages/client.rb new file mode 100644 index 000000000..378da3be3 --- /dev/null +++ b/lib/square/labor/team_member_wages/client.rb @@ -0,0 +1,42 @@ + +module Square + module Labor + module TeamMemberWages + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::TeamMemberWages::Client] + def initialize(client) + @client = client + end + + # Returns a paginated list of `TeamMemberWage` instances for a business. + # + # @return [Square::Types::ListTeamMemberWagesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListTeamMemberWagesResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a single `TeamMemberWage` specified by `id`. + # + # @return [Square::Types::GetTeamMemberWageResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTeamMemberWageResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/labor/team_member_wages/types/get_team_member_wages_request.rb b/lib/square/labor/team_member_wages/types/get_team_member_wages_request.rb new file mode 100644 index 000000000..0127a084d --- /dev/null +++ b/lib/square/labor/team_member_wages/types/get_team_member_wages_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module TeamMemberWages + module Types + class GetTeamMemberWagesRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/team_member_wages/types/list_team_member_wages_request.rb b/lib/square/labor/team_member_wages/types/list_team_member_wages_request.rb new file mode 100644 index 000000000..acccc6739 --- /dev/null +++ b/lib/square/labor/team_member_wages/types/list_team_member_wages_request.rb @@ -0,0 +1,15 @@ + +module Square + module Labor + module TeamMemberWages + module Types + class ListTeamMemberWagesRequest < Internal::Types::Model + field :team_member_id, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/types/bulk_publish_scheduled_shifts_request.rb b/lib/square/labor/types/bulk_publish_scheduled_shifts_request.rb new file mode 100644 index 000000000..006a7e6dc --- /dev/null +++ b/lib/square/labor/types/bulk_publish_scheduled_shifts_request.rb @@ -0,0 +1,12 @@ + +module Square + module Labor + module Types + class BulkPublishScheduledShiftsRequest < Internal::Types::Model + field :scheduled_shifts, Internal::Types::Hash[String, Square::Types::BulkPublishScheduledShiftsData], optional: false, nullable: false + field :scheduled_shift_notification_audience, Square::Types::ScheduledShiftNotificationAudience, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/create_scheduled_shift_request.rb b/lib/square/labor/types/create_scheduled_shift_request.rb new file mode 100644 index 000000000..3d35227fb --- /dev/null +++ b/lib/square/labor/types/create_scheduled_shift_request.rb @@ -0,0 +1,12 @@ + +module Square + module Labor + module Types + class CreateScheduledShiftRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :scheduled_shift, Square::Types::ScheduledShift, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/create_timecard_request.rb b/lib/square/labor/types/create_timecard_request.rb new file mode 100644 index 000000000..01abbc18b --- /dev/null +++ b/lib/square/labor/types/create_timecard_request.rb @@ -0,0 +1,12 @@ + +module Square + module Labor + module Types + class CreateTimecardRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :timecard, Square::Types::Timecard, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/delete_timecard_request.rb b/lib/square/labor/types/delete_timecard_request.rb new file mode 100644 index 000000000..32d650a38 --- /dev/null +++ b/lib/square/labor/types/delete_timecard_request.rb @@ -0,0 +1,11 @@ + +module Square + module Labor + module Types + class DeleteTimecardRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/publish_scheduled_shift_request.rb b/lib/square/labor/types/publish_scheduled_shift_request.rb new file mode 100644 index 000000000..b34e897e9 --- /dev/null +++ b/lib/square/labor/types/publish_scheduled_shift_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module Types + class PublishScheduledShiftRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + field :scheduled_shift_notification_audience, Square::Types::ScheduledShiftNotificationAudience, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/retrieve_scheduled_shift_request.rb b/lib/square/labor/types/retrieve_scheduled_shift_request.rb new file mode 100644 index 000000000..4857d7fd8 --- /dev/null +++ b/lib/square/labor/types/retrieve_scheduled_shift_request.rb @@ -0,0 +1,11 @@ + +module Square + module Labor + module Types + class RetrieveScheduledShiftRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/retrieve_timecard_request.rb b/lib/square/labor/types/retrieve_timecard_request.rb new file mode 100644 index 000000000..d4b21bf09 --- /dev/null +++ b/lib/square/labor/types/retrieve_timecard_request.rb @@ -0,0 +1,11 @@ + +module Square + module Labor + module Types + class RetrieveTimecardRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/search_scheduled_shifts_request.rb b/lib/square/labor/types/search_scheduled_shifts_request.rb new file mode 100644 index 000000000..8fcf11592 --- /dev/null +++ b/lib/square/labor/types/search_scheduled_shifts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module Types + class SearchScheduledShiftsRequest < Internal::Types::Model + field :query, Square::Types::ScheduledShiftQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/search_timecards_request.rb b/lib/square/labor/types/search_timecards_request.rb new file mode 100644 index 000000000..804bfcd63 --- /dev/null +++ b/lib/square/labor/types/search_timecards_request.rb @@ -0,0 +1,13 @@ + +module Square + module Labor + module Types + class SearchTimecardsRequest < Internal::Types::Model + field :query, Square::Types::TimecardQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/update_scheduled_shift_request.rb b/lib/square/labor/types/update_scheduled_shift_request.rb new file mode 100644 index 000000000..8ed353749 --- /dev/null +++ b/lib/square/labor/types/update_scheduled_shift_request.rb @@ -0,0 +1,12 @@ + +module Square + module Labor + module Types + class UpdateScheduledShiftRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :scheduled_shift, Square::Types::ScheduledShift, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/types/update_timecard_request.rb b/lib/square/labor/types/update_timecard_request.rb new file mode 100644 index 000000000..9191ca4f8 --- /dev/null +++ b/lib/square/labor/types/update_timecard_request.rb @@ -0,0 +1,12 @@ + +module Square + module Labor + module Types + class UpdateTimecardRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :timecard, Square::Types::Timecard, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/labor/workweek_configs/client.rb b/lib/square/labor/workweek_configs/client.rb new file mode 100644 index 000000000..403b40224 --- /dev/null +++ b/lib/square/labor/workweek_configs/client.rb @@ -0,0 +1,42 @@ + +module Square + module Labor + module WorkweekConfigs + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Labor::WorkweekConfigs::Client] + def initialize(client) + @client = client + end + + # Returns a list of `WorkweekConfig` instances for a business. + # + # @return [Square::Types::ListWorkweekConfigsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListWorkweekConfigsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a `WorkweekConfig`. + # + # @return [Square::Types::UpdateWorkweekConfigResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateWorkweekConfigResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/labor/workweek_configs/types/list_workweek_configs_request.rb b/lib/square/labor/workweek_configs/types/list_workweek_configs_request.rb new file mode 100644 index 000000000..91dc48dbb --- /dev/null +++ b/lib/square/labor/workweek_configs/types/list_workweek_configs_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module WorkweekConfigs + module Types + class ListWorkweekConfigsRequest < Internal::Types::Model + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/labor/workweek_configs/types/update_workweek_config_request.rb b/lib/square/labor/workweek_configs/types/update_workweek_config_request.rb new file mode 100644 index 000000000..2b28326bc --- /dev/null +++ b/lib/square/labor/workweek_configs/types/update_workweek_config_request.rb @@ -0,0 +1,14 @@ + +module Square + module Labor + module WorkweekConfigs + module Types + class UpdateWorkweekConfigRequest < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :workweek_config, Square::Types::WorkweekConfig, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/client.rb b/lib/square/locations/client.rb new file mode 100644 index 000000000..2fa01f381 --- /dev/null +++ b/lib/square/locations/client.rb @@ -0,0 +1,93 @@ + +module Square + module Locations + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Locations::Client] + def initialize(client) + @client = client + end + + # Provides details about all of the seller's [locations](https://developer.squareup.com/docs/locations-api), + # including those with an inactive status. Locations are listed alphabetically by `name`. + # + # @return [Square::Types::ListLocationsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLocationsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a [location](https://developer.squareup.com/docs/locations-api). + # Creating new locations allows for separate configuration of receipt layouts, item prices, + # and sales reports. Developers can use locations to separate sales activity through applications + # that integrate with Square from sales activity elsewhere in a seller's account. + # Locations created programmatically with the Locations API last forever and + # are visible to the seller for their own management. Therefore, ensure that + # each location has a sensible and unique name. + # + # @return [Square::Types::CreateLocationResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateLocationResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves details of a single location. Specify "main" + # as the location ID to retrieve details of the [main location](https://developer.squareup.com/docs/locations-api#about-the-main-location). + # + # @return [Square::Types::GetLocationResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetLocationResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a [location](https://developer.squareup.com/docs/locations-api). + # + # @return [Square::Types::UpdateLocationResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateLocationResponse.load(_response.body) + else + raise _response.body + end + end + + # Links a `checkoutId` to a `checkout_page_url` that customers are + # directed to in order to provide their payment information using a + # payment processing workflow hosted on connect.squareup.com. + # + # + # NOTE: The Checkout API has been updated with new features. + # For more information, see [Checkout API highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-highlights). + # + # @return [Square::Types::CreateCheckoutResponse] + def checkouts(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateCheckoutResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/client.rb b/lib/square/locations/custom_attribute_definitions/client.rb new file mode 100644 index 000000000..f80350ec2 --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/client.rb @@ -0,0 +1,98 @@ + +module Square + module Locations + module CustomAttributeDefinitions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Locations::CustomAttributeDefinitions::Client] + def initialize(client) + @client = client + end + + # Lists the location-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + # When all response pages are retrieved, the results include all custom attribute definitions + # that are visible to the requesting application, including those that are created by other + # applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListLocationCustomAttributeDefinitionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLocationCustomAttributeDefinitionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # Use this endpoint to define a custom attribute that can be associated with locations. + # A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + # for a custom attribute. After the definition is created, you can call + # [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) or + # [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) + # to set the custom attribute for locations. + # + # @return [Square::Types::CreateLocationCustomAttributeDefinitionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateLocationCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # To retrieve a custom attribute definition created by another application, the `visibility` + # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveLocationCustomAttributeDefinitionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveLocationCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a location-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + # `schema` for a `Selection` data type. + # Only the definition owner can update a custom attribute definition. + # + # @return [Square::Types::UpdateLocationCustomAttributeDefinitionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateLocationCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a location-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # Deleting a custom attribute definition also deletes the corresponding custom attribute from + # all locations. + # Only the definition owner can delete a custom attribute definition. + # + # @return [Square::Types::DeleteLocationCustomAttributeDefinitionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteLocationCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request.rb b/lib/square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request.rb new file mode 100644 index 000000000..3ed320dc2 --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/types/create_location_custom_attribute_definition_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module CustomAttributeDefinitions + module Types + class CreateLocationCustomAttributeDefinitionRequest < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb b/lib/square/locations/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..1f7ad88f1 --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Locations + module CustomAttributeDefinitions + module Types + class DeleteCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb b/lib/square/locations/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..5018e91e5 --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module CustomAttributeDefinitions + module Types + class GetCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb b/lib/square/locations/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..c96e0f8c1 --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb @@ -0,0 +1,15 @@ + +module Square + module Locations + module CustomAttributeDefinitions + module Types + class ListCustomAttributeDefinitionsRequest < Internal::Types::Model + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request.rb b/lib/square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request.rb new file mode 100644 index 000000000..280716e7f --- /dev/null +++ b/lib/square/locations/custom_attribute_definitions/types/update_location_custom_attribute_definition_request.rb @@ -0,0 +1,15 @@ + +module Square + module Locations + module CustomAttributeDefinitions + module Types + class UpdateLocationCustomAttributeDefinitionRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/client.rb b/lib/square/locations/custom_attributes/client.rb new file mode 100644 index 000000000..3721c3dc4 --- /dev/null +++ b/lib/square/locations/custom_attributes/client.rb @@ -0,0 +1,121 @@ + +module Square + module Locations + module CustomAttributes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Locations::CustomAttributes::Client] + def initialize(client) + @client = client + end + + # Deletes [custom attributes](entity:CustomAttribute) for locations as a bulk operation. + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkDeleteLocationCustomAttributesResponse] + def batch_delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkDeleteLocationCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates [custom attributes](entity:CustomAttribute) for locations as a bulk operation. + # Use this endpoint to set the value of one or more custom attributes for one or more locations. + # A custom attribute is based on a custom attribute definition in a Square seller account, which is + # created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. + # This `BulkUpsertLocationCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + # requests and returns a map of individual upsert responses. Each upsert request has a unique ID + # and provides a location ID and custom attribute. Each upsert response is returned with the ID + # of the corresponding request. + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkUpsertLocationCustomAttributesResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkUpsertLocationCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists the [custom attributes](entity:CustomAttribute) associated with a location. + # You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + # in the same call. + # When all response pages are retrieved, the results include all custom attributes that are + # visible to the requesting application, including those that are owned by other applications + # and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListLocationCustomAttributesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLocationCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a [custom attribute](entity:CustomAttribute) associated with a location. + # You can use the `with_definition` query parameter to also retrieve the custom attribute definition + # in the same call. + # To retrieve a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveLocationCustomAttributeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveLocationCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates a [custom attribute](entity:CustomAttribute) for a location. + # Use this endpoint to set the value of a custom attribute for a specified location. + # A custom attribute is based on a custom attribute definition in a Square seller account, which + # is created using the [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) endpoint. + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::UpsertLocationCustomAttributeResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertLocationCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a [custom attribute](entity:CustomAttribute) associated with a location. + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::DeleteLocationCustomAttributeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteLocationCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request.rb b/lib/square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request.rb new file mode 100644 index 000000000..a1322763e --- /dev/null +++ b/lib/square/locations/custom_attributes/types/bulk_delete_location_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Locations + module CustomAttributes + module Types + class BulkDeleteLocationCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request.rb b/lib/square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request.rb new file mode 100644 index 000000000..3a0262311 --- /dev/null +++ b/lib/square/locations/custom_attributes/types/bulk_upsert_location_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Locations + module CustomAttributes + module Types + class BulkUpsertLocationCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/delete_custom_attributes_request.rb b/lib/square/locations/custom_attributes/types/delete_custom_attributes_request.rb new file mode 100644 index 000000000..984d28785 --- /dev/null +++ b/lib/square/locations/custom_attributes/types/delete_custom_attributes_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module CustomAttributes + module Types + class DeleteCustomAttributesRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/get_custom_attributes_request.rb b/lib/square/locations/custom_attributes/types/get_custom_attributes_request.rb new file mode 100644 index 000000000..b2b0ace25 --- /dev/null +++ b/lib/square/locations/custom_attributes/types/get_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Locations + module CustomAttributes + module Types + class GetCustomAttributesRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :with_definition, Internal::Types::Boolean, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/list_custom_attributes_request.rb b/lib/square/locations/custom_attributes/types/list_custom_attributes_request.rb new file mode 100644 index 000000000..54fdb804a --- /dev/null +++ b/lib/square/locations/custom_attributes/types/list_custom_attributes_request.rb @@ -0,0 +1,17 @@ + +module Square + module Locations + module CustomAttributes + module Types + class ListCustomAttributesRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :with_definitions, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/custom_attributes/types/upsert_location_custom_attribute_request.rb b/lib/square/locations/custom_attributes/types/upsert_location_custom_attribute_request.rb new file mode 100644 index 000000000..8295b610d --- /dev/null +++ b/lib/square/locations/custom_attributes/types/upsert_location_custom_attribute_request.rb @@ -0,0 +1,16 @@ + +module Square + module Locations + module CustomAttributes + module Types + class UpsertLocationCustomAttributeRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/transactions/client.rb b/lib/square/locations/transactions/client.rb new file mode 100644 index 000000000..ea223533f --- /dev/null +++ b/lib/square/locations/transactions/client.rb @@ -0,0 +1,83 @@ + +module Square + module Locations + module Transactions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Locations::Transactions::Client] + def initialize(client) + @client = client + end + + # Lists transactions for a particular location. + # + # Transactions include payment information from sales and exchanges and refund + # information from returns and exchanges. + # + # Max results per [page](https://developer.squareup.com/docs/working-with-apis/pagination): 50 + # + # @return [Square::Types::ListTransactionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListTransactionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves details for a single transaction. + # + # @return [Square::Types::GetTransactionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTransactionResponse.load(_response.body) + else + raise _response.body + end + end + + # Captures a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) + # endpoint with a `delay_capture` value of `true`. + # + # + # See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) + # for more information. + # + # @return [Square::Types::CaptureTransactionResponse] + def capture(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CaptureTransactionResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels a transaction that was created with the [Charge](api-endpoint:Transactions-Charge) + # endpoint with a `delay_capture` value of `true`. + # + # + # See [Delayed capture transactions](https://developer.squareup.com/docs/payments/transactions/overview#delayed-capture) + # for more information. + # + # @return [Square::Types::VoidTransactionResponse] + def void(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::VoidTransactionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/locations/transactions/types/capture_transactions_request.rb b/lib/square/locations/transactions/types/capture_transactions_request.rb new file mode 100644 index 000000000..8ea0d90ea --- /dev/null +++ b/lib/square/locations/transactions/types/capture_transactions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module Transactions + module Types + class CaptureTransactionsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :transaction_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/transactions/types/get_transactions_request.rb b/lib/square/locations/transactions/types/get_transactions_request.rb new file mode 100644 index 000000000..cd7ff0d14 --- /dev/null +++ b/lib/square/locations/transactions/types/get_transactions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module Transactions + module Types + class GetTransactionsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :transaction_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/transactions/types/list_transactions_request.rb b/lib/square/locations/transactions/types/list_transactions_request.rb new file mode 100644 index 000000000..53c567060 --- /dev/null +++ b/lib/square/locations/transactions/types/list_transactions_request.rb @@ -0,0 +1,17 @@ + +module Square + module Locations + module Transactions + module Types + class ListTransactionsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/transactions/types/void_transactions_request.rb b/lib/square/locations/transactions/types/void_transactions_request.rb new file mode 100644 index 000000000..424993fbe --- /dev/null +++ b/lib/square/locations/transactions/types/void_transactions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Locations + module Transactions + module Types + class VoidTransactionsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :transaction_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/locations/types/create_checkout_request.rb b/lib/square/locations/types/create_checkout_request.rb new file mode 100644 index 000000000..bad35d605 --- /dev/null +++ b/lib/square/locations/types/create_checkout_request.rb @@ -0,0 +1,20 @@ + +module Square + module Locations + module Types + class CreateCheckoutRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :order, Square::Types::CreateOrderRequest, optional: false, nullable: false + field :ask_for_shipping_address, Internal::Types::Boolean, optional: true, nullable: false + field :merchant_support_email, String, optional: true, nullable: false + field :pre_populate_buyer_email, String, optional: true, nullable: false + field :pre_populate_shipping_address, Square::Types::Address, optional: true, nullable: false + field :redirect_url, String, optional: true, nullable: false + field :additional_recipients, Internal::Types::Array[Square::Types::ChargeRequestAdditionalRecipient], optional: true, nullable: false + field :note, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/locations/types/create_location_request.rb b/lib/square/locations/types/create_location_request.rb new file mode 100644 index 000000000..bb3448ab3 --- /dev/null +++ b/lib/square/locations/types/create_location_request.rb @@ -0,0 +1,11 @@ + +module Square + module Locations + module Types + class CreateLocationRequest < Internal::Types::Model + field :location, Square::Types::Location, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/locations/types/get_locations_request.rb b/lib/square/locations/types/get_locations_request.rb new file mode 100644 index 000000000..0f785dd5e --- /dev/null +++ b/lib/square/locations/types/get_locations_request.rb @@ -0,0 +1,11 @@ + +module Square + module Locations + module Types + class GetLocationsRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/locations/types/update_location_request.rb b/lib/square/locations/types/update_location_request.rb new file mode 100644 index 000000000..1026b1418 --- /dev/null +++ b/lib/square/locations/types/update_location_request.rb @@ -0,0 +1,12 @@ + +module Square + module Locations + module Types + class UpdateLocationRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :location, Square::Types::Location, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/loyalty/accounts/client.rb b/lib/square/loyalty/accounts/client.rb new file mode 100644 index 000000000..deb14f932 --- /dev/null +++ b/lib/square/loyalty/accounts/client.rb @@ -0,0 +1,102 @@ + +module Square + module Loyalty + module Accounts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Loyalty::Accounts::Client] + def initialize(client) + @client = client + end + + # Creates a loyalty account. To create a loyalty account, you must provide the `program_id` and a `mapping` with the `phone_number` of the buyer. + # + # @return [Square::Types::CreateLoyaltyAccountResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateLoyaltyAccountResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for loyalty accounts in a loyalty program. + # + # You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty `query` object or omit it entirely. + # + # Search results are sorted by `created_at` in ascending order. + # + # @return [Square::Types::SearchLoyaltyAccountsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchLoyaltyAccountsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a loyalty account. + # + # @return [Square::Types::GetLoyaltyAccountResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetLoyaltyAccountResponse.load(_response.body) + else + raise _response.body + end + end + + # Adds points earned from a purchase to a [loyalty account](entity:LoyaltyAccount). + # + # - If you are using the Orders API to manage orders, provide the `order_id`. Square reads the order + # to compute the points earned from both the base loyalty program and an associated + # [loyalty promotion](entity:LoyaltyPromotion). For purchases that qualify for multiple accrual + # rules, Square computes points based on the accrual rule that grants the most points. + # For purchases that qualify for multiple promotions, Square computes points based on the most + # recently created promotion. A purchase must first qualify for program points to be eligible for promotion points. + # + # - If you are not using the Orders API to manage orders, provide `points` with the number of points to add. + # You must first perform a client-side computation of the points earned from the loyalty program and + # loyalty promotion. For spend-based and visit-based programs, you can call [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) + # to compute the points earned from the base loyalty program. For information about computing points earned from a loyalty promotion, see + # [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). + # + # @return [Square::Types::AccumulateLoyaltyPointsResponse] + def accumulate_points(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::AccumulateLoyaltyPointsResponse.load(_response.body) + else + raise _response.body + end + end + + # Adds points to or subtracts points from a buyer's account. + # + # Use this endpoint only when you need to manually adjust points. Otherwise, in your application flow, you call + # [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) + # to add points when a buyer pays for the purchase. + # + # @return [Square::Types::AdjustLoyaltyPointsResponse] + def adjust(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::AdjustLoyaltyPointsResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/loyalty/accounts/types/accumulate_loyalty_points_request.rb b/lib/square/loyalty/accounts/types/accumulate_loyalty_points_request.rb new file mode 100644 index 000000000..79f83218f --- /dev/null +++ b/lib/square/loyalty/accounts/types/accumulate_loyalty_points_request.rb @@ -0,0 +1,16 @@ + +module Square + module Loyalty + module Accounts + module Types + class AccumulateLoyaltyPointsRequest < Internal::Types::Model + field :account_id, String, optional: false, nullable: false + field :accumulate_points, Square::Types::LoyaltyEventAccumulatePoints, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/accounts/types/adjust_loyalty_points_request.rb b/lib/square/loyalty/accounts/types/adjust_loyalty_points_request.rb new file mode 100644 index 000000000..702cf4c68 --- /dev/null +++ b/lib/square/loyalty/accounts/types/adjust_loyalty_points_request.rb @@ -0,0 +1,16 @@ + +module Square + module Loyalty + module Accounts + module Types + class AdjustLoyaltyPointsRequest < Internal::Types::Model + field :account_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :adjust_points, Square::Types::LoyaltyEventAdjustPoints, optional: false, nullable: false + field :allow_negative_balance, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/accounts/types/create_loyalty_account_request.rb b/lib/square/loyalty/accounts/types/create_loyalty_account_request.rb new file mode 100644 index 000000000..c862730df --- /dev/null +++ b/lib/square/loyalty/accounts/types/create_loyalty_account_request.rb @@ -0,0 +1,14 @@ + +module Square + module Loyalty + module Accounts + module Types + class CreateLoyaltyAccountRequest < Internal::Types::Model + field :loyalty_account, Square::Types::LoyaltyAccount, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/accounts/types/get_accounts_request.rb b/lib/square/loyalty/accounts/types/get_accounts_request.rb new file mode 100644 index 000000000..0a48f9a71 --- /dev/null +++ b/lib/square/loyalty/accounts/types/get_accounts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Loyalty + module Accounts + module Types + class GetAccountsRequest < Internal::Types::Model + field :account_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/accounts/types/search_loyalty_accounts_request.rb b/lib/square/loyalty/accounts/types/search_loyalty_accounts_request.rb new file mode 100644 index 000000000..c899f58cb --- /dev/null +++ b/lib/square/loyalty/accounts/types/search_loyalty_accounts_request.rb @@ -0,0 +1,15 @@ + +module Square + module Loyalty + module Accounts + module Types + class SearchLoyaltyAccountsRequest < Internal::Types::Model + field :query, Square::Types::SearchLoyaltyAccountsRequestLoyaltyAccountQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/client.rb b/lib/square/loyalty/client.rb new file mode 100644 index 000000000..692fd18e6 --- /dev/null +++ b/lib/square/loyalty/client.rb @@ -0,0 +1,34 @@ + +module Square + module Loyalty + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Loyalty::Client] + def initialize(client) + @client = client + end + + # Searches for loyalty events. + # + # A Square loyalty program maintains a ledger of events that occur during the lifetime of a + # buyer's loyalty account. Each change in the point balance + # (for example, points earned, points redeemed, and points expired) is + # recorded in the ledger. Using this endpoint, you can search the ledger for events. + # + # Search results are sorted by `created_at` in descending order. + # + # @return [Square::Types::SearchLoyaltyEventsResponse] + def search_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchLoyaltyEventsResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/loyalty/programs/client.rb b/lib/square/loyalty/programs/client.rb new file mode 100644 index 000000000..18400eb82 --- /dev/null +++ b/lib/square/loyalty/programs/client.rb @@ -0,0 +1,75 @@ + +module Square + module Loyalty + module Programs + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Loyalty::Programs::Client] + def initialize(client) + @client = client + end + + # Returns a list of loyalty programs in the seller's account. + # Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + # + # + # Replaced with [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) when used with the keyword `main`. + # + # @return [Square::Types::ListLoyaltyProgramsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLoyaltyProgramsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves the loyalty program in a seller's account, specified by the program ID or the keyword `main`. + # + # Loyalty programs define how buyers can earn points and redeem points for rewards. Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + # + # @return [Square::Types::GetLoyaltyProgramResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetLoyaltyProgramResponse.load(_response.body) + else + raise _response.body + end + end + + # Calculates the number of points a buyer can earn from a purchase. Applications might call this endpoint + # to display the points to the buyer. + # + # - If you are using the Orders API to manage orders, provide the `order_id` and (optional) `loyalty_account_id`. + # Square reads the order to compute the points earned from the base loyalty program and an associated + # [loyalty promotion](entity:LoyaltyPromotion). + # + # - If you are not using the Orders API to manage orders, provide `transaction_amount_money` with the + # purchase amount. Square uses this amount to calculate the points earned from the base loyalty program, + # but not points earned from a loyalty promotion. For spend-based and visit-based programs, the `tax_mode` + # setting of the accrual rule indicates how taxes should be treated for loyalty points accrual. + # If the purchase qualifies for program points, call + # [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) and perform a client-side computation + # to calculate whether the purchase also qualifies for promotion points. For more information, see + # [Calculating promotion points](https://developer.squareup.com/docs/loyalty-api/loyalty-promotions#calculate-promotion-points). + # + # @return [Square::Types::CalculateLoyaltyPointsResponse] + def calculate(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CalculateLoyaltyPointsResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/loyalty/programs/promotions/client.rb b/lib/square/loyalty/programs/promotions/client.rb new file mode 100644 index 000000000..fe4824356 --- /dev/null +++ b/lib/square/loyalty/programs/promotions/client.rb @@ -0,0 +1,81 @@ + +module Square + module Loyalty + module Programs + module Promotions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Loyalty::Programs::Promotions::Client] + def initialize(client) + @client = client + end + + # Lists the loyalty promotions associated with a [loyalty program](entity:LoyaltyProgram). + # Results are sorted by the `created_at` date in descending order (newest to oldest). + # + # @return [Square::Types::ListLoyaltyPromotionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListLoyaltyPromotionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a loyalty promotion for a [loyalty program](entity:LoyaltyProgram). A loyalty promotion + # enables buyers to earn points in addition to those earned from the base loyalty program. + # + # This endpoint sets the loyalty promotion to the `ACTIVE` or `SCHEDULED` status, depending on the + # `available_time` setting. A loyalty program can have a maximum of 10 loyalty promotions with an + # `ACTIVE` or `SCHEDULED` status. + # + # @return [Square::Types::CreateLoyaltyPromotionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateLoyaltyPromotionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a loyalty promotion. + # + # @return [Square::Types::GetLoyaltyPromotionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetLoyaltyPromotionResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels a loyalty promotion. Use this endpoint to cancel an `ACTIVE` promotion earlier than the + # end date, cancel an `ACTIVE` promotion when an end date is not specified, or cancel a `SCHEDULED` promotion. + # Because updating a promotion is not supported, you can also use this endpoint to cancel a promotion before + # you create a new one. + # + # This endpoint sets the loyalty promotion to the `CANCELED` state + # + # @return [Square::Types::CancelLoyaltyPromotionResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelLoyaltyPromotionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end + end +end diff --git a/lib/square/loyalty/programs/promotions/types/cancel_promotions_request.rb b/lib/square/loyalty/programs/promotions/types/cancel_promotions_request.rb new file mode 100644 index 000000000..defb195b5 --- /dev/null +++ b/lib/square/loyalty/programs/promotions/types/cancel_promotions_request.rb @@ -0,0 +1,16 @@ + +module Square + module Loyalty + module Programs + module Promotions + module Types + class CancelPromotionsRequest < Internal::Types::Model + field :promotion_id, String, optional: false, nullable: false + field :program_id, String, optional: false, nullable: false + + end + end + end + end + end +end diff --git a/lib/square/loyalty/programs/promotions/types/create_loyalty_promotion_request.rb b/lib/square/loyalty/programs/promotions/types/create_loyalty_promotion_request.rb new file mode 100644 index 000000000..c9fce6737 --- /dev/null +++ b/lib/square/loyalty/programs/promotions/types/create_loyalty_promotion_request.rb @@ -0,0 +1,17 @@ + +module Square + module Loyalty + module Programs + module Promotions + module Types + class CreateLoyaltyPromotionRequest < Internal::Types::Model + field :program_id, String, optional: false, nullable: false + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + + end + end + end + end + end +end diff --git a/lib/square/loyalty/programs/promotions/types/get_promotions_request.rb b/lib/square/loyalty/programs/promotions/types/get_promotions_request.rb new file mode 100644 index 000000000..1a5473d6b --- /dev/null +++ b/lib/square/loyalty/programs/promotions/types/get_promotions_request.rb @@ -0,0 +1,16 @@ + +module Square + module Loyalty + module Programs + module Promotions + module Types + class GetPromotionsRequest < Internal::Types::Model + field :promotion_id, String, optional: false, nullable: false + field :program_id, String, optional: false, nullable: false + + end + end + end + end + end +end diff --git a/lib/square/loyalty/programs/promotions/types/list_promotions_request.rb b/lib/square/loyalty/programs/promotions/types/list_promotions_request.rb new file mode 100644 index 000000000..301815e7b --- /dev/null +++ b/lib/square/loyalty/programs/promotions/types/list_promotions_request.rb @@ -0,0 +1,18 @@ + +module Square + module Loyalty + module Programs + module Promotions + module Types + class ListPromotionsRequest < Internal::Types::Model + field :program_id, String, optional: false, nullable: false + field :status, Square::Types::LoyaltyPromotionStatus, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end + end +end diff --git a/lib/square/loyalty/programs/types/calculate_loyalty_points_request.rb b/lib/square/loyalty/programs/types/calculate_loyalty_points_request.rb new file mode 100644 index 000000000..7b9ea907d --- /dev/null +++ b/lib/square/loyalty/programs/types/calculate_loyalty_points_request.rb @@ -0,0 +1,16 @@ + +module Square + module Loyalty + module Programs + module Types + class CalculateLoyaltyPointsRequest < Internal::Types::Model + field :program_id, String, optional: false, nullable: false + field :order_id, String, optional: true, nullable: false + field :transaction_amount_money, Square::Types::Money, optional: true, nullable: false + field :loyalty_account_id, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/programs/types/get_programs_request.rb b/lib/square/loyalty/programs/types/get_programs_request.rb new file mode 100644 index 000000000..db26fbbfa --- /dev/null +++ b/lib/square/loyalty/programs/types/get_programs_request.rb @@ -0,0 +1,13 @@ + +module Square + module Loyalty + module Programs + module Types + class GetProgramsRequest < Internal::Types::Model + field :program_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/rewards/client.rb b/lib/square/loyalty/rewards/client.rb new file mode 100644 index 000000000..9d8f7e037 --- /dev/null +++ b/lib/square/loyalty/rewards/client.rb @@ -0,0 +1,112 @@ + +module Square + module Loyalty + module Rewards + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Loyalty::Rewards::Client] + def initialize(client) + @client = client + end + + # Creates a loyalty reward. In the process, the endpoint does following: + # + # - Uses the `reward_tier_id` in the request to determine the number of points + # to lock for this reward. + # - If the request includes `order_id`, it adds the reward and related discount to the order. + # + # After a reward is created, the points are locked and + # not available for the buyer to redeem another reward. + # + # @return [Square::Types::CreateLoyaltyRewardResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateLoyaltyRewardResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + # If you include a `query` object, `loyalty_account_id` is required and `status` is optional. + # + # If you know a reward ID, use the + # [RetrieveLoyaltyReward](api-endpoint:Loyalty-RetrieveLoyaltyReward) endpoint. + # + # Search results are sorted by `updated_at` in descending order. + # + # @return [Square::Types::SearchLoyaltyRewardsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchLoyaltyRewardsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a loyalty reward. + # + # @return [Square::Types::GetLoyaltyRewardResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetLoyaltyRewardResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a loyalty reward by doing the following: + # + # - Returns the loyalty points back to the loyalty account. + # - If an order ID was specified when the reward was created + # (see [CreateLoyaltyReward](api-endpoint:Loyalty-CreateLoyaltyReward)), + # it updates the order by removing the reward and related + # discounts. + # + # You cannot delete a reward that has reached the terminal state (REDEEMED). + # + # @return [Square::Types::DeleteLoyaltyRewardResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteLoyaltyRewardResponse.load(_response.body) + else + raise _response.body + end + end + + # Redeems a loyalty reward. + # + # The endpoint sets the reward to the `REDEEMED` terminal state. + # + # If you are using your own order processing system (not using the + # Orders API), you call this endpoint after the buyer paid for the + # purchase. + # + # After the reward reaches the terminal state, it cannot be deleted. + # In other words, points used for the reward cannot be returned + # to the account. + # + # @return [Square::Types::RedeemLoyaltyRewardResponse] + def redeem(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RedeemLoyaltyRewardResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/loyalty/rewards/types/create_loyalty_reward_request.rb b/lib/square/loyalty/rewards/types/create_loyalty_reward_request.rb new file mode 100644 index 000000000..1d47546aa --- /dev/null +++ b/lib/square/loyalty/rewards/types/create_loyalty_reward_request.rb @@ -0,0 +1,14 @@ + +module Square + module Loyalty + module Rewards + module Types + class CreateLoyaltyRewardRequest < Internal::Types::Model + field :reward, Square::Types::LoyaltyReward, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/rewards/types/delete_rewards_request.rb b/lib/square/loyalty/rewards/types/delete_rewards_request.rb new file mode 100644 index 000000000..b2b621c32 --- /dev/null +++ b/lib/square/loyalty/rewards/types/delete_rewards_request.rb @@ -0,0 +1,13 @@ + +module Square + module Loyalty + module Rewards + module Types + class DeleteRewardsRequest < Internal::Types::Model + field :reward_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/rewards/types/get_rewards_request.rb b/lib/square/loyalty/rewards/types/get_rewards_request.rb new file mode 100644 index 000000000..4adf3b489 --- /dev/null +++ b/lib/square/loyalty/rewards/types/get_rewards_request.rb @@ -0,0 +1,13 @@ + +module Square + module Loyalty + module Rewards + module Types + class GetRewardsRequest < Internal::Types::Model + field :reward_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/rewards/types/redeem_loyalty_reward_request.rb b/lib/square/loyalty/rewards/types/redeem_loyalty_reward_request.rb new file mode 100644 index 000000000..1d53e688f --- /dev/null +++ b/lib/square/loyalty/rewards/types/redeem_loyalty_reward_request.rb @@ -0,0 +1,15 @@ + +module Square + module Loyalty + module Rewards + module Types + class RedeemLoyaltyRewardRequest < Internal::Types::Model + field :reward_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/rewards/types/search_loyalty_rewards_request.rb b/lib/square/loyalty/rewards/types/search_loyalty_rewards_request.rb new file mode 100644 index 000000000..27a079f80 --- /dev/null +++ b/lib/square/loyalty/rewards/types/search_loyalty_rewards_request.rb @@ -0,0 +1,15 @@ + +module Square + module Loyalty + module Rewards + module Types + class SearchLoyaltyRewardsRequest < Internal::Types::Model + field :query, Square::Types::SearchLoyaltyRewardsRequestLoyaltyRewardQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/loyalty/types/search_loyalty_events_request.rb b/lib/square/loyalty/types/search_loyalty_events_request.rb new file mode 100644 index 000000000..1d9a88486 --- /dev/null +++ b/lib/square/loyalty/types/search_loyalty_events_request.rb @@ -0,0 +1,13 @@ + +module Square + module Loyalty + module Types + class SearchLoyaltyEventsRequest < Internal::Types::Model + field :query, Square::Types::LoyaltyEventQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/merchants/client.rb b/lib/square/merchants/client.rb new file mode 100644 index 000000000..fc378bf36 --- /dev/null +++ b/lib/square/merchants/client.rb @@ -0,0 +1,49 @@ + +module Square + module Merchants + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Merchants::Client] + def initialize(client) + @client = client + end + + # Provides details about the merchant associated with a given access token. + # + # The access token used to connect your application to a Square seller is associated + # with a single merchant. That means that `ListMerchants` returns a list + # with a single `Merchant` object. You can specify your personal access token + # to get your own merchant information or specify an OAuth token to get the + # information for the merchant that granted your application access. + # + # If you know the merchant ID, you can also use the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) + # endpoint to retrieve the merchant information. + # + # @return [Square::Types::ListMerchantsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListMerchantsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves the `Merchant` object for the given `merchant_id`. + # + # @return [Square::Types::GetMerchantResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetMerchantResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/client.rb b/lib/square/merchants/custom_attribute_definitions/client.rb new file mode 100644 index 000000000..8d6b613ea --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/client.rb @@ -0,0 +1,98 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Merchants::CustomAttributeDefinitions::Client] + def initialize(client) + @client = client + end + + # Lists the merchant-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + # When all response pages are retrieved, the results include all custom attribute definitions + # that are visible to the requesting application, including those that are created by other + # applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListMerchantCustomAttributeDefinitionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListMerchantCustomAttributeDefinitionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # Use this endpoint to define a custom attribute that can be associated with a merchant connecting to your application. + # A custom attribute definition specifies the `key`, `visibility`, `schema`, and other properties + # for a custom attribute. After the definition is created, you can call + # [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) or + # [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) + # to set the custom attribute for a merchant. + # + # @return [Square::Types::CreateMerchantCustomAttributeDefinitionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateMerchantCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # To retrieve a custom attribute definition created by another application, the `visibility` + # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveMerchantCustomAttributeDefinitionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveMerchantCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) for a Square seller account. + # Use this endpoint to update the following fields: `name`, `description`, `visibility`, or the + # `schema` for a `Selection` data type. + # Only the definition owner can update a custom attribute definition. + # + # @return [Square::Types::UpdateMerchantCustomAttributeDefinitionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateMerchantCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a merchant-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # Deleting a custom attribute definition also deletes the corresponding custom attribute from + # the merchant. + # Only the definition owner can delete a custom attribute definition. + # + # @return [Square::Types::DeleteMerchantCustomAttributeDefinitionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteMerchantCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request.rb b/lib/square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request.rb new file mode 100644 index 000000000..23a7259bb --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/types/create_merchant_custom_attribute_definition_request.rb @@ -0,0 +1,14 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + module Types + class CreateMerchantCustomAttributeDefinitionRequest < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb b/lib/square/merchants/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..0670c171d --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + module Types + class DeleteCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb b/lib/square/merchants/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..688c006ca --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + module Types + class GetCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb b/lib/square/merchants/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..4fb62dfdc --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb @@ -0,0 +1,15 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + module Types + class ListCustomAttributeDefinitionsRequest < Internal::Types::Model + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request.rb b/lib/square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request.rb new file mode 100644 index 000000000..d0e1b496a --- /dev/null +++ b/lib/square/merchants/custom_attribute_definitions/types/update_merchant_custom_attribute_definition_request.rb @@ -0,0 +1,15 @@ + +module Square + module Merchants + module CustomAttributeDefinitions + module Types + class UpdateMerchantCustomAttributeDefinitionRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/client.rb b/lib/square/merchants/custom_attributes/client.rb new file mode 100644 index 000000000..2afc2af61 --- /dev/null +++ b/lib/square/merchants/custom_attributes/client.rb @@ -0,0 +1,121 @@ + +module Square + module Merchants + module CustomAttributes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Merchants::CustomAttributes::Client] + def initialize(client) + @client = client + end + + # Deletes [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkDeleteMerchantCustomAttributesResponse] + def batch_delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkDeleteMerchantCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates [custom attributes](entity:CustomAttribute) for a merchant as a bulk operation. + # Use this endpoint to set the value of one or more custom attributes for a merchant. + # A custom attribute is based on a custom attribute definition in a Square seller account, which is + # created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. + # This `BulkUpsertMerchantCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + # requests and returns a map of individual upsert responses. Each upsert request has a unique ID + # and provides a merchant ID and custom attribute. Each upsert response is returned with the ID + # of the corresponding request. + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkUpsertMerchantCustomAttributesResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkUpsertMerchantCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists the [custom attributes](entity:CustomAttribute) associated with a merchant. + # You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + # in the same call. + # When all response pages are retrieved, the results include all custom attributes that are + # visible to the requesting application, including those that are owned by other applications + # and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListMerchantCustomAttributesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListMerchantCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a [custom attribute](entity:CustomAttribute) associated with a merchant. + # You can use the `with_definition` query parameter to also retrieve the custom attribute definition + # in the same call. + # To retrieve a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveMerchantCustomAttributeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveMerchantCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates a [custom attribute](entity:CustomAttribute) for a merchant. + # Use this endpoint to set the value of a custom attribute for a specified merchant. + # A custom attribute is based on a custom attribute definition in a Square seller account, which + # is created using the [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) endpoint. + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::UpsertMerchantCustomAttributeResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertMerchantCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a [custom attribute](entity:CustomAttribute) associated with a merchant. + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::DeleteMerchantCustomAttributeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteMerchantCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request.rb b/lib/square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request.rb new file mode 100644 index 000000000..e5f960e98 --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/bulk_delete_merchant_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class BulkDeleteMerchantCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request.rb b/lib/square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request.rb new file mode 100644 index 000000000..a05963e24 --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/bulk_upsert_merchant_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class BulkUpsertMerchantCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/delete_custom_attributes_request.rb b/lib/square/merchants/custom_attributes/types/delete_custom_attributes_request.rb new file mode 100644 index 000000000..22e92b9ee --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/delete_custom_attributes_request.rb @@ -0,0 +1,14 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class DeleteCustomAttributesRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/get_custom_attributes_request.rb b/lib/square/merchants/custom_attributes/types/get_custom_attributes_request.rb new file mode 100644 index 000000000..3dd104e64 --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/get_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class GetCustomAttributesRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :with_definition, Internal::Types::Boolean, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/list_custom_attributes_request.rb b/lib/square/merchants/custom_attributes/types/list_custom_attributes_request.rb new file mode 100644 index 000000000..55c6b4451 --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/list_custom_attributes_request.rb @@ -0,0 +1,17 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class ListCustomAttributesRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :with_definitions, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/custom_attributes/types/upsert_merchant_custom_attribute_request.rb b/lib/square/merchants/custom_attributes/types/upsert_merchant_custom_attribute_request.rb new file mode 100644 index 000000000..2a91c189a --- /dev/null +++ b/lib/square/merchants/custom_attributes/types/upsert_merchant_custom_attribute_request.rb @@ -0,0 +1,16 @@ + +module Square + module Merchants + module CustomAttributes + module Types + class UpsertMerchantCustomAttributeRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/merchants/types/get_merchants_request.rb b/lib/square/merchants/types/get_merchants_request.rb new file mode 100644 index 000000000..ce127f7ed --- /dev/null +++ b/lib/square/merchants/types/get_merchants_request.rb @@ -0,0 +1,11 @@ + +module Square + module Merchants + module Types + class GetMerchantsRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/merchants/types/list_merchants_request.rb b/lib/square/merchants/types/list_merchants_request.rb new file mode 100644 index 000000000..b30415b83 --- /dev/null +++ b/lib/square/merchants/types/list_merchants_request.rb @@ -0,0 +1,11 @@ + +module Square + module Merchants + module Types + class ListMerchantsRequest < Internal::Types::Model + field :cursor, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/mobile/client.rb b/lib/square/mobile/client.rb new file mode 100644 index 000000000..420246a92 --- /dev/null +++ b/lib/square/mobile/client.rb @@ -0,0 +1,41 @@ + +module Square + module Mobile + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Mobile::Client] + def initialize(client) + @client = client + end + + # __Note:__ This endpoint is used by the deprecated Reader SDK. + # Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. + # + # Generates code to authorize a mobile application to connect to a Square card reader. + # + # Authorization codes are one-time-use codes and expire 60 minutes after being issued. + # + # The `Authorization` header you provide to this endpoint must have the following format: + # + # ``` + # Authorization: Bearer ACCESS_TOKEN + # ``` + # + # Replace `ACCESS_TOKEN` with a + # [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + # + # @return [Square::Types::CreateMobileAuthorizationCodeResponse] + def authorization_code(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateMobileAuthorizationCodeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/mobile/types/create_mobile_authorization_code_request.rb b/lib/square/mobile/types/create_mobile_authorization_code_request.rb new file mode 100644 index 000000000..27ffd5d6e --- /dev/null +++ b/lib/square/mobile/types/create_mobile_authorization_code_request.rb @@ -0,0 +1,11 @@ + +module Square + module Mobile + module Types + class CreateMobileAuthorizationCodeRequest < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/o_auth/client.rb b/lib/square/o_auth/client.rb new file mode 100644 index 000000000..9c2e95c86 --- /dev/null +++ b/lib/square/o_auth/client.rb @@ -0,0 +1,110 @@ + +module Square + module OAuth + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::OAuth::Client] + def initialize(client) + @client = client + end + + # Revokes an access token generated with the OAuth flow. + # + # If an account has more than one OAuth access token for your application, this + # endpoint revokes all of them, regardless of which token you specify. + # + # __Important:__ The `Authorization` header for this endpoint must have the + # following format: + # + # ``` + # Authorization: Client APPLICATION_SECRET + # ``` + # + # Replace `APPLICATION_SECRET` with the application secret on the **OAuth** + # page for your application in the Developer Dashboard. + # + # @return [Square::Types::RevokeTokenResponse] + def revoke_token(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RevokeTokenResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns an OAuth access token and refresh token using the `authorization_code` + # or `refresh_token` grant type. + # + # When `grant_type` is `authorization_code`: + # - With the [code flow](https://developer.squareup.com/docs/oauth-api/overview#code-flow), + # provide `code`, `client_id`, and `client_secret`. + # - With the [PKCE flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow), + # provide `code`, `client_id`, and `code_verifier`. + # + # When `grant_type` is `refresh_token`: + # - With the code flow, provide `refresh_token`, `client_id`, and `client_secret`. + # The response returns the same refresh token provided in the request. + # - With the PKCE flow, provide `refresh_token` and `client_id`. The response returns + # a new refresh token. + # + # You can use the `scopes` parameter to limit the set of permissions authorized by the + # access token. You can use the `short_lived` parameter to create an access token that + # expires in 24 hours. + # + # __Important:__ OAuth tokens should be encrypted and stored on a secure server. + # Application clients should never interact directly with OAuth tokens. + # + # @return [Square::Types::ObtainTokenResponse] + def obtain_token(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ObtainTokenResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns information about an [OAuth access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-an-oauth-access-token) or an application’s [personal access token](https://developer.squareup.com/docs/build-basics/access-tokens#get-a-personal-access-token). + # + # Add the access token to the Authorization header of the request. + # + # __Important:__ The `Authorization` header you provide to this endpoint must have the following format: + # + # ``` + # Authorization: Bearer ACCESS_TOKEN + # ``` + # + # where `ACCESS_TOKEN` is a + # [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). + # + # If the access token is expired or not a valid access token, the endpoint returns an `UNAUTHORIZED` error. + # + # @return [Square::Types::RetrieveTokenStatusResponse] + def retrieve_token_status(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveTokenStatusResponse.load(_response.body) + else + raise _response.body + end + end + + # @return [untyped] + def authorize(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/o_auth/types/obtain_token_request.rb b/lib/square/o_auth/types/obtain_token_request.rb new file mode 100644 index 000000000..dad4e9443 --- /dev/null +++ b/lib/square/o_auth/types/obtain_token_request.rb @@ -0,0 +1,20 @@ + +module Square + module OAuth + module Types + class ObtainTokenRequest < Internal::Types::Model + field :client_id, String, optional: false, nullable: false + field :client_secret, String, optional: true, nullable: false + field :code, String, optional: true, nullable: false + field :redirect_uri, String, optional: true, nullable: false + field :grant_type, String, optional: false, nullable: false + field :refresh_token, String, optional: true, nullable: false + field :migration_token, String, optional: true, nullable: false + field :scopes, Internal::Types::Array[String], optional: true, nullable: false + field :short_lived, Internal::Types::Boolean, optional: true, nullable: false + field :code_verifier, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/o_auth/types/revoke_token_request.rb b/lib/square/o_auth/types/revoke_token_request.rb new file mode 100644 index 000000000..8a66661c8 --- /dev/null +++ b/lib/square/o_auth/types/revoke_token_request.rb @@ -0,0 +1,14 @@ + +module Square + module OAuth + module Types + class RevokeTokenRequest < Internal::Types::Model + field :client_id, String, optional: true, nullable: false + field :access_token, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :revoke_only_access_token, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/orders/client.rb b/lib/square/orders/client.rb new file mode 100644 index 000000000..9ad071a8c --- /dev/null +++ b/lib/square/orders/client.rb @@ -0,0 +1,173 @@ + +module Square + module Orders + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Orders::Client] + def initialize(client) + @client = client + end + + # Creates a new [order](entity:Order) that can include information about products for + # purchase and settings to apply to the purchase. + # + # To pay for a created order, see + # [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + # + # You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. + # + # @return [Square::Types::CreateOrderResponse] + def create(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/orders" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateOrderResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a set of [orders](entity:Order) by their IDs. + # + # If a given order ID does not exist, the ID is ignored instead of generating an error. + # + # @return [Square::Types::BatchGetOrdersResponse] + def batch_get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetOrdersResponse.load(_response.body) + else + raise _response.body + end + end + + # Enables applications to preview order pricing without creating an order. + # + # @return [Square::Types::CalculateOrderResponse] + def calculate(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CalculateOrderResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has + # only the core fields (such as line items, taxes, and discounts) copied from the original order. + # + # @return [Square::Types::CloneOrderResponse] + def clone(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CloneOrderResponse.load(_response.body) + else + raise _response.body + end + end + + # Search all orders for one or more locations. Orders include all sales, + # returns, and exchanges regardless of how or when they entered the Square + # ecosystem (such as Point of Sale, Invoices, and Connect APIs). + # + # `SearchOrders` requests need to specify which locations to search and define a + # [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls + # how to sort or filter the results. Your `SearchOrdersQuery` can: + # + # Set filter criteria. + # Set the sort order. + # Determine whether to return results as complete `Order` objects or as + # [OrderEntry](entity:OrderEntry) objects. + # + # Note that details for orders processed with Square Point of Sale while in + # offline mode might not be transmitted to Square for up to 72 hours. Offline + # orders have a `created_at` value that reflects the time the order was created, + # not the time it was subsequently transmitted to Square. + # + # @return [Square::Types::SearchOrdersResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchOrdersResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves an [Order](entity:Order) by ID. + # + # @return [Square::Types::GetOrderResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetOrderResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an open [order](entity:Order) by adding, replacing, or deleting + # fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. + # + # An `UpdateOrder` request requires the following: + # + # - The `order_id` in the endpoint path, identifying the order to update. + # - The latest `version` of the order to update. + # - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) + # containing only the fields to update and the version to which the update is + # being applied. + # - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) + # identifying the fields to clear. + # + # To pay for an order, see + # [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). + # + # @return [Square::Types::UpdateOrderResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateOrderResponse.load(_response.body) + else + raise _response.body + end + end + + # Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) + # or settle an order with a total of `0`. + # + # The total of the `payment_ids` listed in the request must be equal to the order + # total. Orders with a total amount of `0` can be marked as paid by specifying an empty + # array of `payment_ids` in the request. + # + # To be used with `PayOrder`, a payment must: + # + # - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment). + # Any approved payments that reference the same `order_id` not specified in the + # `payment_ids` is canceled. + # - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). + # Using a delayed capture payment with `PayOrder` completes the approved payment. + # + # @return [Square::Types::PayOrderResponse] + def pay(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::PayOrderResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/client.rb b/lib/square/orders/custom_attribute_definitions/client.rb new file mode 100644 index 000000000..f22fd0daf --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/client.rb @@ -0,0 +1,98 @@ + +module Square + module Orders + module CustomAttributeDefinitions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Orders::CustomAttributeDefinitions::Client] + def initialize(client) + @client = client + end + + # Lists the order-related [custom attribute definitions](entity:CustomAttributeDefinition) that belong to a Square seller account. + # + # When all response pages are retrieved, the results include all custom attribute definitions + # that are visible to the requesting application, including those that are created by other + # applications and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that + # seller-defined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListOrderCustomAttributeDefinitionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListOrderCustomAttributeDefinitionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates an order-related custom attribute definition. Use this endpoint to + # define a custom attribute that can be associated with orders. + # + # After creating a custom attribute definition, you can set the custom attribute for orders + # in the Square seller account. + # + # @return [Square::Types::CreateOrderCustomAttributeDefinitionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateOrderCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # + # To retrieve a custom attribute definition created by another application, the `visibility` + # setting must be `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveOrderCustomAttributeDefinitionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveOrderCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an order-related custom attribute definition for a Square seller account. + # + # Only the definition owner can update a custom attribute definition. Note that sellers can view all custom attributes in exported customer data, including those set to `VISIBILITY_HIDDEN`. + # + # @return [Square::Types::UpdateOrderCustomAttributeDefinitionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateOrderCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes an order-related [custom attribute definition](entity:CustomAttributeDefinition) from a Square seller account. + # + # Only the definition owner can delete a custom attribute definition. + # + # @return [Square::Types::DeleteOrderCustomAttributeDefinitionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteOrderCustomAttributeDefinitionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request.rb b/lib/square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request.rb new file mode 100644 index 000000000..2b0d770f5 --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/types/create_order_custom_attribute_definition_request.rb @@ -0,0 +1,14 @@ + +module Square + module Orders + module CustomAttributeDefinitions + module Types + class CreateOrderCustomAttributeDefinitionRequest < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb b/lib/square/orders/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..92a75c7f0 --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/types/delete_custom_attribute_definitions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Orders + module CustomAttributeDefinitions + module Types + class DeleteCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb b/lib/square/orders/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..de098fbe2 --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/types/get_custom_attribute_definitions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Orders + module CustomAttributeDefinitions + module Types + class GetCustomAttributeDefinitionsRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb b/lib/square/orders/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb new file mode 100644 index 000000000..8a85e316f --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/types/list_custom_attribute_definitions_request.rb @@ -0,0 +1,15 @@ + +module Square + module Orders + module CustomAttributeDefinitions + module Types + class ListCustomAttributeDefinitionsRequest < Internal::Types::Model + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request.rb b/lib/square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request.rb new file mode 100644 index 000000000..31c6ac2a4 --- /dev/null +++ b/lib/square/orders/custom_attribute_definitions/types/update_order_custom_attribute_definition_request.rb @@ -0,0 +1,15 @@ + +module Square + module Orders + module CustomAttributeDefinitions + module Types + class UpdateOrderCustomAttributeDefinitionRequest < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/client.rb b/lib/square/orders/custom_attributes/client.rb new file mode 100644 index 000000000..f0bc3ff8f --- /dev/null +++ b/lib/square/orders/custom_attributes/client.rb @@ -0,0 +1,146 @@ + +module Square + module Orders + module CustomAttributes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Orders::CustomAttributes::Client] + def initialize(client) + @client = client + end + + # Deletes order [custom attributes](entity:CustomAttribute) as a bulk operation. + # + # Use this endpoint to delete one or more custom attributes from one or more orders. + # A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + # custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + # + # This `BulkDeleteOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual delete + # requests and returns a map of individual delete responses. Each delete request has a unique ID + # and provides an order ID and custom attribute. Each delete response is returned with the ID + # of the corresponding request. + # + # To delete a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkDeleteOrderCustomAttributesResponse] + def batch_delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkDeleteOrderCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates order [custom attributes](entity:CustomAttribute) as a bulk operation. + # + # Use this endpoint to delete one or more custom attributes from one or more orders. + # A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + # custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + # + # This `BulkUpsertOrderCustomAttributes` endpoint accepts a map of 1 to 25 individual upsert + # requests and returns a map of individual upsert responses. Each upsert request has a unique ID + # and provides an order ID and custom attribute. Each upsert response is returned with the ID + # of the corresponding request. + # + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::BulkUpsertOrderCustomAttributesResponse] + def batch_upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkUpsertOrderCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists the [custom attributes](entity:CustomAttribute) associated with an order. + # + # You can use the `with_definitions` query parameter to also retrieve custom attribute definitions + # in the same call. + # + # When all response pages are retrieved, the results include all custom attributes that are + # visible to the requesting application, including those that are owned by other applications + # and set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::ListOrderCustomAttributesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListOrderCustomAttributesResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a [custom attribute](entity:CustomAttribute) associated with an order. + # + # You can use the `with_definition` query parameter to also retrieve the custom attribute definition + # in the same call. + # + # To retrieve a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::RetrieveOrderCustomAttributeResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveOrderCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates a [custom attribute](entity:CustomAttribute) for an order. + # + # Use this endpoint to set the value of a custom attribute for a specific order. + # A custom attribute is based on a custom attribute definition in a Square seller account. (To create a + # custom attribute definition, use the [CreateOrderCustomAttributeDefinition](api-endpoint:OrderCustomAttributes-CreateOrderCustomAttributeDefinition) endpoint.) + # + # To create or update a custom attribute owned by another application, the `visibility` setting + # must be `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::UpsertOrderCustomAttributeResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertOrderCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a [custom attribute](entity:CustomAttribute) associated with a customer profile. + # + # To delete a custom attribute owned by another application, the `visibility` setting must be + # `VISIBILITY_READ_WRITE_VALUES`. Note that seller-defined custom attributes + # (also known as custom fields) are always set to `VISIBILITY_READ_WRITE_VALUES`. + # + # @return [Square::Types::DeleteOrderCustomAttributeResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteOrderCustomAttributeResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request.rb b/lib/square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request.rb new file mode 100644 index 000000000..59b5435c7 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/bulk_delete_order_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Orders + module CustomAttributes + module Types + class BulkDeleteOrderCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request.rb b/lib/square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request.rb new file mode 100644 index 000000000..10508a142 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/bulk_upsert_order_custom_attributes_request.rb @@ -0,0 +1,13 @@ + +module Square + module Orders + module CustomAttributes + module Types + class BulkUpsertOrderCustomAttributesRequest < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute], optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/delete_custom_attributes_request.rb b/lib/square/orders/custom_attributes/types/delete_custom_attributes_request.rb new file mode 100644 index 000000000..f411e9797 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/delete_custom_attributes_request.rb @@ -0,0 +1,14 @@ + +module Square + module Orders + module CustomAttributes + module Types + class DeleteCustomAttributesRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :custom_attribute_key, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/get_custom_attributes_request.rb b/lib/square/orders/custom_attributes/types/get_custom_attributes_request.rb new file mode 100644 index 000000000..be9b912e1 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/get_custom_attributes_request.rb @@ -0,0 +1,16 @@ + +module Square + module Orders + module CustomAttributes + module Types + class GetCustomAttributesRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :custom_attribute_key, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + field :with_definition, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/list_custom_attributes_request.rb b/lib/square/orders/custom_attributes/types/list_custom_attributes_request.rb new file mode 100644 index 000000000..a4c6f5579 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/list_custom_attributes_request.rb @@ -0,0 +1,17 @@ + +module Square + module Orders + module CustomAttributes + module Types + class ListCustomAttributesRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :visibility_filter, Square::Types::VisibilityFilter, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :with_definitions, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/custom_attributes/types/upsert_order_custom_attribute_request.rb b/lib/square/orders/custom_attributes/types/upsert_order_custom_attribute_request.rb new file mode 100644 index 000000000..201434c63 --- /dev/null +++ b/lib/square/orders/custom_attributes/types/upsert_order_custom_attribute_request.rb @@ -0,0 +1,16 @@ + +module Square + module Orders + module CustomAttributes + module Types + class UpsertOrderCustomAttributeRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :custom_attribute_key, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/orders/types/batch_get_orders_request.rb b/lib/square/orders/types/batch_get_orders_request.rb new file mode 100644 index 000000000..0e688c9a6 --- /dev/null +++ b/lib/square/orders/types/batch_get_orders_request.rb @@ -0,0 +1,12 @@ + +module Square + module Orders + module Types + class BatchGetOrdersRequest < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :order_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/calculate_order_request.rb b/lib/square/orders/types/calculate_order_request.rb new file mode 100644 index 000000000..b414ec7c5 --- /dev/null +++ b/lib/square/orders/types/calculate_order_request.rb @@ -0,0 +1,12 @@ + +module Square + module Orders + module Types + class CalculateOrderRequest < Internal::Types::Model + field :order, Square::Types::Order, optional: false, nullable: false + field :proposed_rewards, Internal::Types::Array[Square::Types::OrderReward], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/clone_order_request.rb b/lib/square/orders/types/clone_order_request.rb new file mode 100644 index 000000000..f95a1767a --- /dev/null +++ b/lib/square/orders/types/clone_order_request.rb @@ -0,0 +1,13 @@ + +module Square + module Orders + module Types + class CloneOrderRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/get_orders_request.rb b/lib/square/orders/types/get_orders_request.rb new file mode 100644 index 000000000..bc68985d5 --- /dev/null +++ b/lib/square/orders/types/get_orders_request.rb @@ -0,0 +1,11 @@ + +module Square + module Orders + module Types + class GetOrdersRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/pay_order_request.rb b/lib/square/orders/types/pay_order_request.rb new file mode 100644 index 000000000..e79a06524 --- /dev/null +++ b/lib/square/orders/types/pay_order_request.rb @@ -0,0 +1,14 @@ + +module Square + module Orders + module Types + class PayOrderRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :order_version, Integer, optional: true, nullable: false + field :payment_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/search_orders_request.rb b/lib/square/orders/types/search_orders_request.rb new file mode 100644 index 000000000..bdfd49cca --- /dev/null +++ b/lib/square/orders/types/search_orders_request.rb @@ -0,0 +1,15 @@ + +module Square + module Orders + module Types + class SearchOrdersRequest < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :query, Square::Types::SearchOrdersQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :return_entries, Internal::Types::Boolean, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/orders/types/update_order_request.rb b/lib/square/orders/types/update_order_request.rb new file mode 100644 index 000000000..b290285e0 --- /dev/null +++ b/lib/square/orders/types/update_order_request.rb @@ -0,0 +1,14 @@ + +module Square + module Orders + module Types + class UpdateOrderRequest < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + field :order, Square::Types::Order, optional: true, nullable: false + field :fields_to_clear, Internal::Types::Array[String], optional: true, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/payments/client.rb b/lib/square/payments/client.rb new file mode 100644 index 000000000..15aca60fd --- /dev/null +++ b/lib/square/payments/client.rb @@ -0,0 +1,132 @@ + +module Square + module Payments + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Payments::Client] + def initialize(client) + @client = client + end + + # Retrieves a list of payments taken by the account making the request. + # + # Results are eventually consistent, and new payments or changes to payments might take several + # seconds to appear. + # + # The maximum results per page is 100. + # + # @return [Square::Types::ListPaymentsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListPaymentsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a payment using the provided source. You can use this endpoint + # to charge a card (credit/debit card or + # Square gift card) or record a payment that the seller received outside of Square + # (cash payment from a buyer or a payment that an external entity + # processed on behalf of the seller). + # + # The endpoint creates a + # `Payment` object and returns it in the response. + # + # @return [Square::Types::CreatePaymentResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreatePaymentResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels (voids) a payment identified by the idempotency key that is specified in the + # request. + # + # Use this method when the status of a `CreatePayment` request is unknown (for example, after you send a + # `CreatePayment` request, a network error occurs and you do not get a response). In this case, you can + # direct Square to cancel the payment using this endpoint. In the request, you provide the same + # idempotency key that you provided in your `CreatePayment` request that you want to cancel. After + # canceling the payment, you can submit your `CreatePayment` request again. + # + # Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint + # returns successfully. + # + # @return [Square::Types::CancelPaymentByIdempotencyKeyResponse] + def cancel_by_idempotency_key(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelPaymentByIdempotencyKeyResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves details for a specific payment. + # + # @return [Square::Types::GetPaymentResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetPaymentResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a payment with the APPROVED status. + # You can update the `amount_money` and `tip_money` using this endpoint. + # + # @return [Square::Types::UpdatePaymentResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdatePaymentResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels (voids) a payment. You can use this endpoint to cancel a payment with + # the APPROVED `status`. + # + # @return [Square::Types::CancelPaymentResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelPaymentResponse.load(_response.body) + else + raise _response.body + end + end + + # Completes (captures) a payment. + # By default, payments are set to complete immediately after they are created. + # + # You can use this endpoint to complete a payment with the APPROVED `status`. + # + # @return [Square::Types::CompletePaymentResponse] + def complete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CompletePaymentResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/payments/types/cancel_payment_by_idempotency_key_request.rb b/lib/square/payments/types/cancel_payment_by_idempotency_key_request.rb new file mode 100644 index 000000000..467e30d38 --- /dev/null +++ b/lib/square/payments/types/cancel_payment_by_idempotency_key_request.rb @@ -0,0 +1,11 @@ + +module Square + module Payments + module Types + class CancelPaymentByIdempotencyKeyRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/cancel_payments_request.rb b/lib/square/payments/types/cancel_payments_request.rb new file mode 100644 index 000000000..f73a64eaa --- /dev/null +++ b/lib/square/payments/types/cancel_payments_request.rb @@ -0,0 +1,11 @@ + +module Square + module Payments + module Types + class CancelPaymentsRequest < Internal::Types::Model + field :payment_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/complete_payment_request.rb b/lib/square/payments/types/complete_payment_request.rb new file mode 100644 index 000000000..06314d0f1 --- /dev/null +++ b/lib/square/payments/types/complete_payment_request.rb @@ -0,0 +1,12 @@ + +module Square + module Payments + module Types + class CompletePaymentRequest < Internal::Types::Model + field :payment_id, String, optional: false, nullable: false + field :version_token, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/create_payment_request.rb b/lib/square/payments/types/create_payment_request.rb new file mode 100644 index 000000000..19cf3f118 --- /dev/null +++ b/lib/square/payments/types/create_payment_request.rb @@ -0,0 +1,35 @@ + +module Square + module Payments + module Types + class CreatePaymentRequest < Internal::Types::Model + field :source_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :tip_money, Square::Types::Money, optional: true, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :delay_duration, String, optional: true, nullable: false + field :delay_action, String, optional: true, nullable: false + field :autocomplete, Internal::Types::Boolean, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :verification_token, String, optional: true, nullable: false + field :accept_partial_authorization, Internal::Types::Boolean, optional: true, nullable: false + field :buyer_email_address, String, optional: true, nullable: false + field :buyer_phone_number, String, optional: true, nullable: false + field :billing_address, Square::Types::Address, optional: true, nullable: false + field :shipping_address, Square::Types::Address, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :statement_description_identifier, String, optional: true, nullable: false + field :cash_details, Square::Types::CashPaymentDetails, optional: true, nullable: false + field :external_details, Square::Types::ExternalPaymentDetails, optional: true, nullable: false + field :customer_details, Square::Types::CustomerDetails, optional: true, nullable: false + field :offline_payment_details, Square::Types::OfflinePaymentDetails, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/get_payments_request.rb b/lib/square/payments/types/get_payments_request.rb new file mode 100644 index 000000000..35bdceb21 --- /dev/null +++ b/lib/square/payments/types/get_payments_request.rb @@ -0,0 +1,11 @@ + +module Square + module Payments + module Types + class GetPaymentsRequest < Internal::Types::Model + field :payment_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/list_payments_request.rb b/lib/square/payments/types/list_payments_request.rb new file mode 100644 index 000000000..4b60b854a --- /dev/null +++ b/lib/square/payments/types/list_payments_request.rb @@ -0,0 +1,25 @@ + +module Square + module Payments + module Types + class ListPaymentsRequest < Internal::Types::Model + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :sort_order, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :total, Integer, optional: true, nullable: false + field :last_4, String, optional: true, nullable: false + field :card_brand, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :is_offline_payment, Internal::Types::Boolean, optional: true, nullable: false + field :offline_begin_time, String, optional: true, nullable: false + field :offline_end_time, String, optional: true, nullable: false + field :updated_at_begin_time, String, optional: true, nullable: false + field :updated_at_end_time, String, optional: true, nullable: false + field :sort_field, Square::Types::ListPaymentsRequestSortField, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/payments/types/update_payment_request.rb b/lib/square/payments/types/update_payment_request.rb new file mode 100644 index 000000000..d4bb15db1 --- /dev/null +++ b/lib/square/payments/types/update_payment_request.rb @@ -0,0 +1,13 @@ + +module Square + module Payments + module Types + class UpdatePaymentRequest < Internal::Types::Model + field :payment_id, String, optional: false, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + field :idempotency_key, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/payouts/client.rb b/lib/square/payouts/client.rb new file mode 100644 index 000000000..1e57ba6cc --- /dev/null +++ b/lib/square/payouts/client.rb @@ -0,0 +1,57 @@ + +module Square + module Payouts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Payouts::Client] + def initialize(client) + @client = client + end + + # Retrieves a list of all payouts for the default location. + # You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + # To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + # + # @return [Square::Types::ListPayoutsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListPayoutsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves details of a specific payout identified by a payout ID. + # To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + # + # @return [Square::Types::GetPayoutResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetPayoutResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a list of all payout entries for a specific payout. + # To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. + # + # @return [Square::Types::ListPayoutEntriesResponse] + def list_entries(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListPayoutEntriesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/payouts/types/get_payouts_request.rb b/lib/square/payouts/types/get_payouts_request.rb new file mode 100644 index 000000000..069e8f877 --- /dev/null +++ b/lib/square/payouts/types/get_payouts_request.rb @@ -0,0 +1,11 @@ + +module Square + module Payouts + module Types + class GetPayoutsRequest < Internal::Types::Model + field :payout_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/payouts/types/list_entries_payouts_request.rb b/lib/square/payouts/types/list_entries_payouts_request.rb new file mode 100644 index 000000000..d49521f7d --- /dev/null +++ b/lib/square/payouts/types/list_entries_payouts_request.rb @@ -0,0 +1,14 @@ + +module Square + module Payouts + module Types + class ListEntriesPayoutsRequest < Internal::Types::Model + field :payout_id, String, optional: false, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/payouts/types/list_payouts_request.rb b/lib/square/payouts/types/list_payouts_request.rb new file mode 100644 index 000000000..2f665da28 --- /dev/null +++ b/lib/square/payouts/types/list_payouts_request.rb @@ -0,0 +1,17 @@ + +module Square + module Payouts + module Types + class ListPayoutsRequest < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :status, Square::Types::PayoutStatus, optional: true, nullable: false + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/refunds/client.rb b/lib/square/refunds/client.rb new file mode 100644 index 000000000..0a8177c61 --- /dev/null +++ b/lib/square/refunds/client.rb @@ -0,0 +1,61 @@ + +module Square + module Refunds + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Refunds::Client] + def initialize(client) + @client = client + end + + # Retrieves a list of refunds for the account making the request. + # + # Results are eventually consistent, and new refunds or changes to refunds might take several + # seconds to appear. + # + # The maximum results per page is 100. + # + # @return [Square::Types::ListPaymentRefundsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListPaymentRefundsResponse.load(_response.body) + else + raise _response.body + end + end + + # Refunds a payment. You can refund the entire payment amount or a + # portion of it. You can use this endpoint to refund a card payment or record a + # refund of a cash or external payment. For more information, see + # [Refund Payment](https://developer.squareup.com/docs/payments-api/refund-payments). + # + # @return [Square::Types::RefundPaymentResponse] + def refund_payment(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RefundPaymentResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a specific refund using the `refund_id`. + # + # @return [Square::Types::GetPaymentRefundResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetPaymentRefundResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/refunds/types/get_refunds_request.rb b/lib/square/refunds/types/get_refunds_request.rb new file mode 100644 index 000000000..93d8871c5 --- /dev/null +++ b/lib/square/refunds/types/get_refunds_request.rb @@ -0,0 +1,11 @@ + +module Square + module Refunds + module Types + class GetRefundsRequest < Internal::Types::Model + field :refund_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/refunds/types/list_refunds_request.rb b/lib/square/refunds/types/list_refunds_request.rb new file mode 100644 index 000000000..b7be2bfec --- /dev/null +++ b/lib/square/refunds/types/list_refunds_request.rb @@ -0,0 +1,21 @@ + +module Square + module Refunds + module Types + class ListRefundsRequest < Internal::Types::Model + field :begin_time, String, optional: true, nullable: false + field :end_time, String, optional: true, nullable: false + field :sort_order, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :source_type, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :updated_at_begin_time, String, optional: true, nullable: false + field :updated_at_end_time, String, optional: true, nullable: false + field :sort_field, Square::Types::ListPaymentRefundsRequestSortField, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/refunds/types/refund_payment_request.rb b/lib/square/refunds/types/refund_payment_request.rb new file mode 100644 index 000000000..6613f5768 --- /dev/null +++ b/lib/square/refunds/types/refund_payment_request.rb @@ -0,0 +1,23 @@ + +module Square + module Refunds + module Types + class RefundPaymentRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + field :destination_id, String, optional: true, nullable: false + field :unlinked, Internal::Types::Boolean, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :reason, String, optional: true, nullable: false + field :payment_version_token, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :cash_details, Square::Types::DestinationDetailsCashRefundDetails, optional: true, nullable: false + field :external_details, Square::Types::DestinationDetailsExternalRefundDetails, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/sites/client.rb b/lib/square/sites/client.rb new file mode 100644 index 000000000..ce56cb00a --- /dev/null +++ b/lib/square/sites/client.rb @@ -0,0 +1,30 @@ + +module Square + module Sites + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Sites::Client] + def initialize(client) + @client = client + end + + # Lists the Square Online sites that belong to a seller. Sites are listed in descending order by the `created_at` date. + # + # + # __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + # + # @return [Square::Types::ListSitesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListSitesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/snippets/client.rb b/lib/square/snippets/client.rb new file mode 100644 index 000000000..95e431c33 --- /dev/null +++ b/lib/square/snippets/client.rb @@ -0,0 +1,69 @@ + +module Square + module Snippets + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Snippets::Client] + def initialize(client) + @client = client + end + + # Retrieves your snippet from a Square Online site. A site can contain snippets from multiple snippet applications, but you can retrieve only the snippet that was added by your application. + # + # You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + # + # + # __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + # + # @return [Square::Types::GetSnippetResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetSnippetResponse.load(_response.body) + else + raise _response.body + end + end + + # Adds a snippet to a Square Online site or updates the existing snippet on the site. + # The snippet code is appended to the end of the `head` element on every page of the site, except checkout pages. A snippet application can add one snippet to a given site. + # + # You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + # + # + # __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + # + # @return [Square::Types::UpsertSnippetResponse] + def upsert(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpsertSnippetResponse.load(_response.body) + else + raise _response.body + end + end + + # Removes your snippet from a Square Online site. + # + # You can call [ListSites](api-endpoint:Sites-ListSites) to get the IDs of the sites that belong to a seller. + # + # + # __Note:__ Square Online APIs are publicly available as part of an early access program. For more information, see [Early access program for Square Online APIs](https://developer.squareup.com/docs/online-api#early-access-program-for-square-online-apis). + # + # @return [Square::Types::DeleteSnippetResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteSnippetResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/snippets/types/delete_snippets_request.rb b/lib/square/snippets/types/delete_snippets_request.rb new file mode 100644 index 000000000..cb44749d4 --- /dev/null +++ b/lib/square/snippets/types/delete_snippets_request.rb @@ -0,0 +1,11 @@ + +module Square + module Snippets + module Types + class DeleteSnippetsRequest < Internal::Types::Model + field :site_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/snippets/types/get_snippets_request.rb b/lib/square/snippets/types/get_snippets_request.rb new file mode 100644 index 000000000..7b1087291 --- /dev/null +++ b/lib/square/snippets/types/get_snippets_request.rb @@ -0,0 +1,11 @@ + +module Square + module Snippets + module Types + class GetSnippetsRequest < Internal::Types::Model + field :site_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/snippets/types/upsert_snippet_request.rb b/lib/square/snippets/types/upsert_snippet_request.rb new file mode 100644 index 000000000..2b46d6cb1 --- /dev/null +++ b/lib/square/snippets/types/upsert_snippet_request.rb @@ -0,0 +1,12 @@ + +module Square + module Snippets + module Types + class UpsertSnippetRequest < Internal::Types::Model + field :site_id, String, optional: false, nullable: false + field :snippet, Square::Types::Snippet, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/client.rb b/lib/square/subscriptions/client.rb new file mode 100644 index 000000000..72f38ccc0 --- /dev/null +++ b/lib/square/subscriptions/client.rb @@ -0,0 +1,196 @@ + +module Square + module Subscriptions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Subscriptions::Client] + def initialize(client) + @client = client + end + + # Enrolls a customer in a subscription. + # + # If you provide a card on file in the request, Square charges the card for + # the subscription. Otherwise, Square sends an invoice to the customer's email + # address. The subscription starts immediately, unless the request includes + # the optional `start_date`. Each individual subscription is associated with a particular location. + # + # For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription). + # + # @return [Square::Types::CreateSubscriptionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Schedules a plan variation change for all active subscriptions under a given plan + # variation. For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). + # + # @return [Square::Types::BulkSwapPlanResponse] + def bulk_swap_plan(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BulkSwapPlanResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for subscriptions. + # + # Results are ordered chronologically by subscription creation date. If + # the request specifies more than one location ID, + # the endpoint orders the result + # by location ID, and then by creation date within each location. If no locations are given + # in the query, all locations are searched. + # + # You can also optionally specify `customer_ids` to search by customer. + # If left unset, all customers + # associated with the specified locations are returned. + # If the request specifies customer IDs, the endpoint orders results + # first by location, within location by customer ID, and within + # customer by subscription creation date. + # + # @return [Square::Types::SearchSubscriptionsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchSubscriptionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a specific subscription. + # + # @return [Square::Types::GetSubscriptionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a subscription by modifying or clearing `subscription` field values. + # To clear a field, set its value to `null`. + # + # @return [Square::Types::UpdateSubscriptionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a scheduled action for a subscription. + # + # @return [Square::Types::DeleteSubscriptionActionResponse] + def delete_action(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteSubscriptionActionResponse.load(_response.body) + else + raise _response.body + end + end + + # Changes the [billing anchor date](https://developer.squareup.com/docs/subscriptions-api/subscription-billing#billing-dates) + # for a subscription. + # + # @return [Square::Types::ChangeBillingAnchorDateResponse] + def change_billing_anchor_date(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ChangeBillingAnchorDateResponse.load(_response.body) + else + raise _response.body + end + end + + # Schedules a `CANCEL` action to cancel an active subscription. This + # sets the `canceled_date` field to the end of the active billing period. After this date, + # the subscription status changes from ACTIVE to CANCELED. + # + # @return [Square::Types::CancelSubscriptionResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription. + # + # @return [Square::Types::ListSubscriptionEventsResponse] + def list_events(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListSubscriptionEventsResponse.load(_response.body) + else + raise _response.body + end + end + + # Schedules a `PAUSE` action to pause an active subscription. + # + # @return [Square::Types::PauseSubscriptionResponse] + def pause(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::PauseSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Schedules a `RESUME` action to resume a paused or a deactivated subscription. + # + # @return [Square::Types::ResumeSubscriptionResponse] + def resume(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ResumeSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription. + # For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). + # + # @return [Square::Types::SwapPlanResponse] + def swap_plan(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SwapPlanResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/subscriptions/types/bulk_swap_plan_request.rb b/lib/square/subscriptions/types/bulk_swap_plan_request.rb new file mode 100644 index 000000000..5eb5cb0a7 --- /dev/null +++ b/lib/square/subscriptions/types/bulk_swap_plan_request.rb @@ -0,0 +1,13 @@ + +module Square + module Subscriptions + module Types + class BulkSwapPlanRequest < Internal::Types::Model + field :new_plan_variation_id, String, optional: false, nullable: false + field :old_plan_variation_id, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/cancel_subscriptions_request.rb b/lib/square/subscriptions/types/cancel_subscriptions_request.rb new file mode 100644 index 000000000..e6070ebcd --- /dev/null +++ b/lib/square/subscriptions/types/cancel_subscriptions_request.rb @@ -0,0 +1,11 @@ + +module Square + module Subscriptions + module Types + class CancelSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/change_billing_anchor_date_request.rb b/lib/square/subscriptions/types/change_billing_anchor_date_request.rb new file mode 100644 index 000000000..be7f91619 --- /dev/null +++ b/lib/square/subscriptions/types/change_billing_anchor_date_request.rb @@ -0,0 +1,13 @@ + +module Square + module Subscriptions + module Types + class ChangeBillingAnchorDateRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :effective_date, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/create_subscription_request.rb b/lib/square/subscriptions/types/create_subscription_request.rb new file mode 100644 index 000000000..741ad8080 --- /dev/null +++ b/lib/square/subscriptions/types/create_subscription_request.rb @@ -0,0 +1,23 @@ + +module Square + module Subscriptions + module Types + class CreateSubscriptionRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :plan_variation_id, String, optional: true, nullable: false + field :customer_id, String, optional: false, nullable: false + field :start_date, String, optional: true, nullable: false + field :canceled_date, String, optional: true, nullable: false + field :tax_percentage, String, optional: true, nullable: false + field :price_override_money, Square::Types::Money, optional: true, nullable: false + field :card_id, String, optional: true, nullable: false + field :timezone, String, optional: true, nullable: false + field :source, Square::Types::SubscriptionSource, optional: true, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :phases, Internal::Types::Array[Square::Types::Phase], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/delete_action_subscriptions_request.rb b/lib/square/subscriptions/types/delete_action_subscriptions_request.rb new file mode 100644 index 000000000..648ac4e00 --- /dev/null +++ b/lib/square/subscriptions/types/delete_action_subscriptions_request.rb @@ -0,0 +1,12 @@ + +module Square + module Subscriptions + module Types + class DeleteActionSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :action_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/get_subscriptions_request.rb b/lib/square/subscriptions/types/get_subscriptions_request.rb new file mode 100644 index 000000000..e72d524af --- /dev/null +++ b/lib/square/subscriptions/types/get_subscriptions_request.rb @@ -0,0 +1,12 @@ + +module Square + module Subscriptions + module Types + class GetSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :include, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/list_events_subscriptions_request.rb b/lib/square/subscriptions/types/list_events_subscriptions_request.rb new file mode 100644 index 000000000..7f182a91c --- /dev/null +++ b/lib/square/subscriptions/types/list_events_subscriptions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Subscriptions + module Types + class ListEventsSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/pause_subscription_request.rb b/lib/square/subscriptions/types/pause_subscription_request.rb new file mode 100644 index 000000000..22704e5b4 --- /dev/null +++ b/lib/square/subscriptions/types/pause_subscription_request.rb @@ -0,0 +1,16 @@ + +module Square + module Subscriptions + module Types + class PauseSubscriptionRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :pause_effective_date, String, optional: true, nullable: false + field :pause_cycle_duration, Integer, optional: true, nullable: false + field :resume_effective_date, String, optional: true, nullable: false + field :resume_change_timing, Square::Types::ChangeTiming, optional: true, nullable: false + field :pause_reason, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/resume_subscription_request.rb b/lib/square/subscriptions/types/resume_subscription_request.rb new file mode 100644 index 000000000..762c29332 --- /dev/null +++ b/lib/square/subscriptions/types/resume_subscription_request.rb @@ -0,0 +1,13 @@ + +module Square + module Subscriptions + module Types + class ResumeSubscriptionRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :resume_effective_date, String, optional: true, nullable: false + field :resume_change_timing, Square::Types::ChangeTiming, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/search_subscriptions_request.rb b/lib/square/subscriptions/types/search_subscriptions_request.rb new file mode 100644 index 000000000..d2a5d0aae --- /dev/null +++ b/lib/square/subscriptions/types/search_subscriptions_request.rb @@ -0,0 +1,14 @@ + +module Square + module Subscriptions + module Types + class SearchSubscriptionsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :query, Square::Types::SearchSubscriptionsQuery, optional: true, nullable: false + field :include, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/swap_plan_request.rb b/lib/square/subscriptions/types/swap_plan_request.rb new file mode 100644 index 000000000..526dcb938 --- /dev/null +++ b/lib/square/subscriptions/types/swap_plan_request.rb @@ -0,0 +1,13 @@ + +module Square + module Subscriptions + module Types + class SwapPlanRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :new_plan_variation_id, String, optional: true, nullable: false + field :phases, Internal::Types::Array[Square::Types::PhaseInput], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/subscriptions/types/update_subscription_request.rb b/lib/square/subscriptions/types/update_subscription_request.rb new file mode 100644 index 000000000..a91a2a6c9 --- /dev/null +++ b/lib/square/subscriptions/types/update_subscription_request.rb @@ -0,0 +1,12 @@ + +module Square + module Subscriptions + module Types + class UpdateSubscriptionRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/team/client.rb b/lib/square/team/client.rb new file mode 100644 index 000000000..8c9e76cf1 --- /dev/null +++ b/lib/square/team/client.rb @@ -0,0 +1,69 @@ + +module Square + module Team + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Team::Client] + def initialize(client) + @client = client + end + + # Lists jobs in a seller account. Results are sorted by title in ascending order. + # + # @return [Square::Types::ListJobsResponse] + def list_jobs(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListJobsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a job in a seller account. A job defines a title and tip eligibility. Note that + # compensation is defined in a [job assignment](entity:JobAssignment) in a team member's wage setting. + # + # @return [Square::Types::CreateJobResponse] + def create_job(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateJobResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a specified job. + # + # @return [Square::Types::RetrieveJobResponse] + def retrieve_job(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::RetrieveJobResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates the title or tip eligibility of a job. Changes to the title propagate to all + # `JobAssignment`, `Shift`, and `TeamMemberWage` objects that reference the job ID. Changes to + # tip eligibility propagate to all `TeamMemberWage` objects that reference the job ID. + # + # @return [Square::Types::UpdateJobResponse] + def update_job(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateJobResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/team/types/create_job_request.rb b/lib/square/team/types/create_job_request.rb new file mode 100644 index 000000000..5c25d81df --- /dev/null +++ b/lib/square/team/types/create_job_request.rb @@ -0,0 +1,12 @@ + +module Square + module Team + module Types + class CreateJobRequest < Internal::Types::Model + field :job, Square::Types::Job, optional: false, nullable: false + field :idempotency_key, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team/types/list_jobs_request.rb b/lib/square/team/types/list_jobs_request.rb new file mode 100644 index 000000000..976fbf47f --- /dev/null +++ b/lib/square/team/types/list_jobs_request.rb @@ -0,0 +1,11 @@ + +module Square + module Team + module Types + class ListJobsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/team/types/retrieve_job_request.rb b/lib/square/team/types/retrieve_job_request.rb new file mode 100644 index 000000000..a5ca300c8 --- /dev/null +++ b/lib/square/team/types/retrieve_job_request.rb @@ -0,0 +1,11 @@ + +module Square + module Team + module Types + class RetrieveJobRequest < Internal::Types::Model + field :job_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team/types/update_job_request.rb b/lib/square/team/types/update_job_request.rb new file mode 100644 index 000000000..16c047faf --- /dev/null +++ b/lib/square/team/types/update_job_request.rb @@ -0,0 +1,12 @@ + +module Square + module Team + module Types + class UpdateJobRequest < Internal::Types::Model + field :job_id, String, optional: false, nullable: false + field :job, Square::Types::Job, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/client.rb b/lib/square/team_members/client.rb new file mode 100644 index 000000000..888058589 --- /dev/null +++ b/lib/square/team_members/client.rb @@ -0,0 +1,113 @@ + +module Square + module TeamMembers + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::TeamMembers::Client] + def initialize(client) + @client = client + end + + # Creates a single `TeamMember` object. The `TeamMember` object is returned on successful creates. + # You must provide the following values in your request to this endpoint: + # - `given_name` + # - `family_name` + # + # Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#createteammember). + # + # @return [Square::Types::CreateTeamMemberResponse] + def create(request_options: {}, **params) + _request = Square::Internal::Http::JSONRequest.new( + method: POST, + path: "v2/team-members" + ) + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateTeamMemberResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates multiple `TeamMember` objects. The created `TeamMember` objects are returned on successful creates. + # This process is non-transactional and processes as much of the request as possible. If one of the creates in + # the request cannot be successfully processed, the request is not marked as failed, but the body of the response + # contains explicit error information for the failed create. + # + # Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-create-team-members). + # + # @return [Square::Types::BatchCreateTeamMembersResponse] + def batch_create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchCreateTeamMembersResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates multiple `TeamMember` objects. The updated `TeamMember` objects are returned on successful updates. + # This process is non-transactional and processes as much of the request as possible. If one of the updates in + # the request cannot be successfully processed, the request is not marked as failed, but the body of the response + # contains explicit error information for the failed update. + # Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#bulk-update-team-members). + # + # @return [Square::Types::BatchUpdateTeamMembersResponse] + def batch_update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchUpdateTeamMembersResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a paginated list of `TeamMember` objects for a business. + # The list can be filtered by location IDs, `ACTIVE` or `INACTIVE` status, or whether + # the team member is the Square account owner. + # + # @return [Square::Types::SearchTeamMembersResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchTeamMembersResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a `TeamMember` object for the given `TeamMember.id`. + # Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrieve-a-team-member). + # + # @return [Square::Types::GetTeamMemberResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTeamMemberResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a single `TeamMember` object. The `TeamMember` object is returned on successful updates. + # Learn about [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#update-a-team-member). + # + # @return [Square::Types::UpdateTeamMemberResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateTeamMemberResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/team_members/types/batch_create_team_members_request.rb b/lib/square/team_members/types/batch_create_team_members_request.rb new file mode 100644 index 000000000..0f43453b1 --- /dev/null +++ b/lib/square/team_members/types/batch_create_team_members_request.rb @@ -0,0 +1,11 @@ + +module Square + module TeamMembers + module Types + class BatchCreateTeamMembersRequest < Internal::Types::Model + field :team_members, Internal::Types::Hash[String, Square::Types::CreateTeamMemberRequest], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/types/batch_update_team_members_request.rb b/lib/square/team_members/types/batch_update_team_members_request.rb new file mode 100644 index 000000000..8c5908a63 --- /dev/null +++ b/lib/square/team_members/types/batch_update_team_members_request.rb @@ -0,0 +1,11 @@ + +module Square + module TeamMembers + module Types + class BatchUpdateTeamMembersRequest < Internal::Types::Model + field :team_members, Internal::Types::Hash[String, Square::Types::UpdateTeamMemberRequest], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/types/get_team_members_request.rb b/lib/square/team_members/types/get_team_members_request.rb new file mode 100644 index 000000000..bd172c303 --- /dev/null +++ b/lib/square/team_members/types/get_team_members_request.rb @@ -0,0 +1,11 @@ + +module Square + module TeamMembers + module Types + class GetTeamMembersRequest < Internal::Types::Model + field :team_member_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/types/search_team_members_request.rb b/lib/square/team_members/types/search_team_members_request.rb new file mode 100644 index 000000000..803eebbe9 --- /dev/null +++ b/lib/square/team_members/types/search_team_members_request.rb @@ -0,0 +1,13 @@ + +module Square + module TeamMembers + module Types + class SearchTeamMembersRequest < Internal::Types::Model + field :query, Square::Types::SearchTeamMembersQuery, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/types/update_team_members_request.rb b/lib/square/team_members/types/update_team_members_request.rb new file mode 100644 index 000000000..e4bf1a7d2 --- /dev/null +++ b/lib/square/team_members/types/update_team_members_request.rb @@ -0,0 +1,12 @@ + +module Square + module TeamMembers + module Types + class UpdateTeamMembersRequest < Internal::Types::Model + field :team_member_id, String, optional: false, nullable: false + field :body, Square::Types::UpdateTeamMemberRequest, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/team_members/wage_setting/client.rb b/lib/square/team_members/wage_setting/client.rb new file mode 100644 index 000000000..b4890323a --- /dev/null +++ b/lib/square/team_members/wage_setting/client.rb @@ -0,0 +1,54 @@ + +module Square + module TeamMembers + module WageSetting + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::TeamMembers::WageSetting::Client] + def initialize(client) + @client = client + end + + # Retrieves a `WageSetting` object for a team member specified + # by `TeamMember.id`. For more information, see + # [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#retrievewagesetting). + # + # Square recommends using [RetrieveTeamMember](api-endpoint:Team-RetrieveTeamMember) or [SearchTeamMembers](api-endpoint:Team-SearchTeamMembers) + # to get this information directly from the `TeamMember.wage_setting` field. + # + # @return [Square::Types::GetWageSettingResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetWageSettingResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates or updates a `WageSetting` object. The object is created if a + # `WageSetting` with the specified `team_member_id` doesn't exist. Otherwise, + # it fully replaces the `WageSetting` object for the team member. + # The `WageSetting` is returned on a successful update. For more information, see + # [Troubleshooting the Team API](https://developer.squareup.com/docs/team/troubleshooting#create-or-update-a-wage-setting). + # + # Square recommends using [CreateTeamMember](api-endpoint:Team-CreateTeamMember) or [UpdateTeamMember](api-endpoint:Team-UpdateTeamMember) + # to manage the `TeamMember.wage_setting` field directly. + # + # @return [Square::Types::UpdateWageSettingResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateWageSettingResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/team_members/wage_setting/types/get_wage_setting_request.rb b/lib/square/team_members/wage_setting/types/get_wage_setting_request.rb new file mode 100644 index 000000000..28953c9f8 --- /dev/null +++ b/lib/square/team_members/wage_setting/types/get_wage_setting_request.rb @@ -0,0 +1,13 @@ + +module Square + module TeamMembers + module WageSetting + module Types + class GetWageSettingRequest < Internal::Types::Model + field :team_member_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/team_members/wage_setting/types/update_wage_setting_request.rb b/lib/square/team_members/wage_setting/types/update_wage_setting_request.rb new file mode 100644 index 000000000..742519595 --- /dev/null +++ b/lib/square/team_members/wage_setting/types/update_wage_setting_request.rb @@ -0,0 +1,14 @@ + +module Square + module TeamMembers + module WageSetting + module Types + class UpdateWageSettingRequest < Internal::Types::Model + field :team_member_id, String, optional: false, nullable: false + field :wage_setting, Square::Types::WageSetting, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/actions/client.rb b/lib/square/terminal/actions/client.rb new file mode 100644 index 000000000..3b63a8d6a --- /dev/null +++ b/lib/square/terminal/actions/client.rb @@ -0,0 +1,68 @@ + +module Square + module Terminal + module Actions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Terminal::Actions::Client] + def initialize(client) + @client = client + end + + # Creates a Terminal action request and sends it to the specified device. + # + # @return [Square::Types::CreateTerminalActionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateTerminalActionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + # + # @return [Square::Types::SearchTerminalActionsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchTerminalActionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 days. + # + # @return [Square::Types::GetTerminalActionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTerminalActionResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels a Terminal action request if the status of the request permits it. + # + # @return [Square::Types::CancelTerminalActionResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelTerminalActionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/terminal/actions/types/cancel_actions_request.rb b/lib/square/terminal/actions/types/cancel_actions_request.rb new file mode 100644 index 000000000..0455d450d --- /dev/null +++ b/lib/square/terminal/actions/types/cancel_actions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Actions + module Types + class CancelActionsRequest < Internal::Types::Model + field :action_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/actions/types/create_terminal_action_request.rb b/lib/square/terminal/actions/types/create_terminal_action_request.rb new file mode 100644 index 000000000..7aa8b22f4 --- /dev/null +++ b/lib/square/terminal/actions/types/create_terminal_action_request.rb @@ -0,0 +1,14 @@ + +module Square + module Terminal + module Actions + module Types + class CreateTerminalActionRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :action, Square::Types::TerminalAction, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/actions/types/get_actions_request.rb b/lib/square/terminal/actions/types/get_actions_request.rb new file mode 100644 index 000000000..0a83a0675 --- /dev/null +++ b/lib/square/terminal/actions/types/get_actions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Actions + module Types + class GetActionsRequest < Internal::Types::Model + field :action_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/actions/types/search_terminal_actions_request.rb b/lib/square/terminal/actions/types/search_terminal_actions_request.rb new file mode 100644 index 000000000..6623ebae9 --- /dev/null +++ b/lib/square/terminal/actions/types/search_terminal_actions_request.rb @@ -0,0 +1,15 @@ + +module Square + module Terminal + module Actions + module Types + class SearchTerminalActionsRequest < Internal::Types::Model + field :query, Square::Types::TerminalActionQuery, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/checkouts/client.rb b/lib/square/terminal/checkouts/client.rb new file mode 100644 index 000000000..48b69d5d6 --- /dev/null +++ b/lib/square/terminal/checkouts/client.rb @@ -0,0 +1,69 @@ + +module Square + module Terminal + module Checkouts + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Terminal::Checkouts::Client] + def initialize(client) + @client = client + end + + # Creates a Terminal checkout request and sends it to the specified device to take a payment + # for the requested amount. + # + # @return [Square::Types::CreateTerminalCheckoutResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateTerminalCheckoutResponse.load(_response.body) + else + raise _response.body + end + end + + # Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + # + # @return [Square::Types::SearchTerminalCheckoutsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchTerminalCheckoutsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a Terminal checkout request by `checkout_id`. Terminal checkout requests are available for 30 days. + # + # @return [Square::Types::GetTerminalCheckoutResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTerminalCheckoutResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels a Terminal checkout request if the status of the request permits it. + # + # @return [Square::Types::CancelTerminalCheckoutResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelTerminalCheckoutResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/terminal/checkouts/types/cancel_checkouts_request.rb b/lib/square/terminal/checkouts/types/cancel_checkouts_request.rb new file mode 100644 index 000000000..f9dc0b074 --- /dev/null +++ b/lib/square/terminal/checkouts/types/cancel_checkouts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Checkouts + module Types + class CancelCheckoutsRequest < Internal::Types::Model + field :checkout_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/checkouts/types/create_terminal_checkout_request.rb b/lib/square/terminal/checkouts/types/create_terminal_checkout_request.rb new file mode 100644 index 000000000..68fba2f8f --- /dev/null +++ b/lib/square/terminal/checkouts/types/create_terminal_checkout_request.rb @@ -0,0 +1,14 @@ + +module Square + module Terminal + module Checkouts + module Types + class CreateTerminalCheckoutRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :checkout, Square::Types::TerminalCheckout, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/checkouts/types/get_checkouts_request.rb b/lib/square/terminal/checkouts/types/get_checkouts_request.rb new file mode 100644 index 000000000..15e779c3e --- /dev/null +++ b/lib/square/terminal/checkouts/types/get_checkouts_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Checkouts + module Types + class GetCheckoutsRequest < Internal::Types::Model + field :checkout_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/checkouts/types/search_terminal_checkouts_request.rb b/lib/square/terminal/checkouts/types/search_terminal_checkouts_request.rb new file mode 100644 index 000000000..4320091de --- /dev/null +++ b/lib/square/terminal/checkouts/types/search_terminal_checkouts_request.rb @@ -0,0 +1,15 @@ + +module Square + module Terminal + module Checkouts + module Types + class SearchTerminalCheckoutsRequest < Internal::Types::Model + field :query, Square::Types::TerminalCheckoutQuery, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/client.rb b/lib/square/terminal/client.rb new file mode 100644 index 000000000..0cebe9b7d --- /dev/null +++ b/lib/square/terminal/client.rb @@ -0,0 +1,55 @@ + +module Square + module Terminal + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Terminal::Client] + def initialize(client) + @client = client + end + + # Dismisses a Terminal action request if the status and type of the request permits it. + # + # See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details. + # + # @return [Square::Types::DismissTerminalActionResponse] + def dismiss_terminal_action(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DismissTerminalActionResponse.load(_response.body) + else + raise _response.body + end + end + + # Dismisses a Terminal checkout request if the status and type of the request permits it. + # + # @return [Square::Types::DismissTerminalCheckoutResponse] + def dismiss_terminal_checkout(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DismissTerminalCheckoutResponse.load(_response.body) + else + raise _response.body + end + end + + # Dismisses a Terminal refund request if the status and type of the request permits it. + # + # @return [Square::Types::DismissTerminalRefundResponse] + def dismiss_terminal_refund(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DismissTerminalRefundResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/terminal/refunds/client.rb b/lib/square/terminal/refunds/client.rb new file mode 100644 index 000000000..23f784194 --- /dev/null +++ b/lib/square/terminal/refunds/client.rb @@ -0,0 +1,68 @@ + +module Square + module Terminal + module Refunds + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Terminal::Refunds::Client] + def initialize(client) + @client = client + end + + # Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see [Refunds API](api:Refunds). + # + # @return [Square::Types::CreateTerminalRefundResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateTerminalRefundResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + # + # @return [Square::Types::SearchTerminalRefundsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchTerminalRefundsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days. + # + # @return [Square::Types::GetTerminalRefundResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetTerminalRefundResponse.load(_response.body) + else + raise _response.body + end + end + + # Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it. + # + # @return [Square::Types::CancelTerminalRefundResponse] + def cancel(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CancelTerminalRefundResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/terminal/refunds/types/cancel_refunds_request.rb b/lib/square/terminal/refunds/types/cancel_refunds_request.rb new file mode 100644 index 000000000..da0c66500 --- /dev/null +++ b/lib/square/terminal/refunds/types/cancel_refunds_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Refunds + module Types + class CancelRefundsRequest < Internal::Types::Model + field :terminal_refund_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/refunds/types/create_terminal_refund_request.rb b/lib/square/terminal/refunds/types/create_terminal_refund_request.rb new file mode 100644 index 000000000..8c8be5c5b --- /dev/null +++ b/lib/square/terminal/refunds/types/create_terminal_refund_request.rb @@ -0,0 +1,14 @@ + +module Square + module Terminal + module Refunds + module Types + class CreateTerminalRefundRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/refunds/types/get_refunds_request.rb b/lib/square/terminal/refunds/types/get_refunds_request.rb new file mode 100644 index 000000000..51b783c1c --- /dev/null +++ b/lib/square/terminal/refunds/types/get_refunds_request.rb @@ -0,0 +1,13 @@ + +module Square + module Terminal + module Refunds + module Types + class GetRefundsRequest < Internal::Types::Model + field :terminal_refund_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/refunds/types/search_terminal_refunds_request.rb b/lib/square/terminal/refunds/types/search_terminal_refunds_request.rb new file mode 100644 index 000000000..efbb10df0 --- /dev/null +++ b/lib/square/terminal/refunds/types/search_terminal_refunds_request.rb @@ -0,0 +1,15 @@ + +module Square + module Terminal + module Refunds + module Types + class SearchTerminalRefundsRequest < Internal::Types::Model + field :query, Square::Types::TerminalRefundQuery, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/terminal/types/dismiss_terminal_action_request.rb b/lib/square/terminal/types/dismiss_terminal_action_request.rb new file mode 100644 index 000000000..1b8a96c10 --- /dev/null +++ b/lib/square/terminal/types/dismiss_terminal_action_request.rb @@ -0,0 +1,11 @@ + +module Square + module Terminal + module Types + class DismissTerminalActionRequest < Internal::Types::Model + field :action_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/terminal/types/dismiss_terminal_checkout_request.rb b/lib/square/terminal/types/dismiss_terminal_checkout_request.rb new file mode 100644 index 000000000..efd5e9a59 --- /dev/null +++ b/lib/square/terminal/types/dismiss_terminal_checkout_request.rb @@ -0,0 +1,11 @@ + +module Square + module Terminal + module Types + class DismissTerminalCheckoutRequest < Internal::Types::Model + field :checkout_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/terminal/types/dismiss_terminal_refund_request.rb b/lib/square/terminal/types/dismiss_terminal_refund_request.rb new file mode 100644 index 000000000..a3b5ea430 --- /dev/null +++ b/lib/square/terminal/types/dismiss_terminal_refund_request.rb @@ -0,0 +1,11 @@ + +module Square + module Terminal + module Types + class DismissTerminalRefundRequest < Internal::Types::Model + field :terminal_refund_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/types/accept_dispute_response.rb b/lib/square/types/accept_dispute_response.rb new file mode 100644 index 000000000..9a4d3e582 --- /dev/null +++ b/lib/square/types/accept_dispute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in an `AcceptDispute` response. + class AcceptDisputeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :dispute, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/accepted_payment_methods.rb b/lib/square/types/accepted_payment_methods.rb new file mode 100644 index 000000000..0d9fbc14b --- /dev/null +++ b/lib/square/types/accepted_payment_methods.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class AcceptedPaymentMethods < Internal::Types::Model + field :apple_pay, Internal::Types::Boolean, optional: true, nullable: false + field :google_pay, Internal::Types::Boolean, optional: true, nullable: false + field :cash_app_pay, Internal::Types::Boolean, optional: true, nullable: false + field :afterpay_clearpay, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/accumulate_loyalty_points_response.rb b/lib/square/types/accumulate_loyalty_points_response.rb new file mode 100644 index 000000000..597d67b39 --- /dev/null +++ b/lib/square/types/accumulate_loyalty_points_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [AccumulateLoyaltyPoints](api-endpoint:Loyalty-AccumulateLoyaltyPoints) response. + class AccumulateLoyaltyPointsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :event, Square::Types::LoyaltyEvent, optional: true, nullable: false + field :events, Internal::Types::Array[Square::Types::LoyaltyEvent], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/ach_details.rb b/lib/square/types/ach_details.rb new file mode 100644 index 000000000..cb5ace648 --- /dev/null +++ b/lib/square/types/ach_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # ACH-specific details about `BANK_ACCOUNT` type payments with the `transfer_type` of `ACH`. + class AchDetails < Internal::Types::Model + field :routing_number, String, optional: true, nullable: false + field :account_number_suffix, String, optional: true, nullable: false + field :account_type, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/action_cancel_reason.rb b/lib/square/types/action_cancel_reason.rb new file mode 100644 index 000000000..39f0eee06 --- /dev/null +++ b/lib/square/types/action_cancel_reason.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ActionCancelReason + extend Square::Internal::Types::Enum + BUYER_CANCELED = "BUYER_CANCELED" + SELLER_CANCELED = "SELLER_CANCELED" + TIMED_OUT = "TIMED_OUT"end + end +end diff --git a/lib/square/types/activity_type.rb b/lib/square/types/activity_type.rb new file mode 100644 index 000000000..50c3d464c --- /dev/null +++ b/lib/square/types/activity_type.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Square + module Types + module ActivityType + extend Square::Internal::Types::Enum + ADJUSTMENT = "ADJUSTMENT" + APP_FEE_REFUND = "APP_FEE_REFUND" + APP_FEE_REVENUE = "APP_FEE_REVENUE" + AUTOMATIC_SAVINGS = "AUTOMATIC_SAVINGS" + AUTOMATIC_SAVINGS_REVERSED = "AUTOMATIC_SAVINGS_REVERSED" + CHARGE = "CHARGE" + DEPOSIT_FEE = "DEPOSIT_FEE" + DEPOSIT_FEE_REVERSED = "DEPOSIT_FEE_REVERSED" + DISPUTE = "DISPUTE" + ESCHEATMENT = "ESCHEATMENT" + FEE = "FEE" + FREE_PROCESSING = "FREE_PROCESSING" + HOLD_ADJUSTMENT = "HOLD_ADJUSTMENT" + INITIAL_BALANCE_CHANGE = "INITIAL_BALANCE_CHANGE" + MONEY_TRANSFER = "MONEY_TRANSFER" + MONEY_TRANSFER_REVERSAL = "MONEY_TRANSFER_REVERSAL" + OPEN_DISPUTE = "OPEN_DISPUTE" + OTHER = "OTHER" + OTHER_ADJUSTMENT = "OTHER_ADJUSTMENT" + PAID_SERVICE_FEE = "PAID_SERVICE_FEE" + PAID_SERVICE_FEE_REFUND = "PAID_SERVICE_FEE_REFUND" + REDEMPTION_CODE = "REDEMPTION_CODE" + REFUND = "REFUND" + RELEASE_ADJUSTMENT = "RELEASE_ADJUSTMENT" + RESERVE_HOLD = "RESERVE_HOLD" + RESERVE_RELEASE = "RESERVE_RELEASE" + RETURNED_PAYOUT = "RETURNED_PAYOUT" + SQUARE_CAPITAL_PAYMENT = "SQUARE_CAPITAL_PAYMENT" + SQUARE_CAPITAL_REVERSED_PAYMENT = "SQUARE_CAPITAL_REVERSED_PAYMENT" + SUBSCRIPTION_FEE = "SUBSCRIPTION_FEE" + SUBSCRIPTION_FEE_PAID_REFUND = "SUBSCRIPTION_FEE_PAID_REFUND" + SUBSCRIPTION_FEE_REFUND = "SUBSCRIPTION_FEE_REFUND" + TAX_ON_FEE = "TAX_ON_FEE" + THIRD_PARTY_FEE = "THIRD_PARTY_FEE" + THIRD_PARTY_FEE_REFUND = "THIRD_PARTY_FEE_REFUND" + PAYOUT = "PAYOUT" + AUTOMATIC_BITCOIN_CONVERSIONS = "AUTOMATIC_BITCOIN_CONVERSIONS" + AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED = "AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED" + CREDIT_CARD_REPAYMENT = "CREDIT_CARD_REPAYMENT" + CREDIT_CARD_REPAYMENT_REVERSED = "CREDIT_CARD_REPAYMENT_REVERSED" + LOCAL_OFFERS_CASHBACK = "LOCAL_OFFERS_CASHBACK" + LOCAL_OFFERS_FEE = "LOCAL_OFFERS_FEE" + PERCENTAGE_PROCESSING_ENROLLMENT = "PERCENTAGE_PROCESSING_ENROLLMENT" + PERCENTAGE_PROCESSING_DEACTIVATION = "PERCENTAGE_PROCESSING_DEACTIVATION" + PERCENTAGE_PROCESSING_REPAYMENT = "PERCENTAGE_PROCESSING_REPAYMENT" + PERCENTAGE_PROCESSING_REPAYMENT_REVERSED = "PERCENTAGE_PROCESSING_REPAYMENT_REVERSED" + PROCESSING_FEE = "PROCESSING_FEE" + PROCESSING_FEE_REFUND = "PROCESSING_FEE_REFUND" + UNDO_PROCESSING_FEE_REFUND = "UNDO_PROCESSING_FEE_REFUND" + GIFT_CARD_LOAD_FEE = "GIFT_CARD_LOAD_FEE" + GIFT_CARD_LOAD_FEE_REFUND = "GIFT_CARD_LOAD_FEE_REFUND" + UNDO_GIFT_CARD_LOAD_FEE_REFUND = "UNDO_GIFT_CARD_LOAD_FEE_REFUND" + BALANCE_FOLDERS_TRANSFER = "BALANCE_FOLDERS_TRANSFER" + BALANCE_FOLDERS_TRANSFER_REVERSED = "BALANCE_FOLDERS_TRANSFER_REVERSED" + GIFT_CARD_POOL_TRANSFER = "GIFT_CARD_POOL_TRANSFER" + GIFT_CARD_POOL_TRANSFER_REVERSED = "GIFT_CARD_POOL_TRANSFER_REVERSED" + SQUARE_PAYROLL_TRANSFER = "SQUARE_PAYROLL_TRANSFER" + SQUARE_PAYROLL_TRANSFER_REVERSED = "SQUARE_PAYROLL_TRANSFER_REVERSED"end + end +end diff --git a/lib/square/types/add_group_to_customer_response.rb b/lib/square/types/add_group_to_customer_response.rb new file mode 100644 index 000000000..a1d85088d --- /dev/null +++ b/lib/square/types/add_group_to_customer_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [AddGroupToCustomer](api-endpoint:Customers-AddGroupToCustomer) endpoint. + class AddGroupToCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/additional_recipient.rb b/lib/square/types/additional_recipient.rb new file mode 100644 index 000000000..92d9631b1 --- /dev/null +++ b/lib/square/types/additional_recipient.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an additional recipient (other than the merchant) receiving a portion of this tender. + class AdditionalRecipient < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :description, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :receivable_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/address.rb b/lib/square/types/address.rb new file mode 100644 index 000000000..b6d3197fc --- /dev/null +++ b/lib/square/types/address.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a postal address in a country. + # For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). + class Address < Internal::Types::Model + field :address_line_1, String, optional: true, nullable: false + field :address_line_2, String, optional: true, nullable: false + field :address_line_3, String, optional: true, nullable: false + field :locality, String, optional: true, nullable: false + field :sublocality, String, optional: true, nullable: false + field :sublocality_2, String, optional: true, nullable: false + field :sublocality_3, String, optional: true, nullable: false + field :administrative_district_level_1, String, optional: true, nullable: false + field :administrative_district_level_2, String, optional: true, nullable: false + field :administrative_district_level_3, String, optional: true, nullable: false + field :postal_code, String, optional: true, nullable: false + field :country, Square::Types::Country, optional: true, nullable: false + field :first_name, String, optional: true, nullable: false + field :last_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/adjust_loyalty_points_response.rb b/lib/square/types/adjust_loyalty_points_response.rb new file mode 100644 index 000000000..448637527 --- /dev/null +++ b/lib/square/types/adjust_loyalty_points_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [AdjustLoyaltyPoints](api-endpoint:Loyalty-AdjustLoyaltyPoints) request. + class AdjustLoyaltyPointsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :event, Square::Types::LoyaltyEvent, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/afterpay_details.rb b/lib/square/types/afterpay_details.rb new file mode 100644 index 000000000..82a23cba9 --- /dev/null +++ b/lib/square/types/afterpay_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about Afterpay payments. + class AfterpayDetails < Internal::Types::Model + field :email_address, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/application_details.rb b/lib/square/types/application_details.rb new file mode 100644 index 000000000..e23af4b90 --- /dev/null +++ b/lib/square/types/application_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Details about the application that took the payment. + class ApplicationDetails < Internal::Types::Model + field :square_product, Square::Types::ApplicationDetailsExternalSquareProduct, optional: true, nullable: false + field :application_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/application_details_external_square_product.rb b/lib/square/types/application_details_external_square_product.rb new file mode 100644 index 000000000..b45b4037f --- /dev/null +++ b/lib/square/types/application_details_external_square_product.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + module ApplicationDetailsExternalSquareProduct + extend Square::Internal::Types::Enum + APPOINTMENTS = "APPOINTMENTS" + ECOMMERCE_API = "ECOMMERCE_API" + INVOICES = "INVOICES" + ONLINE_STORE = "ONLINE_STORE" + OTHER = "OTHER" + RESTAURANTS = "RESTAURANTS" + RETAIL = "RETAIL" + SQUARE_POS = "SQUARE_POS" + TERMINAL_API = "TERMINAL_API" + VIRTUAL_TERMINAL = "VIRTUAL_TERMINAL"end + end +end diff --git a/lib/square/types/appointment_segment.rb b/lib/square/types/appointment_segment.rb new file mode 100644 index 000000000..3433ca912 --- /dev/null +++ b/lib/square/types/appointment_segment.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines an appointment segment of a booking. + class AppointmentSegment < Internal::Types::Model + field :duration_minutes, Integer, optional: true, nullable: false + field :service_variation_id, String, optional: true, nullable: false + field :team_member_id, String, optional: false, nullable: false + field :service_variation_version, Integer, optional: true, nullable: false + field :intermission_minutes, Integer, optional: true, nullable: false + field :any_team_member, Internal::Types::Boolean, optional: true, nullable: false + field :resource_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/archived_state.rb b/lib/square/types/archived_state.rb new file mode 100644 index 000000000..83fb71634 --- /dev/null +++ b/lib/square/types/archived_state.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ArchivedState + extend Square::Internal::Types::Enum + ARCHIVED_STATE_NOT_ARCHIVED = "ARCHIVED_STATE_NOT_ARCHIVED" + ARCHIVED_STATE_ARCHIVED = "ARCHIVED_STATE_ARCHIVED" + ARCHIVED_STATE_ALL = "ARCHIVED_STATE_ALL"end + end +end diff --git a/lib/square/types/availability.rb b/lib/square/types/availability.rb new file mode 100644 index 000000000..448a69871 --- /dev/null +++ b/lib/square/types/availability.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines an appointment slot that encapsulates the appointment segments, location and starting time available for booking. + class Availability < Internal::Types::Model + field :start_at, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :appointment_segments, Internal::Types::Array[Square::Types::AppointmentSegment], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account.rb b/lib/square/types/bank_account.rb new file mode 100644 index 000000000..ec4db57dc --- /dev/null +++ b/lib/square/types/bank_account.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a bank account. For more information about + # linking a bank account to a Square account, see + # [Bank Accounts API](https://developer.squareup.com/docs/bank-accounts-api). + class BankAccount < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :account_number_suffix, String, optional: false, nullable: false + field :country, Square::Types::Country, optional: false, nullable: false + field :currency, Square::Types::Currency, optional: false, nullable: false + field :account_type, Square::Types::BankAccountType, optional: false, nullable: false + field :holder_name, String, optional: false, nullable: false + field :primary_bank_identification_number, String, optional: false, nullable: false + field :secondary_bank_identification_number, String, optional: true, nullable: false + field :debit_mandate_reference_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :status, Square::Types::BankAccountStatus, optional: false, nullable: false + field :creditable, Internal::Types::Boolean, optional: false, nullable: false + field :debitable, Internal::Types::Boolean, optional: false, nullable: false + field :fingerprint, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :bank_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_created_event.rb b/lib/square/types/bank_account_created_event.rb new file mode 100644 index 000000000..8ce14e203 --- /dev/null +++ b/lib/square/types/bank_account_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when you link an external bank account to a Square + # account in the Seller Dashboard. Square sets the initial status to + # `VERIFICATION_IN_PROGRESS` and publishes the event. + class BankAccountCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::BankAccountCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_created_event_data.rb b/lib/square/types/bank_account_created_event_data.rb new file mode 100644 index 000000000..0f86994a0 --- /dev/null +++ b/lib/square/types/bank_account_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::BankAccountCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_created_event_object.rb b/lib/square/types/bank_account_created_event_object.rb new file mode 100644 index 000000000..3b93134d1 --- /dev/null +++ b/lib/square/types/bank_account_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountCreatedEventObject < Internal::Types::Model + field :bank_account, Square::Types::BankAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_disabled_event.rb b/lib/square/types/bank_account_disabled_event.rb new file mode 100644 index 000000000..a7e78ece0 --- /dev/null +++ b/lib/square/types/bank_account_disabled_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when Square sets the status of a + # [BankAccount](entity:BankAccount) to `DISABLED`. + class BankAccountDisabledEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::BankAccountDisabledEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_disabled_event_data.rb b/lib/square/types/bank_account_disabled_event_data.rb new file mode 100644 index 000000000..328999fb1 --- /dev/null +++ b/lib/square/types/bank_account_disabled_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountDisabledEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::BankAccountDisabledEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_disabled_event_object.rb b/lib/square/types/bank_account_disabled_event_object.rb new file mode 100644 index 000000000..9b80a2c8d --- /dev/null +++ b/lib/square/types/bank_account_disabled_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountDisabledEventObject < Internal::Types::Model + field :bank_account, Square::Types::BankAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_payment_details.rb b/lib/square/types/bank_account_payment_details.rb new file mode 100644 index 000000000..65c8da17c --- /dev/null +++ b/lib/square/types/bank_account_payment_details.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about BANK_ACCOUNT type payments. + class BankAccountPaymentDetails < Internal::Types::Model + field :bank_name, String, optional: true, nullable: false + field :transfer_type, String, optional: true, nullable: false + field :account_ownership_type, String, optional: true, nullable: false + field :fingerprint, String, optional: true, nullable: false + field :country, String, optional: true, nullable: false + field :statement_description, String, optional: true, nullable: false + field :ach_details, Square::Types::AchDetails, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_status.rb b/lib/square/types/bank_account_status.rb new file mode 100644 index 000000000..4d3193409 --- /dev/null +++ b/lib/square/types/bank_account_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module BankAccountStatus + extend Square::Internal::Types::Enum + VERIFICATION_IN_PROGRESS = "VERIFICATION_IN_PROGRESS" + VERIFIED = "VERIFIED" + DISABLED = "DISABLED"end + end +end diff --git a/lib/square/types/bank_account_type.rb b/lib/square/types/bank_account_type.rb new file mode 100644 index 000000000..9abd564d9 --- /dev/null +++ b/lib/square/types/bank_account_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module BankAccountType + extend Square::Internal::Types::Enum + CHECKING = "CHECKING" + SAVINGS = "SAVINGS" + INVESTMENT = "INVESTMENT" + OTHER = "OTHER" + BUSINESS_CHECKING = "BUSINESS_CHECKING"end + end +end diff --git a/lib/square/types/bank_account_verified_event.rb b/lib/square/types/bank_account_verified_event.rb new file mode 100644 index 000000000..07684fc14 --- /dev/null +++ b/lib/square/types/bank_account_verified_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when Square sets the status of a + # [BankAccount](entity:BankAccount) to `VERIFIED`. + class BankAccountVerifiedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::BankAccountVerifiedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_verified_event_data.rb b/lib/square/types/bank_account_verified_event_data.rb new file mode 100644 index 000000000..2e9e24c9e --- /dev/null +++ b/lib/square/types/bank_account_verified_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountVerifiedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::BankAccountVerifiedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bank_account_verified_event_object.rb b/lib/square/types/bank_account_verified_event_object.rb new file mode 100644 index 000000000..c17c4a56a --- /dev/null +++ b/lib/square/types/bank_account_verified_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class BankAccountVerifiedEventObject < Internal::Types::Model + field :bank_account, Square::Types::BankAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_change_inventory_request.rb b/lib/square/types/batch_change_inventory_request.rb new file mode 100644 index 000000000..7f512f629 --- /dev/null +++ b/lib/square/types/batch_change_inventory_request.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchChangeInventoryRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :changes, Internal::Types::Array[Square::Types::InventoryChange], optional: true, nullable: false + field :ignore_unchanged_counts, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_change_inventory_response.rb b/lib/square/types/batch_change_inventory_response.rb new file mode 100644 index 000000000..d7c7d2a34 --- /dev/null +++ b/lib/square/types/batch_change_inventory_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchChangeInventoryResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :counts, Internal::Types::Array[Square::Types::InventoryCount], optional: true, nullable: false + field :changes, Internal::Types::Array[Square::Types::InventoryChange], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_create_team_members_response.rb b/lib/square/types/batch_create_team_members_response.rb new file mode 100644 index 000000000..737d28d05 --- /dev/null +++ b/lib/square/types/batch_create_team_members_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a bulk create request containing the created `TeamMember` objects or error messages. + class BatchCreateTeamMembersResponse < Internal::Types::Model + field :team_members, Internal::Types::Hash[String, Square::Types::CreateTeamMemberResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_create_vendors_response.rb b/lib/square/types/batch_create_vendors_response.rb new file mode 100644 index 000000000..463910b46 --- /dev/null +++ b/lib/square/types/batch_create_vendors_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [BulkCreateVendors](api-endpoint:Vendors-BulkCreateVendors). + class BatchCreateVendorsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :responses, Internal::Types::Hash[String, Square::Types::CreateVendorResponse], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_delete_catalog_objects_response.rb b/lib/square/types/batch_delete_catalog_objects_response.rb new file mode 100644 index 000000000..825ce067b --- /dev/null +++ b/lib/square/types/batch_delete_catalog_objects_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchDeleteCatalogObjectsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :deleted_object_ids, Internal::Types::Array[String], optional: true, nullable: false + field :deleted_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_catalog_objects_response.rb b/lib/square/types/batch_get_catalog_objects_response.rb new file mode 100644 index 000000000..dd20df655 --- /dev/null +++ b/lib/square/types/batch_get_catalog_objects_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchGetCatalogObjectsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :related_objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_inventory_changes_response.rb b/lib/square/types/batch_get_inventory_changes_response.rb new file mode 100644 index 000000000..62f143de6 --- /dev/null +++ b/lib/square/types/batch_get_inventory_changes_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchGetInventoryChangesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :changes, Internal::Types::Array[Square::Types::InventoryChange], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_inventory_counts_request.rb b/lib/square/types/batch_get_inventory_counts_request.rb new file mode 100644 index 000000000..e26dad172 --- /dev/null +++ b/lib/square/types/batch_get_inventory_counts_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchGetInventoryCountsRequest < Internal::Types::Model + field :catalog_object_ids, Internal::Types::Array[String], optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :updated_after, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :states, Internal::Types::Array[Square::Types::InventoryState], optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_inventory_counts_response.rb b/lib/square/types/batch_get_inventory_counts_response.rb new file mode 100644 index 000000000..f0e87689c --- /dev/null +++ b/lib/square/types/batch_get_inventory_counts_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchGetInventoryCountsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :counts, Internal::Types::Array[Square::Types::InventoryCount], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_orders_response.rb b/lib/square/types/batch_get_orders_response.rb new file mode 100644 index 000000000..d64587024 --- /dev/null +++ b/lib/square/types/batch_get_orders_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `BatchRetrieveOrders` endpoint. + class BatchGetOrdersResponse < Internal::Types::Model + field :orders, Internal::Types::Array[Square::Types::Order], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_get_vendors_response.rb b/lib/square/types/batch_get_vendors_response.rb new file mode 100644 index 000000000..39037daa7 --- /dev/null +++ b/lib/square/types/batch_get_vendors_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [BulkRetrieveVendors](api-endpoint:Vendors-BulkRetrieveVendors). + class BatchGetVendorsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :responses, Internal::Types::Hash[String, Square::Types::GetVendorResponse], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_retrieve_inventory_changes_request.rb b/lib/square/types/batch_retrieve_inventory_changes_request.rb new file mode 100644 index 000000000..606653f18 --- /dev/null +++ b/lib/square/types/batch_retrieve_inventory_changes_request.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchRetrieveInventoryChangesRequest < Internal::Types::Model + field :catalog_object_ids, Internal::Types::Array[String], optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :types, Internal::Types::Array[Square::Types::InventoryChangeType], optional: true, nullable: false + field :states, Internal::Types::Array[Square::Types::InventoryState], optional: true, nullable: false + field :updated_after, String, optional: true, nullable: false + field :updated_before, String, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_update_team_members_response.rb b/lib/square/types/batch_update_team_members_response.rb new file mode 100644 index 000000000..821ca19db --- /dev/null +++ b/lib/square/types/batch_update_team_members_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a bulk update request containing the updated `TeamMember` objects or error messages. + class BatchUpdateTeamMembersResponse < Internal::Types::Model + field :team_members, Internal::Types::Hash[String, Square::Types::UpdateTeamMemberResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_update_vendors_response.rb b/lib/square/types/batch_update_vendors_response.rb new file mode 100644 index 000000000..9913587fd --- /dev/null +++ b/lib/square/types/batch_update_vendors_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [BulkUpdateVendors](api-endpoint:Vendors-BulkUpdateVendors). + class BatchUpdateVendorsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :responses, Internal::Types::Hash[String, Square::Types::UpdateVendorResponse], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_upsert_catalog_objects_response.rb b/lib/square/types/batch_upsert_catalog_objects_response.rb new file mode 100644 index 000000000..0bc83583b --- /dev/null +++ b/lib/square/types/batch_upsert_catalog_objects_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class BatchUpsertCatalogObjectsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :id_mappings, Internal::Types::Array[Square::Types::CatalogIdMapping], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.rb b/lib/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.rb new file mode 100644 index 000000000..59184daf0 --- /dev/null +++ b/lib/square/types/batch_upsert_customer_custom_attributes_request_customer_custom_attribute_upsert_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) + # request. An individual request contains a customer ID, the custom attribute to create or update, + # and an optional idempotency key. + class BatchUpsertCustomerCustomAttributesRequestCustomerCustomAttributeUpsertRequest < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_upsert_customer_custom_attributes_response.rb b/lib/square/types/batch_upsert_customer_custom_attributes_response.rb new file mode 100644 index 000000000..d35fc82c1 --- /dev/null +++ b/lib/square/types/batch_upsert_customer_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual upsert request. + class BatchUpsertCustomerCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.rb b/lib/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.rb new file mode 100644 index 000000000..483914d0a --- /dev/null +++ b/lib/square/types/batch_upsert_customer_custom_attributes_response_customer_custom_attribute_upsert_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response for an individual upsert request in a [BulkUpsertCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-BulkUpsertCustomerCustomAttributes) operation. + class BatchUpsertCustomerCustomAttributesResponseCustomerCustomAttributeUpsertResponse < Internal::Types::Model + field :customer_id, String, optional: true, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking.rb b/lib/square/types/booking.rb new file mode 100644 index 000000000..02819aa31 --- /dev/null +++ b/lib/square/types/booking.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a booking as a time-bound service contract for a seller's staff member to provide a specified service + # at a given location to a requesting customer in one or more appointment segments. + class Booking < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :status, Square::Types::BookingStatus, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :start_at, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :customer_note, String, optional: true, nullable: false + field :seller_note, String, optional: true, nullable: false + field :appointment_segments, Internal::Types::Array[Square::Types::AppointmentSegment], optional: true, nullable: false + field :transition_time_minutes, Integer, optional: true, nullable: false + field :all_day, Internal::Types::Boolean, optional: true, nullable: false + field :location_type, Square::Types::BusinessAppointmentSettingsBookingLocationType, optional: true, nullable: false + field :creator_details, Square::Types::BookingCreatorDetails, optional: true, nullable: false + field :source, Square::Types::BookingBookingSource, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_booking_source.rb b/lib/square/types/booking_booking_source.rb new file mode 100644 index 000000000..31c34e988 --- /dev/null +++ b/lib/square/types/booking_booking_source.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module BookingBookingSource + extend Square::Internal::Types::Enum + FIRST_PARTY_MERCHANT = "FIRST_PARTY_MERCHANT" + FIRST_PARTY_BUYER = "FIRST_PARTY_BUYER" + THIRD_PARTY_BUYER = "THIRD_PARTY_BUYER" + API = "API"end + end +end diff --git a/lib/square/types/booking_created_event.rb b/lib/square/types/booking_created_event.rb new file mode 100644 index 000000000..cc1d3e03a --- /dev/null +++ b/lib/square/types/booking_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking is created. + # + # To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope. + # To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope. + class BookingCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::BookingCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_created_event_data.rb b/lib/square/types/booking_created_event_data.rb new file mode 100644 index 000000000..9ea94e07b --- /dev/null +++ b/lib/square/types/booking_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BookingCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::BookingCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_created_event_object.rb b/lib/square/types/booking_created_event_object.rb new file mode 100644 index 000000000..476a2ac27 --- /dev/null +++ b/lib/square/types/booking_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class BookingCreatedEventObject < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_creator_details.rb b/lib/square/types/booking_creator_details.rb new file mode 100644 index 000000000..3138695ee --- /dev/null +++ b/lib/square/types/booking_creator_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about a booking creator. + class BookingCreatorDetails < Internal::Types::Model + field :creator_type, Square::Types::BookingCreatorDetailsCreatorType, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_creator_details_creator_type.rb b/lib/square/types/booking_creator_details_creator_type.rb new file mode 100644 index 000000000..aa14bab51 --- /dev/null +++ b/lib/square/types/booking_creator_details_creator_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module BookingCreatorDetailsCreatorType + extend Square::Internal::Types::Enum + TEAM_MEMBER = "TEAM_MEMBER" + CUSTOMER = "CUSTOMER"end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_owned_created_event.rb b/lib/square/types/booking_custom_attribute_definition_owned_created_event.rb new file mode 100644 index 000000000..8ff2f7fac --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_owned_created_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # is created by the subscribing application. Subscribe to this event to be notified + # when your application creates a booking custom attribute definition. + class BookingCustomAttributeDefinitionOwnedCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_owned_deleted_event.rb b/lib/square/types/booking_custom_attribute_definition_owned_deleted_event.rb new file mode 100644 index 000000000..3c2da1a11 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_owned_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # is deleted by the subscribing application. Subscribe to this event to be notified + # when your application deletes a booking custom attribute definition. + class BookingCustomAttributeDefinitionOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_owned_updated_event.rb b/lib/square/types/booking_custom_attribute_definition_owned_updated_event.rb new file mode 100644 index 000000000..72230d283 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_owned_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # is updated by the subscribing application. Subscribe to this event to be notified + # when your application updates a booking custom attribute definition. + class BookingCustomAttributeDefinitionOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_visible_created_event.rb b/lib/square/types/booking_custom_attribute_definition_visible_created_event.rb new file mode 100644 index 000000000..5450ed554 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_visible_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is created. + # An application that subscribes to this event is notified when a booking custom attribute definition is created + # by any application for which the subscribing application has read access to the booking custom attribute definition. + class BookingCustomAttributeDefinitionVisibleCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_visible_deleted_event.rb b/lib/square/types/booking_custom_attribute_definition_visible_deleted_event.rb new file mode 100644 index 000000000..0a509ee65 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_visible_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. + # An application that subscribes to this event is notified when a booking custom attribute definition is deleted + # by any application for which the subscribing application has read access to the booking custom attribute definition. + class BookingCustomAttributeDefinitionVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_definition_visible_updated_event.rb b/lib/square/types/booking_custom_attribute_definition_visible_updated_event.rb new file mode 100644 index 000000000..d081000b8 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_definition_visible_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute definition](entity:CustomAttributeDefinition) + # with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. + # An application that subscribes to this event is notified when a booking custom attribute definition is updated + # by any application for which the subscribing application has read access to the booking custom attribute definition. + class BookingCustomAttributeDefinitionVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_delete_request.rb b/lib/square/types/booking_custom_attribute_delete_request.rb new file mode 100644 index 000000000..9cb714070 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_delete_request.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual delete request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) + # request. An individual request contains a booking ID, the custom attribute to delete, and an optional idempotency key. + class BookingCustomAttributeDeleteRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :key, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_delete_response.rb b/lib/square/types/booking_custom_attribute_delete_response.rb new file mode 100644 index 000000000..fbf3e0a90 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_delete_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response for an individual upsert request in a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) operation. + class BookingCustomAttributeDeleteResponse < Internal::Types::Model + field :booking_id, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_owned_deleted_event.rb b/lib/square/types/booking_custom_attribute_owned_deleted_event.rb new file mode 100644 index 000000000..135fa9a9f --- /dev/null +++ b/lib/square/types/booking_custom_attribute_owned_deleted_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute](entity:CustomAttribute) + # associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is + # owned by the subscribing application is deleted. + # Subscribe to this event to be notified + # when your application deletes a booking custom attribute. + class BookingCustomAttributeOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_owned_updated_event.rb b/lib/square/types/booking_custom_attribute_owned_updated_event.rb new file mode 100644 index 000000000..68766abdc --- /dev/null +++ b/lib/square/types/booking_custom_attribute_owned_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute](entity:CustomAttribute) + # is updated by the subscribing application. Subscribe to this event to be notified + # when your application updates a booking custom attribute. + class BookingCustomAttributeOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_upsert_request.rb b/lib/square/types/booking_custom_attribute_upsert_request.rb new file mode 100644 index 000000000..5cd652ce3 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_upsert_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) + # request. An individual request contains a booking ID, the custom attribute to create or update, + # and an optional idempotency key. + class BookingCustomAttributeUpsertRequest < Internal::Types::Model + field :booking_id, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_upsert_response.rb b/lib/square/types/booking_custom_attribute_upsert_response.rb new file mode 100644 index 000000000..10cb7e473 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_upsert_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response for an individual upsert request in a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) operation. + class BookingCustomAttributeUpsertResponse < Internal::Types::Model + field :booking_id, String, optional: true, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_visible_deleted_event.rb b/lib/square/types/booking_custom_attribute_visible_deleted_event.rb new file mode 100644 index 000000000..106ae79fb --- /dev/null +++ b/lib/square/types/booking_custom_attribute_visible_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute](entity:CustomAttribute) with + # the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. + # An application that subscribes to this event is notified when a booking custom attribute is deleted + # by any application for which the subscribing application has read access to the booking custom attribute. + class BookingCustomAttributeVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_custom_attribute_visible_updated_event.rb b/lib/square/types/booking_custom_attribute_visible_updated_event.rb new file mode 100644 index 000000000..23a70f3f9 --- /dev/null +++ b/lib/square/types/booking_custom_attribute_visible_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking [custom attribute](entity:CustomAttribute) + # with the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. + # An application that subscribes to this event is notified when a booking custom attribute is updated + # by any application for which the subscribing application has read access to the booking custom attribute. + class BookingCustomAttributeVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_status.rb b/lib/square/types/booking_status.rb new file mode 100644 index 000000000..d2430884c --- /dev/null +++ b/lib/square/types/booking_status.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module BookingStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + CANCELLED_BY_CUSTOMER = "CANCELLED_BY_CUSTOMER" + CANCELLED_BY_SELLER = "CANCELLED_BY_SELLER" + DECLINED = "DECLINED" + ACCEPTED = "ACCEPTED" + NO_SHOW = "NO_SHOW"end + end +end diff --git a/lib/square/types/booking_updated_event.rb b/lib/square/types/booking_updated_event.rb new file mode 100644 index 000000000..c537762ff --- /dev/null +++ b/lib/square/types/booking_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a booking is updated or cancelled. + # + # To receive this event with buyer-level permissions, you must have `APPOINTMENTS_READ` set for the OAuth scope. + # To receive this event with seller-level permissions, you must have `APPOINTMENTS_ALL_READ` and `APPOINTMENTS_READ` set for the OAuth scope. + class BookingUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::BookingUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_updated_event_data.rb b/lib/square/types/booking_updated_event_data.rb new file mode 100644 index 000000000..ccf60b9c5 --- /dev/null +++ b/lib/square/types/booking_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class BookingUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::BookingUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/booking_updated_event_object.rb b/lib/square/types/booking_updated_event_object.rb new file mode 100644 index 000000000..1bc080150 --- /dev/null +++ b/lib/square/types/booking_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class BookingUpdatedEventObject < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/break_.rb b/lib/square/types/break_.rb new file mode 100644 index 000000000..9d14501de --- /dev/null +++ b/lib/square/types/break_.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # A record of a team member's break on a [timecard](entity:Timecard). + class Break < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :start_at, String, optional: false, nullable: false + field :end_at, String, optional: true, nullable: false + field :break_type_id, String, optional: false, nullable: false + field :name, String, optional: false, nullable: false + field :expected_duration, String, optional: false, nullable: false + field :is_paid, Internal::Types::Boolean, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/break_type.rb b/lib/square/types/break_type.rb new file mode 100644 index 000000000..1a74498b9 --- /dev/null +++ b/lib/square/types/break_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # A template for a type of [break](entity:Break) that can be added to a + # [timecard](entity:Timecard), including the expected duration and paid status. + class BreakType < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :break_name, String, optional: false, nullable: false + field :expected_duration, String, optional: false, nullable: false + field :is_paid, Internal::Types::Boolean, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_create_customer_data.rb b/lib/square/types/bulk_create_customer_data.rb new file mode 100644 index 000000000..44518258b --- /dev/null +++ b/lib/square/types/bulk_create_customer_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the customer data provided in individual create requests for a + # [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) operation. + class BulkCreateCustomerData < Internal::Types::Model + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :nickname, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :birthday, String, optional: true, nullable: false + field :tax_ids, Square::Types::CustomerTaxIds, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_create_customers_response.rb b/lib/square/types/bulk_create_customers_response.rb new file mode 100644 index 000000000..5cef1298d --- /dev/null +++ b/lib/square/types/bulk_create_customers_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields included in the response body from the + # [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. + class BulkCreateCustomersResponse < Internal::Types::Model + field :responses, Internal::Types::Hash[String, Square::Types::CreateCustomerResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_booking_custom_attributes_response.rb b/lib/square/types/bulk_delete_booking_custom_attributes_response.rb new file mode 100644 index 000000000..af8609b89 --- /dev/null +++ b/lib/square/types/bulk_delete_booking_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkDeleteBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkDeleteBookingCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual delete request. + class BulkDeleteBookingCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BookingCustomAttributeDeleteResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_customers_response.rb b/lib/square/types/bulk_delete_customers_response.rb new file mode 100644 index 000000000..b733cc3df --- /dev/null +++ b/lib/square/types/bulk_delete_customers_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields included in the response body from the + # [BulkDeleteCustomers](api-endpoint:Customers-BulkDeleteCustomers) endpoint. + class BulkDeleteCustomersResponse < Internal::Types::Model + field :responses, Internal::Types::Hash[String, Square::Types::DeleteCustomerResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.rb b/lib/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.rb new file mode 100644 index 000000000..0f313b015 --- /dev/null +++ b/lib/square/types/bulk_delete_location_custom_attributes_request_location_custom_attribute_delete_request.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual delete request in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) + # request. An individual request contains an optional ID of the associated custom attribute definition + # and optional key of the associated custom attribute definition. + class BulkDeleteLocationCustomAttributesRequestLocationCustomAttributeDeleteRequest < Internal::Types::Model + field :key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_location_custom_attributes_response.rb b/lib/square/types/bulk_delete_location_custom_attributes_response.rb new file mode 100644 index 000000000..ae0fb1217 --- /dev/null +++ b/lib/square/types/bulk_delete_location_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual delete request. + class BulkDeleteLocationCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse], optional: false, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.rb b/lib/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.rb new file mode 100644 index 000000000..17c200b8c --- /dev/null +++ b/lib/square/types/bulk_delete_location_custom_attributes_response_location_custom_attribute_delete_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual delete response in a [BulkDeleteLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkDeleteLocationCustomAttributes) + # request. + class BulkDeleteLocationCustomAttributesResponseLocationCustomAttributeDeleteResponse < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.rb b/lib/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.rb new file mode 100644 index 000000000..8d3dba6e9 --- /dev/null +++ b/lib/square/types/bulk_delete_merchant_custom_attributes_request_merchant_custom_attribute_delete_request.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual delete request in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) + # request. An individual request contains an optional ID of the associated custom attribute definition + # and optional key of the associated custom attribute definition. + class BulkDeleteMerchantCustomAttributesRequestMerchantCustomAttributeDeleteRequest < Internal::Types::Model + field :key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_merchant_custom_attributes_response.rb b/lib/square/types/bulk_delete_merchant_custom_attributes_response.rb new file mode 100644 index 000000000..5251ac398 --- /dev/null +++ b/lib/square/types/bulk_delete_merchant_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual delete request. + class BulkDeleteMerchantCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse], optional: false, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.rb b/lib/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.rb new file mode 100644 index 000000000..e65c13eb7 --- /dev/null +++ b/lib/square/types/bulk_delete_merchant_custom_attributes_response_merchant_custom_attribute_delete_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual delete response in a [BulkDeleteMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkDeleteMerchantCustomAttributes) + # request. + class BulkDeleteMerchantCustomAttributesResponseMerchantCustomAttributeDeleteResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.rb b/lib/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.rb new file mode 100644 index 000000000..dd3302a33 --- /dev/null +++ b/lib/square/types/bulk_delete_order_custom_attributes_request_delete_custom_attribute.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents one delete within the bulk operation. + class BulkDeleteOrderCustomAttributesRequestDeleteCustomAttribute < Internal::Types::Model + field :key, String, optional: true, nullable: false + field :order_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_delete_order_custom_attributes_response.rb b/lib/square/types/bulk_delete_order_custom_attributes_response.rb new file mode 100644 index 000000000..0691be6b7 --- /dev/null +++ b/lib/square/types/bulk_delete_order_custom_attributes_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from deleting one or more order custom attributes. + class BulkDeleteOrderCustomAttributesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :values, Internal::Types::Hash[String, Square::Types::DeleteOrderCustomAttributeResponse], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_publish_scheduled_shifts_data.rb b/lib/square/types/bulk_publish_scheduled_shifts_data.rb new file mode 100644 index 000000000..b029c140b --- /dev/null +++ b/lib/square/types/bulk_publish_scheduled_shifts_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents options for an individual publish request in a + # [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) + # operation, provided as the value in a key-value pair. + class BulkPublishScheduledShiftsData < Internal::Types::Model + field :version, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_publish_scheduled_shifts_response.rb b/lib/square/types/bulk_publish_scheduled_shifts_response.rb new file mode 100644 index 000000000..fda14ca71 --- /dev/null +++ b/lib/square/types/bulk_publish_scheduled_shifts_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkPublishScheduledShifts](api-endpoint:Labor-BulkPublishScheduledShifts) response. + # Either `scheduled_shifts` or `errors` is present in the response. + class BulkPublishScheduledShiftsResponse < Internal::Types::Model + field :responses, Internal::Types::Hash[String, Square::Types::PublishScheduledShiftResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_retrieve_bookings_response.rb b/lib/square/types/bulk_retrieve_bookings_response.rb new file mode 100644 index 000000000..c9aa27f94 --- /dev/null +++ b/lib/square/types/bulk_retrieve_bookings_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Response payload for bulk retrieval of bookings. + class BulkRetrieveBookingsResponse < Internal::Types::Model + field :bookings, Internal::Types::Hash[String, Square::Types::GetBookingResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_retrieve_customers_response.rb b/lib/square/types/bulk_retrieve_customers_response.rb new file mode 100644 index 000000000..2777ddd0d --- /dev/null +++ b/lib/square/types/bulk_retrieve_customers_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields included in the response body from the + # [BulkRetrieveCustomers](api-endpoint:Customers-BulkRetrieveCustomers) endpoint. + class BulkRetrieveCustomersResponse < Internal::Types::Model + field :responses, Internal::Types::Hash[String, Square::Types::GetCustomerResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_retrieve_team_member_booking_profiles_response.rb b/lib/square/types/bulk_retrieve_team_member_booking_profiles_response.rb new file mode 100644 index 000000000..fefa4f81b --- /dev/null +++ b/lib/square/types/bulk_retrieve_team_member_booking_profiles_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Response payload for the [BulkRetrieveTeamMemberBookingProfiles](api-endpoint:Bookings-BulkRetrieveTeamMemberBookingProfiles) endpoint. + class BulkRetrieveTeamMemberBookingProfilesResponse < Internal::Types::Model + field :team_member_booking_profiles, Internal::Types::Hash[String, Square::Types::GetTeamMemberBookingProfileResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_swap_plan_response.rb b/lib/square/types/bulk_swap_plan_response.rb new file mode 100644 index 000000000..4c352a2b0 --- /dev/null +++ b/lib/square/types/bulk_swap_plan_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response of the + # [BulkSwapPlan](api-endpoint:Subscriptions-BulkSwapPlan) endpoint. + class BulkSwapPlanResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :affected_subscriptions, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_update_customer_data.rb b/lib/square/types/bulk_update_customer_data.rb new file mode 100644 index 000000000..5ad65d9f9 --- /dev/null +++ b/lib/square/types/bulk_update_customer_data.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the customer data provided in individual update requests for a + # [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) operation. + class BulkUpdateCustomerData < Internal::Types::Model + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :nickname, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :birthday, String, optional: true, nullable: false + field :tax_ids, Square::Types::CustomerTaxIds, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_update_customers_response.rb b/lib/square/types/bulk_update_customers_response.rb new file mode 100644 index 000000000..b033fe434 --- /dev/null +++ b/lib/square/types/bulk_update_customers_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields included in the response body from the + # [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. + class BulkUpdateCustomersResponse < Internal::Types::Model + field :responses, Internal::Types::Hash[String, Square::Types::UpdateCustomerResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_booking_custom_attributes_response.rb b/lib/square/types/bulk_upsert_booking_custom_attributes_response.rb new file mode 100644 index 000000000..f60151e4b --- /dev/null +++ b/lib/square/types/bulk_upsert_booking_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkUpsertBookingCustomAttributes](api-endpoint:BookingCustomAttributes-BulkUpsertBookingCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual upsert request. + class BulkUpsertBookingCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BookingCustomAttributeUpsertResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.rb b/lib/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.rb new file mode 100644 index 000000000..d918729d2 --- /dev/null +++ b/lib/square/types/bulk_upsert_location_custom_attributes_request_location_custom_attribute_upsert_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) + # request. An individual request contains a location ID, the custom attribute to create or update, + # and an optional idempotency key. + class BulkUpsertLocationCustomAttributesRequestLocationCustomAttributeUpsertRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_location_custom_attributes_response.rb b/lib/square/types/bulk_upsert_location_custom_attributes_response.rb new file mode 100644 index 000000000..1cc555694 --- /dev/null +++ b/lib/square/types/bulk_upsert_location_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual upsert request. + class BulkUpsertLocationCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.rb b/lib/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.rb new file mode 100644 index 000000000..d3378e678 --- /dev/null +++ b/lib/square/types/bulk_upsert_location_custom_attributes_response_location_custom_attribute_upsert_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response for an individual upsert request in a [BulkUpsertLocationCustomAttributes](api-endpoint:LocationCustomAttributes-BulkUpsertLocationCustomAttributes) operation. + class BulkUpsertLocationCustomAttributesResponseLocationCustomAttributeUpsertResponse < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.rb b/lib/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.rb new file mode 100644 index 000000000..3547c8a32 --- /dev/null +++ b/lib/square/types/bulk_upsert_merchant_custom_attributes_request_merchant_custom_attribute_upsert_request.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) + # request. An individual request contains a merchant ID, the custom attribute to create or update, + # and an optional idempotency key. + class BulkUpsertMerchantCustomAttributesRequestMerchantCustomAttributeUpsertRequest < Internal::Types::Model + field :merchant_id, String, optional: false, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_merchant_custom_attributes_response.rb b/lib/square/types/bulk_upsert_merchant_custom_attributes_response.rb new file mode 100644 index 000000000..f83bce458 --- /dev/null +++ b/lib/square/types/bulk_upsert_merchant_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) response, + # which contains a map of responses that each corresponds to an individual upsert request. + class BulkUpsertMerchantCustomAttributesResponse < Internal::Types::Model + field :values, Internal::Types::Hash[String, Square::Types::BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.rb b/lib/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.rb new file mode 100644 index 000000000..7be17fde7 --- /dev/null +++ b/lib/square/types/bulk_upsert_merchant_custom_attributes_response_merchant_custom_attribute_upsert_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response for an individual upsert request in a [BulkUpsertMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-BulkUpsertMerchantCustomAttributes) operation. + class BulkUpsertMerchantCustomAttributesResponseMerchantCustomAttributeUpsertResponse < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.rb b/lib/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.rb new file mode 100644 index 000000000..695be494e --- /dev/null +++ b/lib/square/types/bulk_upsert_order_custom_attributes_request_upsert_custom_attribute.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents one upsert within the bulk operation. + class BulkUpsertOrderCustomAttributesRequestUpsertCustomAttribute < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + field :order_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/bulk_upsert_order_custom_attributes_response.rb b/lib/square/types/bulk_upsert_order_custom_attributes_response.rb new file mode 100644 index 000000000..4ef46c800 --- /dev/null +++ b/lib/square/types/bulk_upsert_order_custom_attributes_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a bulk upsert of order custom attributes. + class BulkUpsertOrderCustomAttributesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :values, Internal::Types::Hash[String, Square::Types::UpsertOrderCustomAttributeResponse], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/business_appointment_settings.rb b/lib/square/types/business_appointment_settings.rb new file mode 100644 index 000000000..6d164761e --- /dev/null +++ b/lib/square/types/business_appointment_settings.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # The service appointment settings, including where and how the service is provided. + class BusinessAppointmentSettings < Internal::Types::Model + field :location_types, Internal::Types::Array[Square::Types::BusinessAppointmentSettingsBookingLocationType], optional: true, nullable: false + field :alignment_time, Square::Types::BusinessAppointmentSettingsAlignmentTime, optional: true, nullable: false + field :min_booking_lead_time_seconds, Integer, optional: true, nullable: false + field :max_booking_lead_time_seconds, Integer, optional: true, nullable: false + field :any_team_member_booking_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :multiple_service_booking_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :max_appointments_per_day_limit_type, Square::Types::BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType, optional: true, nullable: false + field :max_appointments_per_day_limit, Integer, optional: true, nullable: false + field :cancellation_window_seconds, Integer, optional: true, nullable: false + field :cancellation_fee_money, Square::Types::Money, optional: true, nullable: false + field :cancellation_policy, Square::Types::BusinessAppointmentSettingsCancellationPolicy, optional: true, nullable: false + field :cancellation_policy_text, String, optional: true, nullable: false + field :skip_booking_flow_staff_selection, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/business_appointment_settings_alignment_time.rb b/lib/square/types/business_appointment_settings_alignment_time.rb new file mode 100644 index 000000000..734288280 --- /dev/null +++ b/lib/square/types/business_appointment_settings_alignment_time.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessAppointmentSettingsAlignmentTime + extend Square::Internal::Types::Enum + SERVICE_DURATION = "SERVICE_DURATION" + QUARTER_HOURLY = "QUARTER_HOURLY" + HALF_HOURLY = "HALF_HOURLY" + HOURLY = "HOURLY"end + end +end diff --git a/lib/square/types/business_appointment_settings_booking_location_type.rb b/lib/square/types/business_appointment_settings_booking_location_type.rb new file mode 100644 index 000000000..34688f182 --- /dev/null +++ b/lib/square/types/business_appointment_settings_booking_location_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessAppointmentSettingsBookingLocationType + extend Square::Internal::Types::Enum + BUSINESS_LOCATION = "BUSINESS_LOCATION" + CUSTOMER_LOCATION = "CUSTOMER_LOCATION" + PHONE = "PHONE"end + end +end diff --git a/lib/square/types/business_appointment_settings_cancellation_policy.rb b/lib/square/types/business_appointment_settings_cancellation_policy.rb new file mode 100644 index 000000000..3dc15f1e6 --- /dev/null +++ b/lib/square/types/business_appointment_settings_cancellation_policy.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessAppointmentSettingsCancellationPolicy + extend Square::Internal::Types::Enum + CANCELLATION_TREATED_AS_NO_SHOW = "CANCELLATION_TREATED_AS_NO_SHOW" + CUSTOM_POLICY = "CUSTOM_POLICY"end + end +end diff --git a/lib/square/types/business_appointment_settings_max_appointments_per_day_limit_type.rb b/lib/square/types/business_appointment_settings_max_appointments_per_day_limit_type.rb new file mode 100644 index 000000000..efc83e74a --- /dev/null +++ b/lib/square/types/business_appointment_settings_max_appointments_per_day_limit_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessAppointmentSettingsMaxAppointmentsPerDayLimitType + extend Square::Internal::Types::Enum + PER_TEAM_MEMBER = "PER_TEAM_MEMBER" + PER_LOCATION = "PER_LOCATION"end + end +end diff --git a/lib/square/types/business_booking_profile.rb b/lib/square/types/business_booking_profile.rb new file mode 100644 index 000000000..ef1ef101e --- /dev/null +++ b/lib/square/types/business_booking_profile.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A seller's business booking profile, including booking policy, appointment settings, etc. + class BusinessBookingProfile < Internal::Types::Model + field :seller_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :booking_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :customer_timezone_choice, Square::Types::BusinessBookingProfileCustomerTimezoneChoice, optional: true, nullable: false + field :booking_policy, Square::Types::BusinessBookingProfileBookingPolicy, optional: true, nullable: false + field :allow_user_cancel, Internal::Types::Boolean, optional: true, nullable: false + field :business_appointment_settings, Square::Types::BusinessAppointmentSettings, optional: true, nullable: false + field :support_seller_level_writes, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/business_booking_profile_booking_policy.rb b/lib/square/types/business_booking_profile_booking_policy.rb new file mode 100644 index 000000000..e542aacc7 --- /dev/null +++ b/lib/square/types/business_booking_profile_booking_policy.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessBookingProfileBookingPolicy + extend Square::Internal::Types::Enum + ACCEPT_ALL = "ACCEPT_ALL" + REQUIRES_ACCEPTANCE = "REQUIRES_ACCEPTANCE"end + end +end diff --git a/lib/square/types/business_booking_profile_customer_timezone_choice.rb b/lib/square/types/business_booking_profile_customer_timezone_choice.rb new file mode 100644 index 000000000..841e54635 --- /dev/null +++ b/lib/square/types/business_booking_profile_customer_timezone_choice.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module BusinessBookingProfileCustomerTimezoneChoice + extend Square::Internal::Types::Enum + BUSINESS_LOCATION_TIMEZONE = "BUSINESS_LOCATION_TIMEZONE" + CUSTOMER_CHOICE = "CUSTOMER_CHOICE"end + end +end diff --git a/lib/square/types/business_hours.rb b/lib/square/types/business_hours.rb new file mode 100644 index 000000000..4141cdbdf --- /dev/null +++ b/lib/square/types/business_hours.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The hours of operation for a location. + class BusinessHours < Internal::Types::Model + field :periods, Internal::Types::Array[Square::Types::BusinessHoursPeriod], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/business_hours_period.rb b/lib/square/types/business_hours_period.rb new file mode 100644 index 000000000..da67eff07 --- /dev/null +++ b/lib/square/types/business_hours_period.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a period of time during which a business location is open. + class BusinessHoursPeriod < Internal::Types::Model + field :day_of_week, Square::Types::DayOfWeek, optional: true, nullable: false + field :start_local_time, String, optional: true, nullable: false + field :end_local_time, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/buy_now_pay_later_details.rb b/lib/square/types/buy_now_pay_later_details.rb new file mode 100644 index 000000000..5fdb89d42 --- /dev/null +++ b/lib/square/types/buy_now_pay_later_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about a Buy Now Pay Later payment type. + class BuyNowPayLaterDetails < Internal::Types::Model + field :brand, String, optional: true, nullable: false + field :afterpay_details, Square::Types::AfterpayDetails, optional: true, nullable: false + field :clearpay_details, Square::Types::ClearpayDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/calculate_loyalty_points_response.rb b/lib/square/types/calculate_loyalty_points_response.rb new file mode 100644 index 000000000..ebd750049 --- /dev/null +++ b/lib/square/types/calculate_loyalty_points_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CalculateLoyaltyPoints](api-endpoint:Loyalty-CalculateLoyaltyPoints) response. + class CalculateLoyaltyPointsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :points, Integer, optional: true, nullable: false + field :promotion_points, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/calculate_order_response.rb b/lib/square/types/calculate_order_response.rb new file mode 100644 index 000000000..d8eb3f07c --- /dev/null +++ b/lib/square/types/calculate_order_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CalculateOrderResponse < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_booking_response.rb b/lib/square/types/cancel_booking_response.rb new file mode 100644 index 000000000..6eb5a1e6c --- /dev/null +++ b/lib/square/types/cancel_booking_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CancelBookingResponse < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_invoice_response.rb b/lib/square/types/cancel_invoice_response.rb new file mode 100644 index 000000000..25c786615 --- /dev/null +++ b/lib/square/types/cancel_invoice_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response returned by the `CancelInvoice` request. + class CancelInvoiceResponse < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_loyalty_promotion_response.rb b/lib/square/types/cancel_loyalty_promotion_response.rb new file mode 100644 index 000000000..42502c245 --- /dev/null +++ b/lib/square/types/cancel_loyalty_promotion_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CancelLoyaltyPromotion](api-endpoint:Loyalty-CancelLoyaltyPromotion) response. + # Either `loyalty_promotion` or `errors` is present in the response. + class CancelLoyaltyPromotionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_payment_by_idempotency_key_response.rb b/lib/square/types/cancel_payment_by_idempotency_key_response.rb new file mode 100644 index 000000000..8e5bac4d8 --- /dev/null +++ b/lib/square/types/cancel_payment_by_idempotency_key_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by + # [CancelPaymentByIdempotencyKey](api-endpoint:Payments-CancelPaymentByIdempotencyKey). + # On success, `errors` is empty. + class CancelPaymentByIdempotencyKeyResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_payment_response.rb b/lib/square/types/cancel_payment_response.rb new file mode 100644 index 000000000..52e2f1cb2 --- /dev/null +++ b/lib/square/types/cancel_payment_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [CancelPayment](api-endpoint:Payments-CancelPayment). + class CancelPaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_subscription_response.rb b/lib/square/types/cancel_subscription_response.rb new file mode 100644 index 000000000..471ee16af --- /dev/null +++ b/lib/square/types/cancel_subscription_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [CancelSubscription](api-endpoint:Subscriptions-CancelSubscription) endpoint. + class CancelSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_terminal_action_response.rb b/lib/square/types/cancel_terminal_action_response.rb new file mode 100644 index 000000000..8df709d06 --- /dev/null +++ b/lib/square/types/cancel_terminal_action_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CancelTerminalActionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_terminal_checkout_response.rb b/lib/square/types/cancel_terminal_checkout_response.rb new file mode 100644 index 000000000..2487c3058 --- /dev/null +++ b/lib/square/types/cancel_terminal_checkout_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CancelTerminalCheckoutResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cancel_terminal_refund_response.rb b/lib/square/types/cancel_terminal_refund_response.rb new file mode 100644 index 000000000..d222a5f13 --- /dev/null +++ b/lib/square/types/cancel_terminal_refund_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CancelTerminalRefundResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/capture_transaction_response.rb b/lib/square/types/capture_transaction_response.rb new file mode 100644 index 000000000..7292983fb --- /dev/null +++ b/lib/square/types/capture_transaction_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CaptureTransaction](api-endpoint:Transactions-CaptureTransaction) endpoint. + class CaptureTransactionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card.rb b/lib/square/types/card.rb new file mode 100644 index 000000000..0760243fd --- /dev/null +++ b/lib/square/types/card.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the payment details of a card to be used for payments. These + # details are determined by the payment token generated by Web Payments SDK. + class Card < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :card_brand, Square::Types::CardBrand, optional: true, nullable: false + field :last_4, String, optional: true, nullable: false + field :exp_month, Integer, optional: true, nullable: false + field :exp_year, Integer, optional: true, nullable: false + field :cardholder_name, String, optional: true, nullable: false + field :billing_address, Square::Types::Address, optional: true, nullable: false + field :fingerprint, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + field :card_type, Square::Types::CardType, optional: true, nullable: false + field :prepaid_type, Square::Types::CardPrepaidType, optional: true, nullable: false + field :bin, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :card_co_brand, Square::Types::CardCoBrand, optional: true, nullable: false + field :issuer_alert, String, optional: true, nullable: false + field :issuer_alert_at, String, optional: true, nullable: false + field :hsa_fsa, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_automatically_updated_event.rb b/lib/square/types/card_automatically_updated_event.rb new file mode 100644 index 000000000..d75d22297 --- /dev/null +++ b/lib/square/types/card_automatically_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when Square automatically updates the expiration date or + # primary account number (PAN) of a [card](entity:Card) or adds or removes an issuer alert. + class CardAutomaticallyUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CardAutomaticallyUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_automatically_updated_event_data.rb b/lib/square/types/card_automatically_updated_event_data.rb new file mode 100644 index 000000000..85aad68c4 --- /dev/null +++ b/lib/square/types/card_automatically_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CardAutomaticallyUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CardAutomaticallyUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_automatically_updated_event_object.rb b/lib/square/types/card_automatically_updated_event_object.rb new file mode 100644 index 000000000..562a7299e --- /dev/null +++ b/lib/square/types/card_automatically_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CardAutomaticallyUpdatedEventObject < Internal::Types::Model + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_brand.rb b/lib/square/types/card_brand.rb new file mode 100644 index 000000000..cb1ba3a6f --- /dev/null +++ b/lib/square/types/card_brand.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + module CardBrand + extend Square::Internal::Types::Enum + OTHER_BRAND = "OTHER_BRAND" + VISA = "VISA" + MASTERCARD = "MASTERCARD" + AMERICAN_EXPRESS = "AMERICAN_EXPRESS" + DISCOVER = "DISCOVER" + DISCOVER_DINERS = "DISCOVER_DINERS" + JCB = "JCB" + CHINA_UNIONPAY = "CHINA_UNIONPAY" + SQUARE_GIFT_CARD = "SQUARE_GIFT_CARD" + SQUARE_CAPITAL_CARD = "SQUARE_CAPITAL_CARD" + INTERAC = "INTERAC" + EFTPOS = "EFTPOS" + FELICA = "FELICA" + EBT = "EBT"end + end +end diff --git a/lib/square/types/card_co_brand.rb b/lib/square/types/card_co_brand.rb new file mode 100644 index 000000000..0e0c963eb --- /dev/null +++ b/lib/square/types/card_co_brand.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CardCoBrand + extend Square::Internal::Types::Enum + UNKNOWN = "UNKNOWN" + AFTERPAY = "AFTERPAY" + CLEARPAY = "CLEARPAY"end + end +end diff --git a/lib/square/types/card_created_event.rb b/lib/square/types/card_created_event.rb new file mode 100644 index 000000000..7528bec37 --- /dev/null +++ b/lib/square/types/card_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [card](entity:Card) is created or imported. + class CardCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CardCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_created_event_data.rb b/lib/square/types/card_created_event_data.rb new file mode 100644 index 000000000..7c1a8365a --- /dev/null +++ b/lib/square/types/card_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CardCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CardCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_created_event_object.rb b/lib/square/types/card_created_event_object.rb new file mode 100644 index 000000000..8cd529bbf --- /dev/null +++ b/lib/square/types/card_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CardCreatedEventObject < Internal::Types::Model + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_disabled_event.rb b/lib/square/types/card_disabled_event.rb new file mode 100644 index 000000000..0af17b151 --- /dev/null +++ b/lib/square/types/card_disabled_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [card](entity:Card) is disabled. + class CardDisabledEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CardDisabledEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_disabled_event_data.rb b/lib/square/types/card_disabled_event_data.rb new file mode 100644 index 000000000..f217b97fe --- /dev/null +++ b/lib/square/types/card_disabled_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CardDisabledEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CardDisabledEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_disabled_event_object.rb b/lib/square/types/card_disabled_event_object.rb new file mode 100644 index 000000000..2fd683fac --- /dev/null +++ b/lib/square/types/card_disabled_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CardDisabledEventObject < Internal::Types::Model + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_forgotten_event.rb b/lib/square/types/card_forgotten_event.rb new file mode 100644 index 000000000..8a18ad3f6 --- /dev/null +++ b/lib/square/types/card_forgotten_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [card](entity:Card) is GDPR forgotten or vaulted. + class CardForgottenEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CardForgottenEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_forgotten_event_card.rb b/lib/square/types/card_forgotten_event_card.rb new file mode 100644 index 000000000..ea2fbaaac --- /dev/null +++ b/lib/square/types/card_forgotten_event_card.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + class CardForgottenEventCard < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_forgotten_event_data.rb b/lib/square/types/card_forgotten_event_data.rb new file mode 100644 index 000000000..2de90ef7f --- /dev/null +++ b/lib/square/types/card_forgotten_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CardForgottenEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CardForgottenEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_forgotten_event_object.rb b/lib/square/types/card_forgotten_event_object.rb new file mode 100644 index 000000000..177743bdb --- /dev/null +++ b/lib/square/types/card_forgotten_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CardForgottenEventObject < Internal::Types::Model + field :card, Square::Types::CardForgottenEventCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_payment_details.rb b/lib/square/types/card_payment_details.rb new file mode 100644 index 000000000..0640b693d --- /dev/null +++ b/lib/square/types/card_payment_details.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Reflects the current status of a card payment. Contains only non-confidential information. + class CardPaymentDetails < Internal::Types::Model + field :status, String, optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + field :entry_method, String, optional: true, nullable: false + field :cvv_status, String, optional: true, nullable: false + field :avs_status, String, optional: true, nullable: false + field :auth_result_code, String, optional: true, nullable: false + field :application_identifier, String, optional: true, nullable: false + field :application_name, String, optional: true, nullable: false + field :application_cryptogram, String, optional: true, nullable: false + field :verification_method, String, optional: true, nullable: false + field :verification_results, String, optional: true, nullable: false + field :statement_description, String, optional: true, nullable: false + field :device_details, Square::Types::DeviceDetails, optional: true, nullable: false + field :card_payment_timeline, Square::Types::CardPaymentTimeline, optional: true, nullable: false + field :refund_requires_card_presence, Internal::Types::Boolean, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_payment_timeline.rb b/lib/square/types/card_payment_timeline.rb new file mode 100644 index 000000000..4808d903d --- /dev/null +++ b/lib/square/types/card_payment_timeline.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The timeline for card payments. + class CardPaymentTimeline < Internal::Types::Model + field :authorized_at, String, optional: true, nullable: false + field :captured_at, String, optional: true, nullable: false + field :voided_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_prepaid_type.rb b/lib/square/types/card_prepaid_type.rb new file mode 100644 index 000000000..20d796e77 --- /dev/null +++ b/lib/square/types/card_prepaid_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CardPrepaidType + extend Square::Internal::Types::Enum + UNKNOWN_PREPAID_TYPE = "UNKNOWN_PREPAID_TYPE" + NOT_PREPAID = "NOT_PREPAID" + PREPAID = "PREPAID"end + end +end diff --git a/lib/square/types/card_type.rb b/lib/square/types/card_type.rb new file mode 100644 index 000000000..b94e3f083 --- /dev/null +++ b/lib/square/types/card_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CardType + extend Square::Internal::Types::Enum + UNKNOWN_CARD_TYPE = "UNKNOWN_CARD_TYPE" + CREDIT = "CREDIT" + DEBIT = "DEBIT"end + end +end diff --git a/lib/square/types/card_updated_event.rb b/lib/square/types/card_updated_event.rb new file mode 100644 index 000000000..8ab45a657 --- /dev/null +++ b/lib/square/types/card_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [card](entity:Card) is updated by the seller in the Square Dashboard. + class CardUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CardUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_updated_event_data.rb b/lib/square/types/card_updated_event_data.rb new file mode 100644 index 000000000..be4e94588 --- /dev/null +++ b/lib/square/types/card_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CardUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CardUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/card_updated_event_object.rb b/lib/square/types/card_updated_event_object.rb new file mode 100644 index 000000000..babedc034 --- /dev/null +++ b/lib/square/types/card_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CardUpdatedEventObject < Internal::Types::Model + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_app_details.rb b/lib/square/types/cash_app_details.rb new file mode 100644 index 000000000..2be7753f0 --- /dev/null +++ b/lib/square/types/cash_app_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about `WALLET` type payments with the `brand` of `CASH_APP`. + class CashAppDetails < Internal::Types::Model + field :buyer_full_name, String, optional: true, nullable: false + field :buyer_country_code, String, optional: true, nullable: false + field :buyer_cashtag, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_drawer_device.rb b/lib/square/types/cash_drawer_device.rb new file mode 100644 index 000000000..02910d42f --- /dev/null +++ b/lib/square/types/cash_drawer_device.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CashDrawerDevice < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_drawer_event_type.rb b/lib/square/types/cash_drawer_event_type.rb new file mode 100644 index 000000000..dfa63a40b --- /dev/null +++ b/lib/square/types/cash_drawer_event_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + module CashDrawerEventType + extend Square::Internal::Types::Enum + NO_SALE = "NO_SALE" + CASH_TENDER_PAYMENT = "CASH_TENDER_PAYMENT" + OTHER_TENDER_PAYMENT = "OTHER_TENDER_PAYMENT" + CASH_TENDER_CANCELLED_PAYMENT = "CASH_TENDER_CANCELLED_PAYMENT" + OTHER_TENDER_CANCELLED_PAYMENT = "OTHER_TENDER_CANCELLED_PAYMENT" + CASH_TENDER_REFUND = "CASH_TENDER_REFUND" + OTHER_TENDER_REFUND = "OTHER_TENDER_REFUND" + PAID_IN = "PAID_IN" + PAID_OUT = "PAID_OUT"end + end +end diff --git a/lib/square/types/cash_drawer_shift.rb b/lib/square/types/cash_drawer_shift.rb new file mode 100644 index 000000000..55b700adf --- /dev/null +++ b/lib/square/types/cash_drawer_shift.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Square + module Types + # This model gives the details of a cash drawer shift. + # The cash_payment_money, cash_refund_money, cash_paid_in_money, + # and cash_paid_out_money fields are all computed by summing their respective + # event types. + class CashDrawerShift < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :state, Square::Types::CashDrawerShiftState, optional: true, nullable: false + field :opened_at, String, optional: true, nullable: false + field :ended_at, String, optional: true, nullable: false + field :closed_at, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :opened_cash_money, Square::Types::Money, optional: true, nullable: false + field :cash_payment_money, Square::Types::Money, optional: true, nullable: false + field :cash_refunds_money, Square::Types::Money, optional: true, nullable: false + field :cash_paid_in_money, Square::Types::Money, optional: true, nullable: false + field :cash_paid_out_money, Square::Types::Money, optional: true, nullable: false + field :expected_cash_money, Square::Types::Money, optional: true, nullable: false + field :closed_cash_money, Square::Types::Money, optional: true, nullable: false + field :device, Square::Types::CashDrawerDevice, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :team_member_ids, Internal::Types::Array[String], optional: true, nullable: false + field :opening_team_member_id, String, optional: true, nullable: false + field :ending_team_member_id, String, optional: true, nullable: false + field :closing_team_member_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_drawer_shift_event.rb b/lib/square/types/cash_drawer_shift_event.rb new file mode 100644 index 000000000..2d0d55044 --- /dev/null +++ b/lib/square/types/cash_drawer_shift_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + class CashDrawerShiftEvent < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :event_type, Square::Types::CashDrawerEventType, optional: true, nullable: false + field :event_money, Square::Types::Money, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_drawer_shift_state.rb b/lib/square/types/cash_drawer_shift_state.rb new file mode 100644 index 000000000..d795c74ae --- /dev/null +++ b/lib/square/types/cash_drawer_shift_state.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CashDrawerShiftState + extend Square::Internal::Types::Enum + OPEN = "OPEN" + ENDED = "ENDED" + CLOSED = "CLOSED"end + end +end diff --git a/lib/square/types/cash_drawer_shift_summary.rb b/lib/square/types/cash_drawer_shift_summary.rb new file mode 100644 index 000000000..61f8c1763 --- /dev/null +++ b/lib/square/types/cash_drawer_shift_summary.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # The summary of a closed cash drawer shift. + # This model contains only the money counted to start a cash drawer shift, counted + # at the end of the shift, and the amount that should be in the drawer at shift + # end based on summing all cash drawer shift events. + class CashDrawerShiftSummary < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :state, Square::Types::CashDrawerShiftState, optional: true, nullable: false + field :opened_at, String, optional: true, nullable: false + field :ended_at, String, optional: true, nullable: false + field :closed_at, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :opened_cash_money, Square::Types::Money, optional: true, nullable: false + field :expected_cash_money, Square::Types::Money, optional: true, nullable: false + field :closed_cash_money, Square::Types::Money, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/cash_payment_details.rb b/lib/square/types/cash_payment_details.rb new file mode 100644 index 000000000..368181a92 --- /dev/null +++ b/lib/square/types/cash_payment_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Stores details about a cash payment. Contains only non-confidential information. For more information, see + # [Take Cash Payments](https://developer.squareup.com/docs/payments-api/take-payments/cash-payments). + class CashPaymentDetails < Internal::Types::Model + field :buyer_supplied_money, Square::Types::Money, optional: false, nullable: false + field :change_back_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_availability_period.rb b/lib/square/types/catalog_availability_period.rb new file mode 100644 index 000000000..250d2c0da --- /dev/null +++ b/lib/square/types/catalog_availability_period.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a time period of availability. + class CatalogAvailabilityPeriod < Internal::Types::Model + field :start_local_time, String, optional: true, nullable: false + field :end_local_time, String, optional: true, nullable: false + field :day_of_week, Square::Types::DayOfWeek, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_category.rb b/lib/square/types/catalog_category.rb new file mode 100644 index 000000000..f2ec58cad --- /dev/null +++ b/lib/square/types/catalog_category.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # A category to which a `CatalogItem` instance belongs. + class CatalogCategory < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :image_ids, Internal::Types::Array[String], optional: true, nullable: false + field :category_type, Square::Types::CatalogCategoryType, optional: true, nullable: false + field :parent_category, Square::Types::CatalogObjectCategory, optional: true, nullable: false + field :is_top_level, Internal::Types::Boolean, optional: true, nullable: false + field :channels, Internal::Types::Array[String], optional: true, nullable: false + field :availability_period_ids, Internal::Types::Array[String], optional: true, nullable: false + field :online_visibility, Internal::Types::Boolean, optional: true, nullable: false + field :root_category, String, optional: true, nullable: false + field :ecom_seo_data, Square::Types::CatalogEcomSeoData, optional: true, nullable: false + field :path_to_root, Internal::Types::Array[Square::Types::CategoryPathToRootNode], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_category_type.rb b/lib/square/types/catalog_category_type.rb new file mode 100644 index 000000000..5655e6b95 --- /dev/null +++ b/lib/square/types/catalog_category_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogCategoryType + extend Square::Internal::Types::Enum + REGULAR_CATEGORY = "REGULAR_CATEGORY" + MENU_CATEGORY = "MENU_CATEGORY" + KITCHEN_CATEGORY = "KITCHEN_CATEGORY"end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition.rb b/lib/square/types/catalog_custom_attribute_definition.rb new file mode 100644 index 000000000..b1064e647 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains information defining a custom attribute. Custom attributes are + # intended to store additional information about a catalog object or to associate a + # catalog object with an entity in another system. Do not use custom attributes + # to store any sensitive information (personally identifiable information, card details, etc.). + # [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes) + class CatalogCustomAttributeDefinition < Internal::Types::Model + field :type, Square::Types::CatalogCustomAttributeDefinitionType, optional: false, nullable: false + field :name, String, optional: false, nullable: false + field :description, String, optional: true, nullable: false + field :source_application, Square::Types::SourceApplication, optional: true, nullable: false + field :allowed_object_types, Internal::Types::Array[Square::Types::CatalogObjectType], optional: false, nullable: false + field :seller_visibility, Square::Types::CatalogCustomAttributeDefinitionSellerVisibility, optional: true, nullable: false + field :app_visibility, Square::Types::CatalogCustomAttributeDefinitionAppVisibility, optional: true, nullable: false + field :string_config, Square::Types::CatalogCustomAttributeDefinitionStringConfig, optional: true, nullable: false + field :number_config, Square::Types::CatalogCustomAttributeDefinitionNumberConfig, optional: true, nullable: false + field :selection_config, Square::Types::CatalogCustomAttributeDefinitionSelectionConfig, optional: true, nullable: false + field :custom_attribute_usage_count, Integer, optional: true, nullable: false + field :key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_app_visibility.rb b/lib/square/types/catalog_custom_attribute_definition_app_visibility.rb new file mode 100644 index 000000000..3643b5710 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_app_visibility.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogCustomAttributeDefinitionAppVisibility + extend Square::Internal::Types::Enum + APP_VISIBILITY_HIDDEN = "APP_VISIBILITY_HIDDEN" + APP_VISIBILITY_READ_ONLY = "APP_VISIBILITY_READ_ONLY" + APP_VISIBILITY_READ_WRITE_VALUES = "APP_VISIBILITY_READ_WRITE_VALUES"end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_number_config.rb b/lib/square/types/catalog_custom_attribute_definition_number_config.rb new file mode 100644 index 000000000..917cb4bc2 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_number_config.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogCustomAttributeDefinitionNumberConfig < Internal::Types::Model + field :precision, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_selection_config.rb b/lib/square/types/catalog_custom_attribute_definition_selection_config.rb new file mode 100644 index 000000000..cd7693edd --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_selection_config.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Configuration associated with `SELECTION`-type custom attribute definitions. + class CatalogCustomAttributeDefinitionSelectionConfig < Internal::Types::Model + field :max_allowed_selections, Integer, optional: true, nullable: false + field :allowed_selections, Internal::Types::Array[Square::Types::CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.rb b/lib/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.rb new file mode 100644 index 000000000..986cde7f0 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_selection_config_custom_attribute_selection.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A named selection for this `SELECTION`-type custom attribute definition. + class CatalogCustomAttributeDefinitionSelectionConfigCustomAttributeSelection < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :name, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_seller_visibility.rb b/lib/square/types/catalog_custom_attribute_definition_seller_visibility.rb new file mode 100644 index 000000000..5d2bbba28 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_seller_visibility.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogCustomAttributeDefinitionSellerVisibility + extend Square::Internal::Types::Enum + SELLER_VISIBILITY_HIDDEN = "SELLER_VISIBILITY_HIDDEN" + SELLER_VISIBILITY_READ_WRITE_VALUES = "SELLER_VISIBILITY_READ_WRITE_VALUES"end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_string_config.rb b/lib/square/types/catalog_custom_attribute_definition_string_config.rb new file mode 100644 index 000000000..141e15c41 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_string_config.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Configuration associated with Custom Attribute Definitions of type `STRING`. + class CatalogCustomAttributeDefinitionStringConfig < Internal::Types::Model + field :enforce_uniqueness, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_custom_attribute_definition_type.rb b/lib/square/types/catalog_custom_attribute_definition_type.rb new file mode 100644 index 000000000..e98edb552 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_definition_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogCustomAttributeDefinitionType + extend Square::Internal::Types::Enum + STRING = "STRING" + BOOLEAN = "BOOLEAN" + NUMBER = "NUMBER" + SELECTION = "SELECTION"end + end +end diff --git a/lib/square/types/catalog_custom_attribute_value.rb b/lib/square/types/catalog_custom_attribute_value.rb new file mode 100644 index 000000000..f7d68b574 --- /dev/null +++ b/lib/square/types/catalog_custom_attribute_value.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # An instance of a custom attribute. Custom attributes can be defined and + # added to `ITEM` and `ITEM_VARIATION` type catalog objects. + # [Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes). + class CatalogCustomAttributeValue < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :string_value, String, optional: true, nullable: false + field :custom_attribute_definition_id, String, optional: true, nullable: false + field :type, Square::Types::CatalogCustomAttributeDefinitionType, optional: true, nullable: false + field :number_value, String, optional: true, nullable: false + field :boolean_value, Internal::Types::Boolean, optional: true, nullable: false + field :selection_uid_values, Internal::Types::Array[String], optional: true, nullable: false + field :key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_discount.rb b/lib/square/types/catalog_discount.rb new file mode 100644 index 000000000..a03a96fc6 --- /dev/null +++ b/lib/square/types/catalog_discount.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A discount applicable to items. + class CatalogDiscount < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :discount_type, Square::Types::CatalogDiscountType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :pin_required, Internal::Types::Boolean, optional: true, nullable: false + field :label_color, String, optional: true, nullable: false + field :modify_tax_basis, Square::Types::CatalogDiscountModifyTaxBasis, optional: true, nullable: false + field :maximum_amount_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_discount_modify_tax_basis.rb b/lib/square/types/catalog_discount_modify_tax_basis.rb new file mode 100644 index 000000000..098449087 --- /dev/null +++ b/lib/square/types/catalog_discount_modify_tax_basis.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogDiscountModifyTaxBasis + extend Square::Internal::Types::Enum + MODIFY_TAX_BASIS = "MODIFY_TAX_BASIS" + DO_NOT_MODIFY_TAX_BASIS = "DO_NOT_MODIFY_TAX_BASIS"end + end +end diff --git a/lib/square/types/catalog_discount_type.rb b/lib/square/types/catalog_discount_type.rb new file mode 100644 index 000000000..e2fcd8370 --- /dev/null +++ b/lib/square/types/catalog_discount_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogDiscountType + extend Square::Internal::Types::Enum + FIXED_PERCENTAGE = "FIXED_PERCENTAGE" + FIXED_AMOUNT = "FIXED_AMOUNT" + VARIABLE_PERCENTAGE = "VARIABLE_PERCENTAGE" + VARIABLE_AMOUNT = "VARIABLE_AMOUNT"end + end +end diff --git a/lib/square/types/catalog_ecom_seo_data.rb b/lib/square/types/catalog_ecom_seo_data.rb new file mode 100644 index 000000000..f0d88bf3a --- /dev/null +++ b/lib/square/types/catalog_ecom_seo_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # SEO data for for a seller's Square Online store. + class CatalogEcomSeoData < Internal::Types::Model + field :page_title, String, optional: true, nullable: false + field :page_description, String, optional: true, nullable: false + field :permalink, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_id_mapping.rb b/lib/square/types/catalog_id_mapping.rb new file mode 100644 index 000000000..18e5b1db6 --- /dev/null +++ b/lib/square/types/catalog_id_mapping.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + # A mapping between a temporary client-supplied ID and a permanent server-generated ID. + # + # When calling [UpsertCatalogObject](api-endpoint:Catalog-UpsertCatalogObject) or + # [BatchUpsertCatalogObjects](api-endpoint:Catalog-BatchUpsertCatalogObjects) to + # create a [CatalogObject](entity:CatalogObject) instance, you can supply + # a temporary ID for the to-be-created object, especially when the object is to be referenced + # elsewhere in the same request body. This temporary ID can be any string unique within + # the call, but must be prefixed by "#". + # + # After the request is submitted and the object created, a permanent server-generated ID is assigned + # to the new object. The permanent ID is unique across the Square catalog. + class CatalogIdMapping < Internal::Types::Model + field :client_object_id, String, optional: true, nullable: false + field :object_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_image.rb b/lib/square/types/catalog_image.rb new file mode 100644 index 000000000..de06854af --- /dev/null +++ b/lib/square/types/catalog_image.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # An image file to use in Square catalogs. It can be associated with + # `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects. + # Only the images on items and item variations are exposed in Dashboard. + # Only the first image on an item is displayed in Square Point of Sale (SPOS). + # Images on items and variations are displayed through Square Online Store. + # Images on other object types are for use by 3rd party application developers. + class CatalogImage < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :url, String, optional: true, nullable: false + field :caption, String, optional: true, nullable: false + field :photo_studio_order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_info_response.rb b/lib/square/types/catalog_info_response.rb new file mode 100644 index 000000000..a9bbc399f --- /dev/null +++ b/lib/square/types/catalog_info_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogInfoResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :limits, Square::Types::CatalogInfoResponseLimits, optional: true, nullable: false + field :standard_unit_description_group, Square::Types::StandardUnitDescriptionGroup, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_info_response_limits.rb b/lib/square/types/catalog_info_response_limits.rb new file mode 100644 index 000000000..a0e70a6b8 --- /dev/null +++ b/lib/square/types/catalog_info_response_limits.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogInfoResponseLimits < Internal::Types::Model + field :batch_upsert_max_objects_per_batch, Integer, optional: true, nullable: false + field :batch_upsert_max_total_objects, Integer, optional: true, nullable: false + field :batch_retrieve_max_object_ids, Integer, optional: true, nullable: false + field :search_max_page_limit, Integer, optional: true, nullable: false + field :batch_delete_max_object_ids, Integer, optional: true, nullable: false + field :update_item_taxes_max_item_ids, Integer, optional: true, nullable: false + field :update_item_taxes_max_taxes_to_enable, Integer, optional: true, nullable: false + field :update_item_taxes_max_taxes_to_disable, Integer, optional: true, nullable: false + field :update_item_modifier_lists_max_item_ids, Integer, optional: true, nullable: false + field :update_item_modifier_lists_max_modifier_lists_to_enable, Integer, optional: true, nullable: false + field :update_item_modifier_lists_max_modifier_lists_to_disable, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item.rb b/lib/square/types/catalog_item.rb new file mode 100644 index 000000000..b87e74c29 --- /dev/null +++ b/lib/square/types/catalog_item.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Square + module Types + # A [CatalogObject](entity:CatalogObject) instance of the `ITEM` type, also referred to as an item, in the catalog. + class CatalogItem < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :abbreviation, String, optional: true, nullable: false + field :label_color, String, optional: true, nullable: false + field :is_taxable, Internal::Types::Boolean, optional: true, nullable: false + field :category_id, String, optional: true, nullable: false + field :tax_ids, Internal::Types::Array[String], optional: true, nullable: false + field :modifier_list_info, Internal::Types::Array[Square::Types::CatalogItemModifierListInfo], optional: true, nullable: false + field :variations, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :product_type, Square::Types::CatalogItemProductType, optional: true, nullable: false + field :skip_modifier_screen, Internal::Types::Boolean, optional: true, nullable: false + field :item_options, Internal::Types::Array[Square::Types::CatalogItemOptionForItem], optional: true, nullable: false + field :ecom_uri, String, optional: true, nullable: false + field :ecom_image_uris, Internal::Types::Array[String], optional: true, nullable: false + field :image_ids, Internal::Types::Array[String], optional: true, nullable: false + field :sort_name, String, optional: true, nullable: false + field :categories, Internal::Types::Array[Square::Types::CatalogObjectCategory], optional: true, nullable: false + field :description_html, String, optional: true, nullable: false + field :description_plaintext, String, optional: true, nullable: false + field :channels, Internal::Types::Array[String], optional: true, nullable: false + field :is_archived, Internal::Types::Boolean, optional: true, nullable: false + field :ecom_seo_data, Square::Types::CatalogEcomSeoData, optional: true, nullable: false + field :food_and_beverage_details, Square::Types::CatalogItemFoodAndBeverageDetails, optional: true, nullable: false + field :reporting_category, Square::Types::CatalogObjectCategory, optional: true, nullable: false + field :is_alcoholic, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details.rb b/lib/square/types/catalog_item_food_and_beverage_details.rb new file mode 100644 index 000000000..05b3389df --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The food and beverage-specific details of a `FOOD_AND_BEV` item. + class CatalogItemFoodAndBeverageDetails < Internal::Types::Model + field :calorie_count, Integer, optional: true, nullable: false + field :dietary_preferences, Internal::Types::Array[Square::Types::CatalogItemFoodAndBeverageDetailsDietaryPreference], optional: true, nullable: false + field :ingredients, Internal::Types::Array[Square::Types::CatalogItemFoodAndBeverageDetailsIngredient], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference.rb b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference.rb new file mode 100644 index 000000000..c7f4b9b1e --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Dietary preferences that can be assigned to an `FOOD_AND_BEV` item and its ingredients. + class CatalogItemFoodAndBeverageDetailsDietaryPreference < Internal::Types::Model + field :type, Square::Types::CatalogItemFoodAndBeverageDetailsDietaryPreferenceType, optional: true, nullable: false + field :standard_name, Square::Types::CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference, optional: true, nullable: false + field :custom_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.rb b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.rb new file mode 100644 index 000000000..57081d9da --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_standard_dietary_preference.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogItemFoodAndBeverageDetailsDietaryPreferenceStandardDietaryPreference + extend Square::Internal::Types::Enum + DAIRY_FREE = "DAIRY_FREE" + GLUTEN_FREE = "GLUTEN_FREE" + HALAL = "HALAL" + KOSHER = "KOSHER" + NUT_FREE = "NUT_FREE" + VEGAN = "VEGAN" + VEGETARIAN = "VEGETARIAN"end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.rb b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.rb new file mode 100644 index 000000000..28d2b4bd2 --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details_dietary_preference_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogItemFoodAndBeverageDetailsDietaryPreferenceType + extend Square::Internal::Types::Enum + STANDARD = "STANDARD" + CUSTOM = "CUSTOM"end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details_ingredient.rb b/lib/square/types/catalog_item_food_and_beverage_details_ingredient.rb new file mode 100644 index 000000000..40f1a980e --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details_ingredient.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes the ingredient used in a `FOOD_AND_BEV` item. + class CatalogItemFoodAndBeverageDetailsIngredient < Internal::Types::Model + field :type, Square::Types::CatalogItemFoodAndBeverageDetailsDietaryPreferenceType, optional: true, nullable: false + field :standard_name, Square::Types::CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient, optional: true, nullable: false + field :custom_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.rb b/lib/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.rb new file mode 100644 index 000000000..3f7bde489 --- /dev/null +++ b/lib/square/types/catalog_item_food_and_beverage_details_ingredient_standard_ingredient.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogItemFoodAndBeverageDetailsIngredientStandardIngredient + extend Square::Internal::Types::Enum + CELERY = "CELERY" + CRUSTACEANS = "CRUSTACEANS" + EGGS = "EGGS" + FISH = "FISH" + GLUTEN = "GLUTEN" + LUPIN = "LUPIN" + MILK = "MILK" + MOLLUSCS = "MOLLUSCS" + MUSTARD = "MUSTARD" + PEANUTS = "PEANUTS" + SESAME = "SESAME" + SOY = "SOY" + SULPHITES = "SULPHITES" + TREE_NUTS = "TREE_NUTS"end + end +end diff --git a/lib/square/types/catalog_item_modifier_list_info.rb b/lib/square/types/catalog_item_modifier_list_info.rb new file mode 100644 index 000000000..6c5c59348 --- /dev/null +++ b/lib/square/types/catalog_item_modifier_list_info.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Controls how a modifier list is applied to a specific item. This object allows for item-specific customization of modifier list behavior + # and provides the ability to override global modifier list settings. + class CatalogItemModifierListInfo < Internal::Types::Model + field :modifier_list_id, String, optional: false, nullable: false + field :modifier_overrides, Internal::Types::Array[Square::Types::CatalogModifierOverride], optional: true, nullable: false + field :min_selected_modifiers, Integer, optional: true, nullable: false + field :max_selected_modifiers, Integer, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :allow_quantities, Internal::Types::Hash[String, ], optional: true, nullable: false + field :is_conversational, Internal::Types::Hash[String, ], optional: true, nullable: false + field :hidden_from_customer_override, Internal::Types::Hash[String, ], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_option.rb b/lib/square/types/catalog_item_option.rb new file mode 100644 index 000000000..9cee1530a --- /dev/null +++ b/lib/square/types/catalog_item_option.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # A group of variations for a `CatalogItem`. + class CatalogItemOption < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :display_name, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :show_colors, Internal::Types::Boolean, optional: true, nullable: false + field :values, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_option_for_item.rb b/lib/square/types/catalog_item_option_for_item.rb new file mode 100644 index 000000000..6889edd59 --- /dev/null +++ b/lib/square/types/catalog_item_option_for_item.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An option that can be assigned to an item. + # For example, a t-shirt item may offer a color option or a size option. + class CatalogItemOptionForItem < Internal::Types::Model + field :item_option_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_option_value.rb b/lib/square/types/catalog_item_option_value.rb new file mode 100644 index 000000000..709d6d294 --- /dev/null +++ b/lib/square/types/catalog_item_option_value.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # An enumerated value that can link a + # `CatalogItemVariation` to an item option as one of + # its item option values. + class CatalogItemOptionValue < Internal::Types::Model + field :item_option_id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :color, String, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_option_value_for_item_variation.rb b/lib/square/types/catalog_item_option_value_for_item_variation.rb new file mode 100644 index 000000000..e4b4133d4 --- /dev/null +++ b/lib/square/types/catalog_item_option_value_for_item_variation.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # A `CatalogItemOptionValue` links an item variation to an item option as + # an item option value. For example, a t-shirt item may offer a color option and + # a size option. An item option value would represent each variation of t-shirt: + # For example, "Color:Red, Size:Small" or "Color:Blue, Size:Medium". + class CatalogItemOptionValueForItemVariation < Internal::Types::Model + field :item_option_id, String, optional: true, nullable: false + field :item_option_value_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_item_product_type.rb b/lib/square/types/catalog_item_product_type.rb new file mode 100644 index 000000000..1f1816cd9 --- /dev/null +++ b/lib/square/types/catalog_item_product_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogItemProductType + extend Square::Internal::Types::Enum + REGULAR = "REGULAR" + GIFT_CARD = "GIFT_CARD" + APPOINTMENTS_SERVICE = "APPOINTMENTS_SERVICE" + FOOD_AND_BEV = "FOOD_AND_BEV" + EVENT = "EVENT" + DIGITAL = "DIGITAL" + DONATION = "DONATION" + LEGACY_SQUARE_ONLINE_SERVICE = "LEGACY_SQUARE_ONLINE_SERVICE" + LEGACY_SQUARE_ONLINE_MEMBERSHIP = "LEGACY_SQUARE_ONLINE_MEMBERSHIP"end + end +end diff --git a/lib/square/types/catalog_item_variation.rb b/lib/square/types/catalog_item_variation.rb new file mode 100644 index 000000000..638d2e796 --- /dev/null +++ b/lib/square/types/catalog_item_variation.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Square + module Types + # An item variation, representing a product for sale, in the Catalog object model. Each [item](entity:CatalogItem) must have at least one + # item variation and can have at most 250 item variations. + # + # An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked + # number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both + # stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass + # variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be + # converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes + # the `stockable_conversion` property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count + # decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion. + class CatalogItemVariation < Internal::Types::Model + field :item_id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :sku, String, optional: true, nullable: false + field :upc, String, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :pricing_type, Square::Types::CatalogPricingType, optional: true, nullable: false + field :price_money, Square::Types::Money, optional: true, nullable: false + field :location_overrides, Internal::Types::Array[Square::Types::ItemVariationLocationOverrides], optional: true, nullable: false + field :track_inventory, Internal::Types::Boolean, optional: true, nullable: false + field :inventory_alert_type, Square::Types::InventoryAlertType, optional: true, nullable: false + field :inventory_alert_threshold, Integer, optional: true, nullable: false + field :user_data, String, optional: true, nullable: false + field :service_duration, Integer, optional: true, nullable: false + field :available_for_booking, Internal::Types::Boolean, optional: true, nullable: false + field :item_option_values, Internal::Types::Array[Square::Types::CatalogItemOptionValueForItemVariation], optional: true, nullable: false + field :measurement_unit_id, String, optional: true, nullable: false + field :sellable, Internal::Types::Boolean, optional: true, nullable: false + field :stockable, Internal::Types::Boolean, optional: true, nullable: false + field :image_ids, Internal::Types::Array[String], optional: true, nullable: false + field :team_member_ids, Internal::Types::Array[String], optional: true, nullable: false + field :stockable_conversion, Square::Types::CatalogStockConversion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_measurement_unit.rb b/lib/square/types/catalog_measurement_unit.rb new file mode 100644 index 000000000..c1f5da3b4 --- /dev/null +++ b/lib/square/types/catalog_measurement_unit.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the unit used to measure a `CatalogItemVariation` and + # specifies the precision for decimal quantities. + class CatalogMeasurementUnit < Internal::Types::Model + field :measurement_unit, Square::Types::MeasurementUnit, optional: true, nullable: false + field :precision, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_modifier.rb b/lib/square/types/catalog_modifier.rb new file mode 100644 index 000000000..8b1b2ae6b --- /dev/null +++ b/lib/square/types/catalog_modifier.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A modifier that can be applied to items at the time of sale. For example, a cheese modifier for a burger, or a flavor modifier for a serving of ice cream. + class CatalogModifier < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :price_money, Square::Types::Money, optional: true, nullable: false + field :on_by_default, Internal::Types::Boolean, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :modifier_list_id, String, optional: true, nullable: false + field :location_overrides, Internal::Types::Array[Square::Types::ModifierLocationOverrides], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + field :hidden_online, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_modifier_list.rb b/lib/square/types/catalog_modifier_list.rb new file mode 100644 index 000000000..56c0c9daf --- /dev/null +++ b/lib/square/types/catalog_modifier_list.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Square + module Types + # A container for a list of modifiers, or a text-based modifier. + # For text-based modifiers, this represents text configuration for an item. (For example, custom text to print on a t-shirt). + # For non text-based modifiers, this represents a list of modifiers that can be applied to items at the time of sale. + # (For example, a list of condiments for a hot dog, or a list of ice cream flavors). + # Each element of the modifier list is a `CatalogObject` instance of the `MODIFIER` type. + class CatalogModifierList < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :selection_type, Square::Types::CatalogModifierListSelectionType, optional: true, nullable: false + field :modifiers, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :image_ids, Internal::Types::Array[String], optional: true, nullable: false + field :allow_quantities, Internal::Types::Boolean, optional: true, nullable: false + field :is_conversational, Internal::Types::Boolean, optional: true, nullable: false + field :modifier_type, Square::Types::CatalogModifierListModifierType, optional: true, nullable: false + field :max_length, Integer, optional: true, nullable: false + field :text_required, Internal::Types::Boolean, optional: true, nullable: false + field :internal_name, String, optional: true, nullable: false + field :min_selected_modifiers, Integer, optional: true, nullable: false + field :max_selected_modifiers, Integer, optional: true, nullable: false + field :hidden_from_customer, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_modifier_list_modifier_type.rb b/lib/square/types/catalog_modifier_list_modifier_type.rb new file mode 100644 index 000000000..d6a6d3547 --- /dev/null +++ b/lib/square/types/catalog_modifier_list_modifier_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogModifierListModifierType + extend Square::Internal::Types::Enum + LIST = "LIST" + TEXT = "TEXT"end + end +end diff --git a/lib/square/types/catalog_modifier_list_selection_type.rb b/lib/square/types/catalog_modifier_list_selection_type.rb new file mode 100644 index 000000000..74e33353c --- /dev/null +++ b/lib/square/types/catalog_modifier_list_selection_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogModifierListSelectionType + extend Square::Internal::Types::Enum + SINGLE = "SINGLE" + MULTIPLE = "MULTIPLE"end + end +end diff --git a/lib/square/types/catalog_modifier_override.rb b/lib/square/types/catalog_modifier_override.rb new file mode 100644 index 000000000..6c951b1e9 --- /dev/null +++ b/lib/square/types/catalog_modifier_override.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Options to control how to override the default behavior of the specified modifier. + class CatalogModifierOverride < Internal::Types::Model + field :modifier_id, String, optional: false, nullable: false + field :on_by_default, Internal::Types::Boolean, optional: true, nullable: false + field :hidden_online_override, Internal::Types::Hash[String, ], optional: true, nullable: false + field :on_by_default_override, Internal::Types::Hash[String, ], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_availability_period.rb b/lib/square/types/catalog_object_availability_period.rb new file mode 100644 index 000000000..98a27c32a --- /dev/null +++ b/lib/square/types/catalog_object_availability_period.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectAvailabilityPeriod < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :availability_period_data, Square::Types::CatalogAvailabilityPeriod, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_base.rb b/lib/square/types/catalog_object_base.rb new file mode 100644 index 000000000..75bf25d17 --- /dev/null +++ b/lib/square/types/catalog_object_base.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectBase < Internal::Types::Model + field :type, Square::Types::CatalogObjectType, optional: false, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_batch.rb b/lib/square/types/catalog_object_batch.rb new file mode 100644 index 000000000..838eb3287 --- /dev/null +++ b/lib/square/types/catalog_object_batch.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # A batch of catalog objects. + class CatalogObjectBatch < Internal::Types::Model + field :objects, Internal::Types::Array[Square::Types::CatalogObject], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_category.rb b/lib/square/types/catalog_object_category.rb new file mode 100644 index 000000000..11326a5cc --- /dev/null +++ b/lib/square/types/catalog_object_category.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # A category that can be assigned to an item or a parent category that can be assigned + # to another category. For example, a clothing category can be assigned to a t-shirt item or + # be made as the parent category to the pants category. + class CatalogObjectCategory < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :type, String, optional: false, nullable: false + field :category_data, Square::Types::CatalogCategory, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_custom_attribute_definition.rb b/lib/square/types/catalog_object_custom_attribute_definition.rb new file mode 100644 index 000000000..9624cb67c --- /dev/null +++ b/lib/square/types/catalog_object_custom_attribute_definition.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectCustomAttributeDefinition < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :custom_attribute_definition_data, Square::Types::CatalogCustomAttributeDefinition, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_discount.rb b/lib/square/types/catalog_object_discount.rb new file mode 100644 index 000000000..06451f8d0 --- /dev/null +++ b/lib/square/types/catalog_object_discount.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectDiscount < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :discount_data, Square::Types::CatalogDiscount, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_image.rb b/lib/square/types/catalog_object_image.rb new file mode 100644 index 000000000..9bfcaa08b --- /dev/null +++ b/lib/square/types/catalog_object_image.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectImage < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :image_data, Square::Types::CatalogImage, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_item.rb b/lib/square/types/catalog_object_item.rb new file mode 100644 index 000000000..74746be61 --- /dev/null +++ b/lib/square/types/catalog_object_item.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectItem < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :item_data, Square::Types::CatalogItem, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_item_option.rb b/lib/square/types/catalog_object_item_option.rb new file mode 100644 index 000000000..271df701b --- /dev/null +++ b/lib/square/types/catalog_object_item_option.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectItemOption < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :item_option_data, Square::Types::CatalogItemOption, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_item_option_value.rb b/lib/square/types/catalog_object_item_option_value.rb new file mode 100644 index 000000000..7c7862f35 --- /dev/null +++ b/lib/square/types/catalog_object_item_option_value.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectItemOptionValue < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :item_option_value_data, Square::Types::CatalogItemOptionValue, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_item_variation.rb b/lib/square/types/catalog_object_item_variation.rb new file mode 100644 index 000000000..f0cb4ee6e --- /dev/null +++ b/lib/square/types/catalog_object_item_variation.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectItemVariation < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :item_variation_data, Square::Types::CatalogItemVariation, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_measurement_unit.rb b/lib/square/types/catalog_object_measurement_unit.rb new file mode 100644 index 000000000..7d096808a --- /dev/null +++ b/lib/square/types/catalog_object_measurement_unit.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectMeasurementUnit < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :measurement_unit_data, Square::Types::CatalogMeasurementUnit, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_modifier.rb b/lib/square/types/catalog_object_modifier.rb new file mode 100644 index 000000000..2299cb3dd --- /dev/null +++ b/lib/square/types/catalog_object_modifier.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectModifier < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :modifier_data, Square::Types::CatalogModifier, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_modifier_list.rb b/lib/square/types/catalog_object_modifier_list.rb new file mode 100644 index 000000000..9da9c04d8 --- /dev/null +++ b/lib/square/types/catalog_object_modifier_list.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectModifierList < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :modifier_list_data, Square::Types::CatalogModifierList, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_pricing_rule.rb b/lib/square/types/catalog_object_pricing_rule.rb new file mode 100644 index 000000000..6a8c22b0b --- /dev/null +++ b/lib/square/types/catalog_object_pricing_rule.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectPricingRule < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :pricing_rule_data, Square::Types::CatalogPricingRule, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_product_set.rb b/lib/square/types/catalog_object_product_set.rb new file mode 100644 index 000000000..9068ba1aa --- /dev/null +++ b/lib/square/types/catalog_object_product_set.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectProductSet < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :product_set_data, Square::Types::CatalogProductSet, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_quick_amounts_settings.rb b/lib/square/types/catalog_object_quick_amounts_settings.rb new file mode 100644 index 000000000..30da8088c --- /dev/null +++ b/lib/square/types/catalog_object_quick_amounts_settings.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectQuickAmountsSettings < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :quick_amounts_settings_data, Square::Types::CatalogQuickAmountsSettings, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_reference.rb b/lib/square/types/catalog_object_reference.rb new file mode 100644 index 000000000..b7bb54a95 --- /dev/null +++ b/lib/square/types/catalog_object_reference.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A reference to a Catalog object at a specific version. In general this is + # used as an entry point into a graph of catalog objects, where the objects exist + # at a specific version. + class CatalogObjectReference < Internal::Types::Model + field :object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_subscription_plan.rb b/lib/square/types/catalog_object_subscription_plan.rb new file mode 100644 index 000000000..ade12b8f3 --- /dev/null +++ b/lib/square/types/catalog_object_subscription_plan.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectSubscriptionPlan < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :subscription_plan_data, Square::Types::CatalogSubscriptionPlan, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_subscription_plan_variation.rb b/lib/square/types/catalog_object_subscription_plan_variation.rb new file mode 100644 index 000000000..9677410cc --- /dev/null +++ b/lib/square/types/catalog_object_subscription_plan_variation.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectSubscriptionPlanVariation < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :subscription_plan_variation_data, Square::Types::CatalogSubscriptionPlanVariation, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_tax.rb b/lib/square/types/catalog_object_tax.rb new file mode 100644 index 000000000..aa9ea0289 --- /dev/null +++ b/lib/square/types/catalog_object_tax.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectTax < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :tax_data, Square::Types::CatalogTax, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_time_period.rb b/lib/square/types/catalog_object_time_period.rb new file mode 100644 index 000000000..d99e66ac4 --- /dev/null +++ b/lib/square/types/catalog_object_time_period.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogObjectTimePeriod < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :time_period_data, Square::Types::CatalogTimePeriod, optional: true, nullable: false + field :id, String, optional: false, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :custom_attribute_values, Internal::Types::Hash[String, Square::Types::CatalogCustomAttributeValue], optional: true, nullable: false + field :catalog_v_1_ids, Internal::Types::Array[Square::Types::CatalogV1Id], optional: true, nullable: false + field :present_at_all_locations, Internal::Types::Boolean, optional: true, nullable: false + field :present_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :absent_at_location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :image_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_object_type.rb b/lib/square/types/catalog_object_type.rb new file mode 100644 index 000000000..e55c48547 --- /dev/null +++ b/lib/square/types/catalog_object_type.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogObjectType + extend Square::Internal::Types::Enum + ITEM = "ITEM" + IMAGE = "IMAGE" + CATEGORY = "CATEGORY" + ITEM_VARIATION = "ITEM_VARIATION" + TAX = "TAX" + DISCOUNT = "DISCOUNT" + MODIFIER_LIST = "MODIFIER_LIST" + MODIFIER = "MODIFIER" + PRICING_RULE = "PRICING_RULE" + PRODUCT_SET = "PRODUCT_SET" + TIME_PERIOD = "TIME_PERIOD" + MEASUREMENT_UNIT = "MEASUREMENT_UNIT" + SUBSCRIPTION_PLAN_VARIATION = "SUBSCRIPTION_PLAN_VARIATION" + ITEM_OPTION = "ITEM_OPTION" + ITEM_OPTION_VAL = "ITEM_OPTION_VAL" + CUSTOM_ATTRIBUTE_DEFINITION = "CUSTOM_ATTRIBUTE_DEFINITION" + QUICK_AMOUNTS_SETTINGS = "QUICK_AMOUNTS_SETTINGS" + SUBSCRIPTION_PLAN = "SUBSCRIPTION_PLAN" + AVAILABILITY_PERIOD = "AVAILABILITY_PERIOD"end + end +end diff --git a/lib/square/types/catalog_pricing_rule.rb b/lib/square/types/catalog_pricing_rule.rb new file mode 100644 index 000000000..607e52a1b --- /dev/null +++ b/lib/square/types/catalog_pricing_rule.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines how discounts are automatically applied to a set of items that match the pricing rule + # during the active time period. + class CatalogPricingRule < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :time_period_ids, Internal::Types::Array[String], optional: true, nullable: false + field :discount_id, String, optional: true, nullable: false + field :match_products_id, String, optional: true, nullable: false + field :apply_products_id, String, optional: true, nullable: false + field :exclude_products_id, String, optional: true, nullable: false + field :valid_from_date, String, optional: true, nullable: false + field :valid_from_local_time, String, optional: true, nullable: false + field :valid_until_date, String, optional: true, nullable: false + field :valid_until_local_time, String, optional: true, nullable: false + field :exclude_strategy, Square::Types::ExcludeStrategy, optional: true, nullable: false + field :minimum_order_subtotal_money, Square::Types::Money, optional: true, nullable: false + field :customer_group_ids_any, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_pricing_type.rb b/lib/square/types/catalog_pricing_type.rb new file mode 100644 index 000000000..e2095b33e --- /dev/null +++ b/lib/square/types/catalog_pricing_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogPricingType + extend Square::Internal::Types::Enum + FIXED_PRICING = "FIXED_PRICING" + VARIABLE_PRICING = "VARIABLE_PRICING"end + end +end diff --git a/lib/square/types/catalog_product_set.rb b/lib/square/types/catalog_product_set.rb new file mode 100644 index 000000000..eaa23eb4d --- /dev/null +++ b/lib/square/types/catalog_product_set.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a collection of catalog objects for the purpose of applying a + # `PricingRule`. Including a catalog object will include all of its subtypes. + # For example, including a category in a product set will include all of its + # items and associated item variations in the product set. Including an item in + # a product set will also include its item variations. + class CatalogProductSet < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :product_ids_any, Internal::Types::Array[String], optional: true, nullable: false + field :product_ids_all, Internal::Types::Array[String], optional: true, nullable: false + field :quantity_exact, Integer, optional: true, nullable: false + field :quantity_min, Integer, optional: true, nullable: false + field :quantity_max, Integer, optional: true, nullable: false + field :all_products, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query.rb b/lib/square/types/catalog_query.rb new file mode 100644 index 000000000..c36a759f9 --- /dev/null +++ b/lib/square/types/catalog_query.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module Square + module Types + # A query composed of one or more different types of filters to narrow the scope of targeted objects when calling the `SearchCatalogObjects` endpoint. + # + # Although a query can have multiple filters, only certain query types can be combined per call to [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects). + # Any combination of the following types may be used together: + # - [exact_query](entity:CatalogQueryExact) + # - [prefix_query](entity:CatalogQueryPrefix) + # - [range_query](entity:CatalogQueryRange) + # - [sorted_attribute_query](entity:CatalogQuerySortedAttribute) + # - [text_query](entity:CatalogQueryText) + # + # All other query types cannot be combined with any others. + # + # When a query filter is based on an attribute, the attribute must be searchable. + # Searchable attributes are listed as follows, along their parent types that can be searched for with applicable query filters. + # + # Searchable attribute and objects queryable by searchable attributes: + # - `name`: `CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, `CatalogTax`, `CatalogDiscount`, `CatalogModifier`, `CatalogModifierList`, `CatalogItemOption`, `CatalogItemOptionValue` + # - `description`: `CatalogItem`, `CatalogItemOptionValue` + # - `abbreviation`: `CatalogItem` + # - `upc`: `CatalogItemVariation` + # - `sku`: `CatalogItemVariation` + # - `caption`: `CatalogImage` + # - `display_name`: `CatalogItemOption` + # + # For example, to search for [CatalogItem](entity:CatalogItem) objects by searchable attributes, you can use + # the `"name"`, `"description"`, or `"abbreviation"` attribute in an applicable query filter. + class CatalogQuery < Internal::Types::Model + field :sorted_attribute_query, Square::Types::CatalogQuerySortedAttribute, optional: true, nullable: false + field :exact_query, Square::Types::CatalogQueryExact, optional: true, nullable: false + field :set_query, Square::Types::CatalogQuerySet, optional: true, nullable: false + field :prefix_query, Square::Types::CatalogQueryPrefix, optional: true, nullable: false + field :range_query, Square::Types::CatalogQueryRange, optional: true, nullable: false + field :text_query, Square::Types::CatalogQueryText, optional: true, nullable: false + field :items_for_tax_query, Square::Types::CatalogQueryItemsForTax, optional: true, nullable: false + field :items_for_modifier_list_query, Square::Types::CatalogQueryItemsForModifierList, optional: true, nullable: false + field :items_for_item_options_query, Square::Types::CatalogQueryItemsForItemOptions, optional: true, nullable: false + field :item_variations_for_item_option_values_query, Square::Types::CatalogQueryItemVariationsForItemOptionValues, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_exact.rb b/lib/square/types/catalog_query_exact.rb new file mode 100644 index 000000000..a21911eb1 --- /dev/null +++ b/lib/square/types/catalog_query_exact.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the search result by exact match of the specified attribute name and value. + class CatalogQueryExact < Internal::Types::Model + field :attribute_name, String, optional: false, nullable: false + field :attribute_value, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_item_variations_for_item_option_values.rb b/lib/square/types/catalog_query_item_variations_for_item_option_values.rb new file mode 100644 index 000000000..2b9761339 --- /dev/null +++ b/lib/square/types/catalog_query_item_variations_for_item_option_values.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the item variations containing the specified item option value IDs. + class CatalogQueryItemVariationsForItemOptionValues < Internal::Types::Model + field :item_option_value_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_items_for_item_options.rb b/lib/square/types/catalog_query_items_for_item_options.rb new file mode 100644 index 000000000..460a29860 --- /dev/null +++ b/lib/square/types/catalog_query_items_for_item_options.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the items containing the specified item option IDs. + class CatalogQueryItemsForItemOptions < Internal::Types::Model + field :item_option_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_items_for_modifier_list.rb b/lib/square/types/catalog_query_items_for_modifier_list.rb new file mode 100644 index 000000000..f6fb0de79 --- /dev/null +++ b/lib/square/types/catalog_query_items_for_modifier_list.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the items containing the specified modifier list IDs. + class CatalogQueryItemsForModifierList < Internal::Types::Model + field :modifier_list_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_items_for_tax.rb b/lib/square/types/catalog_query_items_for_tax.rb new file mode 100644 index 000000000..a7699a3f7 --- /dev/null +++ b/lib/square/types/catalog_query_items_for_tax.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the items containing the specified tax IDs. + class CatalogQueryItemsForTax < Internal::Types::Model + field :tax_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_prefix.rb b/lib/square/types/catalog_query_prefix.rb new file mode 100644 index 000000000..9fd9f634d --- /dev/null +++ b/lib/square/types/catalog_query_prefix.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the search result whose named attribute values are prefixed by the specified attribute value. + class CatalogQueryPrefix < Internal::Types::Model + field :attribute_name, String, optional: false, nullable: false + field :attribute_prefix, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_range.rb b/lib/square/types/catalog_query_range.rb new file mode 100644 index 000000000..b8a059ba2 --- /dev/null +++ b/lib/square/types/catalog_query_range.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the search result whose named attribute values fall between the specified range. + class CatalogQueryRange < Internal::Types::Model + field :attribute_name, String, optional: false, nullable: false + field :attribute_min_value, Integer, optional: true, nullable: false + field :attribute_max_value, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_set.rb b/lib/square/types/catalog_query_set.rb new file mode 100644 index 000000000..5c0ec36a8 --- /dev/null +++ b/lib/square/types/catalog_query_set.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the search result(s) by exact match of the specified `attribute_name` and any of + # the `attribute_values`. + class CatalogQuerySet < Internal::Types::Model + field :attribute_name, String, optional: false, nullable: false + field :attribute_values, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_sorted_attribute.rb b/lib/square/types/catalog_query_sorted_attribute.rb new file mode 100644 index 000000000..5aea2d60d --- /dev/null +++ b/lib/square/types/catalog_query_sorted_attribute.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The query expression to specify the key to sort search results. + class CatalogQuerySortedAttribute < Internal::Types::Model + field :attribute_name, String, optional: false, nullable: false + field :initial_attribute_value, String, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_query_text.rb b/lib/square/types/catalog_query_text.rb new file mode 100644 index 000000000..0b6bde34c --- /dev/null +++ b/lib/square/types/catalog_query_text.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query filter to return the search result whose searchable attribute values contain all of the specified keywords or tokens, independent of the token order or case. + class CatalogQueryText < Internal::Types::Model + field :keywords, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_quick_amount.rb b/lib/square/types/catalog_quick_amount.rb new file mode 100644 index 000000000..0094ee60c --- /dev/null +++ b/lib/square/types/catalog_quick_amount.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a Quick Amount in the Catalog. + class CatalogQuickAmount < Internal::Types::Model + field :type, Square::Types::CatalogQuickAmountType, optional: false, nullable: false + field :amount, Square::Types::Money, optional: false, nullable: false + field :score, Integer, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_quick_amount_type.rb b/lib/square/types/catalog_quick_amount_type.rb new file mode 100644 index 000000000..690d89db8 --- /dev/null +++ b/lib/square/types/catalog_quick_amount_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogQuickAmountType + extend Square::Internal::Types::Enum + QUICK_AMOUNT_TYPE_MANUAL = "QUICK_AMOUNT_TYPE_MANUAL" + QUICK_AMOUNT_TYPE_AUTO = "QUICK_AMOUNT_TYPE_AUTO"end + end +end diff --git a/lib/square/types/catalog_quick_amounts_settings.rb b/lib/square/types/catalog_quick_amounts_settings.rb new file mode 100644 index 000000000..c2bfff429 --- /dev/null +++ b/lib/square/types/catalog_quick_amounts_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts. + class CatalogQuickAmountsSettings < Internal::Types::Model + field :option, Square::Types::CatalogQuickAmountsSettingsOption, optional: false, nullable: false + field :eligible_for_auto_amounts, Internal::Types::Boolean, optional: true, nullable: false + field :amounts, Internal::Types::Array[Square::Types::CatalogQuickAmount], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_quick_amounts_settings_option.rb b/lib/square/types/catalog_quick_amounts_settings_option.rb new file mode 100644 index 000000000..941de370f --- /dev/null +++ b/lib/square/types/catalog_quick_amounts_settings_option.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CatalogQuickAmountsSettingsOption + extend Square::Internal::Types::Enum + DISABLED = "DISABLED" + MANUAL = "MANUAL" + AUTO = "AUTO"end + end +end diff --git a/lib/square/types/catalog_stock_conversion.rb b/lib/square/types/catalog_stock_conversion.rb new file mode 100644 index 000000000..3d5908192 --- /dev/null +++ b/lib/square/types/catalog_stock_conversion.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the rule of conversion between a stockable [CatalogItemVariation](entity:CatalogItemVariation) + # and a non-stockable sell-by or receive-by `CatalogItemVariation` that + # share the same underlying stock. + class CatalogStockConversion < Internal::Types::Model + field :stockable_item_variation_id, String, optional: false, nullable: false + field :stockable_quantity, String, optional: false, nullable: false + field :nonstockable_quantity, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_subscription_plan.rb b/lib/square/types/catalog_subscription_plan.rb new file mode 100644 index 000000000..a4c3a37c5 --- /dev/null +++ b/lib/square/types/catalog_subscription_plan.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations. + # For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + class CatalogSubscriptionPlan < Internal::Types::Model + field :name, String, optional: false, nullable: false + field :phases, Internal::Types::Array[Square::Types::SubscriptionPhase], optional: true, nullable: false + field :subscription_plan_variations, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :eligible_item_ids, Internal::Types::Array[String], optional: true, nullable: false + field :eligible_category_ids, Internal::Types::Array[String], optional: true, nullable: false + field :all_items, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_subscription_plan_variation.rb b/lib/square/types/catalog_subscription_plan_variation.rb new file mode 100644 index 000000000..49d18b78e --- /dev/null +++ b/lib/square/types/catalog_subscription_plan_variation.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold. + # For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + class CatalogSubscriptionPlanVariation < Internal::Types::Model + field :name, String, optional: false, nullable: false + field :phases, Internal::Types::Array[Square::Types::SubscriptionPhase], optional: false, nullable: false + field :subscription_plan_id, String, optional: true, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :can_prorate, Internal::Types::Boolean, optional: true, nullable: false + field :successor_plan_variation_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_tax.rb b/lib/square/types/catalog_tax.rb new file mode 100644 index 000000000..e7db70d45 --- /dev/null +++ b/lib/square/types/catalog_tax.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # A tax applicable to an item. + class CatalogTax < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :calculation_phase, Square::Types::TaxCalculationPhase, optional: true, nullable: false + field :inclusion_type, Square::Types::TaxInclusionType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :applies_to_custom_amounts, Internal::Types::Boolean, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + field :applies_to_product_set_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_time_period.rb b/lib/square/types/catalog_time_period.rb new file mode 100644 index 000000000..e63fbf844 --- /dev/null +++ b/lib/square/types/catalog_time_period.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a time period - either a single period or a repeating period. + class CatalogTimePeriod < Internal::Types::Model + field :event, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_v_1_id.rb b/lib/square/types/catalog_v_1_id.rb new file mode 100644 index 000000000..34876c328 --- /dev/null +++ b/lib/square/types/catalog_v_1_id.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A Square API V1 identifier of an item, including the object ID and its associated location ID. + class CatalogV1Id < Internal::Types::Model + field :catalog_v_1_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_version_updated_event.rb b/lib/square/types/catalog_version_updated_event.rb new file mode 100644 index 000000000..c32f9b475 --- /dev/null +++ b/lib/square/types/catalog_version_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when the catalog is updated. + class CatalogVersionUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CatalogVersionUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_version_updated_event_catalog_version.rb b/lib/square/types/catalog_version_updated_event_catalog_version.rb new file mode 100644 index 000000000..2a41f9849 --- /dev/null +++ b/lib/square/types/catalog_version_updated_event_catalog_version.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogVersionUpdatedEventCatalogVersion < Internal::Types::Model + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_version_updated_event_data.rb b/lib/square/types/catalog_version_updated_event_data.rb new file mode 100644 index 000000000..8ea6c2be4 --- /dev/null +++ b/lib/square/types/catalog_version_updated_event_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogVersionUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :object, Square::Types::CatalogVersionUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/catalog_version_updated_event_object.rb b/lib/square/types/catalog_version_updated_event_object.rb new file mode 100644 index 000000000..20c2f9b5b --- /dev/null +++ b/lib/square/types/catalog_version_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CatalogVersionUpdatedEventObject < Internal::Types::Model + field :catalog_version, Square::Types::CatalogVersionUpdatedEventCatalogVersion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/category_path_to_root_node.rb b/lib/square/types/category_path_to_root_node.rb new file mode 100644 index 000000000..c1095268a --- /dev/null +++ b/lib/square/types/category_path_to_root_node.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A node in the path from a retrieved category to its root node. + class CategoryPathToRootNode < Internal::Types::Model + field :category_id, String, optional: true, nullable: false + field :category_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/change_billing_anchor_date_response.rb b/lib/square/types/change_billing_anchor_date_response.rb new file mode 100644 index 000000000..1117f6c91 --- /dev/null +++ b/lib/square/types/change_billing_anchor_date_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a request to the + # [ChangeBillingAnchorDate](api-endpoint:Subscriptions-ChangeBillingAnchorDate) endpoint. + class ChangeBillingAnchorDateResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/change_timing.rb b/lib/square/types/change_timing.rb new file mode 100644 index 000000000..955c03235 --- /dev/null +++ b/lib/square/types/change_timing.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ChangeTiming + extend Square::Internal::Types::Enum + IMMEDIATE = "IMMEDIATE" + END_OF_BILLING_CYCLE = "END_OF_BILLING_CYCLE"end + end +end diff --git a/lib/square/types/charge_request_additional_recipient.rb b/lib/square/types/charge_request_additional_recipient.rb new file mode 100644 index 000000000..ea6d47fcc --- /dev/null +++ b/lib/square/types/charge_request_additional_recipient.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an additional recipient (other than the merchant) entitled to a portion of the tender. + # Support is currently limited to USD, CAD and GBP currencies + class ChargeRequestAdditionalRecipient < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :description, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/checkout.rb b/lib/square/types/checkout.rb new file mode 100644 index 000000000..94551cd52 --- /dev/null +++ b/lib/square/types/checkout.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Square Checkout lets merchants accept online payments for supported + # payment types using a checkout workflow hosted on squareup.com. + class Checkout < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :checkout_page_url, String, optional: true, nullable: false + field :ask_for_shipping_address, Internal::Types::Boolean, optional: true, nullable: false + field :merchant_support_email, String, optional: true, nullable: false + field :pre_populate_buyer_email, String, optional: true, nullable: false + field :pre_populate_shipping_address, Square::Types::Address, optional: true, nullable: false + field :redirect_url, String, optional: true, nullable: false + field :order, Square::Types::Order, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :additional_recipients, Internal::Types::Array[Square::Types::AdditionalRecipient], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_location_settings.rb b/lib/square/types/checkout_location_settings.rb new file mode 100644 index 000000000..ca03ecbe8 --- /dev/null +++ b/lib/square/types/checkout_location_settings.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutLocationSettings < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :customer_notes_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :policies, Internal::Types::Array[Square::Types::CheckoutLocationSettingsPolicy], optional: true, nullable: false + field :branding, Square::Types::CheckoutLocationSettingsBranding, optional: true, nullable: false + field :tipping, Square::Types::CheckoutLocationSettingsTipping, optional: true, nullable: false + field :coupons, Square::Types::CheckoutLocationSettingsCoupons, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_location_settings_branding.rb b/lib/square/types/checkout_location_settings_branding.rb new file mode 100644 index 000000000..6851f41cf --- /dev/null +++ b/lib/square/types/checkout_location_settings_branding.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutLocationSettingsBranding < Internal::Types::Model + field :header_type, Square::Types::CheckoutLocationSettingsBrandingHeaderType, optional: true, nullable: false + field :button_color, String, optional: true, nullable: false + field :button_shape, Square::Types::CheckoutLocationSettingsBrandingButtonShape, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_location_settings_branding_button_shape.rb b/lib/square/types/checkout_location_settings_branding_button_shape.rb new file mode 100644 index 000000000..1afb88062 --- /dev/null +++ b/lib/square/types/checkout_location_settings_branding_button_shape.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CheckoutLocationSettingsBrandingButtonShape + extend Square::Internal::Types::Enum + SQUARED = "SQUARED" + ROUNDED = "ROUNDED" + PILL = "PILL"end + end +end diff --git a/lib/square/types/checkout_location_settings_branding_header_type.rb b/lib/square/types/checkout_location_settings_branding_header_type.rb new file mode 100644 index 000000000..91f5adaea --- /dev/null +++ b/lib/square/types/checkout_location_settings_branding_header_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CheckoutLocationSettingsBrandingHeaderType + extend Square::Internal::Types::Enum + BUSINESS_NAME = "BUSINESS_NAME" + FRAMED_LOGO = "FRAMED_LOGO" + FULL_WIDTH_LOGO = "FULL_WIDTH_LOGO"end + end +end diff --git a/lib/square/types/checkout_location_settings_coupons.rb b/lib/square/types/checkout_location_settings_coupons.rb new file mode 100644 index 000000000..69debfe47 --- /dev/null +++ b/lib/square/types/checkout_location_settings_coupons.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutLocationSettingsCoupons < Internal::Types::Model + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_location_settings_policy.rb b/lib/square/types/checkout_location_settings_policy.rb new file mode 100644 index 000000000..064dc4689 --- /dev/null +++ b/lib/square/types/checkout_location_settings_policy.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutLocationSettingsPolicy < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :title, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_location_settings_tipping.rb b/lib/square/types/checkout_location_settings_tipping.rb new file mode 100644 index 000000000..e50b4b2a6 --- /dev/null +++ b/lib/square/types/checkout_location_settings_tipping.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutLocationSettingsTipping < Internal::Types::Model + field :percentages, Internal::Types::Array[Integer], optional: true, nullable: false + field :smart_tipping_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :default_percent, Integer, optional: true, nullable: false + field :smart_tips, Internal::Types::Array[Square::Types::Money], optional: true, nullable: false + field :default_smart_tip, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_merchant_settings.rb b/lib/square/types/checkout_merchant_settings.rb new file mode 100644 index 000000000..fc868bd42 --- /dev/null +++ b/lib/square/types/checkout_merchant_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutMerchantSettings < Internal::Types::Model + field :payment_methods, Square::Types::CheckoutMerchantSettingsPaymentMethods, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_merchant_settings_payment_methods.rb b/lib/square/types/checkout_merchant_settings_payment_methods.rb new file mode 100644 index 000000000..fd35dc656 --- /dev/null +++ b/lib/square/types/checkout_merchant_settings_payment_methods.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutMerchantSettingsPaymentMethods < Internal::Types::Model + field :apple_pay, Square::Types::CheckoutMerchantSettingsPaymentMethodsPaymentMethod, optional: true, nullable: false + field :google_pay, Square::Types::CheckoutMerchantSettingsPaymentMethodsPaymentMethod, optional: true, nullable: false + field :cash_app, Square::Types::CheckoutMerchantSettingsPaymentMethodsPaymentMethod, optional: true, nullable: false + field :afterpay_clearpay, Square::Types::CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.rb b/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.rb new file mode 100644 index 000000000..3e7ec2848 --- /dev/null +++ b/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The settings allowed for AfterpayClearpay. + class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpay < Internal::Types::Model + field :order_eligibility_range, Square::Types::CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange, optional: true, nullable: false + field :item_eligibility_range, Square::Types::CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.rb b/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.rb new file mode 100644 index 000000000..3ea4edc04 --- /dev/null +++ b/lib/square/types/checkout_merchant_settings_payment_methods_afterpay_clearpay_eligibility_range.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A range of purchase price that qualifies. + class CheckoutMerchantSettingsPaymentMethodsAfterpayClearpayEligibilityRange < Internal::Types::Model + field :min, Square::Types::Money, optional: false, nullable: false + field :max, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_merchant_settings_payment_methods_payment_method.rb b/lib/square/types/checkout_merchant_settings_payment_methods_payment_method.rb new file mode 100644 index 000000000..a375da2bf --- /dev/null +++ b/lib/square/types/checkout_merchant_settings_payment_methods_payment_method.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The settings allowed for a payment method. + class CheckoutMerchantSettingsPaymentMethodsPaymentMethod < Internal::Types::Model + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_options.rb b/lib/square/types/checkout_options.rb new file mode 100644 index 000000000..6e1fcf09a --- /dev/null +++ b/lib/square/types/checkout_options.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + class CheckoutOptions < Internal::Types::Model + field :allow_tipping, Internal::Types::Boolean, optional: true, nullable: false + field :custom_fields, Internal::Types::Array[Square::Types::CustomField], optional: true, nullable: false + field :subscription_plan_id, String, optional: true, nullable: false + field :redirect_url, String, optional: true, nullable: false + field :merchant_support_email, String, optional: true, nullable: false + field :ask_for_shipping_address, Internal::Types::Boolean, optional: true, nullable: false + field :accepted_payment_methods, Square::Types::AcceptedPaymentMethods, optional: true, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :shipping_fee, Square::Types::ShippingFee, optional: true, nullable: false + field :enable_coupon, Internal::Types::Boolean, optional: true, nullable: false + field :enable_loyalty, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/checkout_options_payment_type.rb b/lib/square/types/checkout_options_payment_type.rb new file mode 100644 index 000000000..9df8aae3a --- /dev/null +++ b/lib/square/types/checkout_options_payment_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module CheckoutOptionsPaymentType + extend Square::Internal::Types::Enum + CARD_PRESENT = "CARD_PRESENT" + MANUAL_CARD_ENTRY = "MANUAL_CARD_ENTRY" + FELICA_ID = "FELICA_ID" + FELICA_QUICPAY = "FELICA_QUICPAY" + FELICA_TRANSPORTATION_GROUP = "FELICA_TRANSPORTATION_GROUP" + FELICA_ALL = "FELICA_ALL" + PAYPAY = "PAYPAY" + QR_CODE = "QR_CODE"end + end +end diff --git a/lib/square/types/clearpay_details.rb b/lib/square/types/clearpay_details.rb new file mode 100644 index 000000000..2fe0e5482 --- /dev/null +++ b/lib/square/types/clearpay_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about Clearpay payments. + class ClearpayDetails < Internal::Types::Model + field :email_address, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/clone_order_response.rb b/lib/square/types/clone_order_response.rb new file mode 100644 index 000000000..8a25d972a --- /dev/null +++ b/lib/square/types/clone_order_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CloneOrder](api-endpoint:Orders-CloneOrder) endpoint. + class CloneOrderResponse < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/collected_data.rb b/lib/square/types/collected_data.rb new file mode 100644 index 000000000..246ffd8eb --- /dev/null +++ b/lib/square/types/collected_data.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CollectedData < Internal::Types::Model + field :input_text, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/complete_payment_response.rb b/lib/square/types/complete_payment_response.rb new file mode 100644 index 000000000..e23f815b1 --- /dev/null +++ b/lib/square/types/complete_payment_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by[CompletePayment](api-endpoint:Payments-CompletePayment). + class CompletePaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/component.rb b/lib/square/types/component.rb new file mode 100644 index 000000000..ef4bf3691 --- /dev/null +++ b/lib/square/types/component.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # The wrapper object for the component entries of a given component type. + class Component < Internal::Types::Model + field :type, Square::Types::ComponentComponentType, optional: false, nullable: false + field :application_details, Square::Types::DeviceComponentDetailsApplicationDetails, optional: true, nullable: false + field :card_reader_details, Square::Types::DeviceComponentDetailsCardReaderDetails, optional: true, nullable: false + field :battery_details, Square::Types::DeviceComponentDetailsBatteryDetails, optional: true, nullable: false + field :wifi_details, Square::Types::DeviceComponentDetailsWiFiDetails, optional: true, nullable: false + field :ethernet_details, Square::Types::DeviceComponentDetailsEthernetDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/component_component_type.rb b/lib/square/types/component_component_type.rb new file mode 100644 index 000000000..62a54e95f --- /dev/null +++ b/lib/square/types/component_component_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module ComponentComponentType + extend Square::Internal::Types::Enum + APPLICATION = "APPLICATION" + CARD_READER = "CARD_READER" + BATTERY = "BATTERY" + WIFI = "WIFI" + ETHERNET = "ETHERNET" + PRINTER = "PRINTER"end + end +end diff --git a/lib/square/types/confirmation_decision.rb b/lib/square/types/confirmation_decision.rb new file mode 100644 index 000000000..74defc99d --- /dev/null +++ b/lib/square/types/confirmation_decision.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class ConfirmationDecision < Internal::Types::Model + field :has_agreed, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/confirmation_options.rb b/lib/square/types/confirmation_options.rb new file mode 100644 index 000000000..fd10f663f --- /dev/null +++ b/lib/square/types/confirmation_options.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class ConfirmationOptions < Internal::Types::Model + field :title, String, optional: false, nullable: false + field :body, String, optional: false, nullable: false + field :agree_button_text, String, optional: false, nullable: false + field :disagree_button_text, String, optional: true, nullable: false + field :decision, Square::Types::ConfirmationDecision, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/coordinates.rb b/lib/square/types/coordinates.rb new file mode 100644 index 000000000..7bf1f7f03 --- /dev/null +++ b/lib/square/types/coordinates.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Latitude and longitude coordinates. + class Coordinates < Internal::Types::Model + field :latitude, Integer, optional: true, nullable: false + field :longitude, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/country.rb b/lib/square/types/country.rb new file mode 100644 index 000000000..afaad6719 --- /dev/null +++ b/lib/square/types/country.rb @@ -0,0 +1,258 @@ +# frozen_string_literal: true + +module Square + module Types + module Country + extend Square::Internal::Types::Enum + ZZ = "ZZ" + AD = "AD" + AE = "AE" + AF = "AF" + AG = "AG" + AI = "AI" + AL = "AL" + AM = "AM" + AO = "AO" + AQ = "AQ" + AR = "AR" + AS = "AS" + AT = "AT" + AU = "AU" + AW = "AW" + AX = "AX" + AZ = "AZ" + BA = "BA" + BB = "BB" + BD = "BD" + BE = "BE" + BF = "BF" + BG = "BG" + BH = "BH" + BI = "BI" + BJ = "BJ" + BL = "BL" + BM = "BM" + BN = "BN" + BO = "BO" + BQ = "BQ" + BR = "BR" + BS = "BS" + BT = "BT" + BV = "BV" + BW = "BW" + BY = "BY" + BZ = "BZ" + CA = "CA" + CC = "CC" + CD = "CD" + CF = "CF" + CG = "CG" + CH = "CH" + CI = "CI" + CK = "CK" + CL = "CL" + CM = "CM" + CN = "CN" + CO = "CO" + CR = "CR" + CU = "CU" + CV = "CV" + CW = "CW" + CX = "CX" + CY = "CY" + CZ = "CZ" + DE = "DE" + DJ = "DJ" + DK = "DK" + DM = "DM" + DO = "DO" + DZ = "DZ" + EC = "EC" + EE = "EE" + EG = "EG" + EH = "EH" + ER = "ER" + ES = "ES" + ET = "ET" + FI = "FI" + FJ = "FJ" + FK = "FK" + FM = "FM" + FO = "FO" + FR = "FR" + GA = "GA" + GB = "GB" + GD = "GD" + GE = "GE" + GF = "GF" + GG = "GG" + GH = "GH" + GI = "GI" + GL = "GL" + GM = "GM" + GN = "GN" + GP = "GP" + GQ = "GQ" + GR = "GR" + GS = "GS" + GT = "GT" + GU = "GU" + GW = "GW" + GY = "GY" + HK = "HK" + HM = "HM" + HN = "HN" + HR = "HR" + HT = "HT" + HU = "HU" + ID = "ID" + IE = "IE" + IL = "IL" + IM = "IM" + IN = "IN" + IO = "IO" + IQ = "IQ" + IR = "IR" + IS = "IS" + IT = "IT" + JE = "JE" + JM = "JM" + JO = "JO" + JP = "JP" + KE = "KE" + KG = "KG" + KH = "KH" + KI = "KI" + KM = "KM" + KN = "KN" + KP = "KP" + KR = "KR" + KW = "KW" + KY = "KY" + KZ = "KZ" + LA = "LA" + LB = "LB" + LC = "LC" + LI = "LI" + LK = "LK" + LR = "LR" + LS = "LS" + LT = "LT" + LU = "LU" + LV = "LV" + LY = "LY" + MA = "MA" + MC = "MC" + MD = "MD" + ME = "ME" + MF = "MF" + MG = "MG" + MH = "MH" + MK = "MK" + ML = "ML" + MM = "MM" + MN = "MN" + MO = "MO" + MP = "MP" + MQ = "MQ" + MR = "MR" + MS = "MS" + MT = "MT" + MU = "MU" + MV = "MV" + MW = "MW" + MX = "MX" + MY = "MY" + MZ = "MZ" + NA = "NA" + NC = "NC" + NE = "NE" + NF = "NF" + NG = "NG" + NI = "NI" + NL = "NL" + NO = "NO" + NP = "NP" + NR = "NR" + NU = "NU" + NZ = "NZ" + OM = "OM" + PA = "PA" + PE = "PE" + PF = "PF" + PG = "PG" + PH = "PH" + PK = "PK" + PL = "PL" + PM = "PM" + PN = "PN" + PR = "PR" + PS = "PS" + PT = "PT" + PW = "PW" + PY = "PY" + QA = "QA" + RE = "RE" + RO = "RO" + RS = "RS" + RU = "RU" + RW = "RW" + SA = "SA" + SB = "SB" + SC = "SC" + SD = "SD" + SE = "SE" + SG = "SG" + SH = "SH" + SI = "SI" + SJ = "SJ" + SK = "SK" + SL = "SL" + SM = "SM" + SN = "SN" + SO = "SO" + SR = "SR" + SS = "SS" + ST = "ST" + SV = "SV" + SX = "SX" + SY = "SY" + SZ = "SZ" + TC = "TC" + TD = "TD" + TF = "TF" + TG = "TG" + TH = "TH" + TJ = "TJ" + TK = "TK" + TL = "TL" + TM = "TM" + TN = "TN" + TO = "TO" + TR = "TR" + TT = "TT" + TV = "TV" + TW = "TW" + TZ = "TZ" + UA = "UA" + UG = "UG" + UM = "UM" + US = "US" + UY = "UY" + UZ = "UZ" + VA = "VA" + VC = "VC" + VE = "VE" + VG = "VG" + VI = "VI" + VN = "VN" + VU = "VU" + WF = "WF" + WS = "WS" + YE = "YE" + YT = "YT" + ZA = "ZA" + ZM = "ZM" + ZW = "ZW"end + end +end diff --git a/lib/square/types/create_booking_custom_attribute_definition_response.rb b/lib/square/types/create_booking_custom_attribute_definition_response.rb new file mode 100644 index 000000000..d6fafd6e4 --- /dev/null +++ b/lib/square/types/create_booking_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-CreateBookingCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class CreateBookingCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_booking_response.rb b/lib/square/types/create_booking_response.rb new file mode 100644 index 000000000..fcf8118cc --- /dev/null +++ b/lib/square/types/create_booking_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateBookingResponse < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_break_type_response.rb b/lib/square/types/create_break_type_response.rb new file mode 100644 index 000000000..5e23ab164 --- /dev/null +++ b/lib/square/types/create_break_type_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to the request to create a `BreakType`. The response contains + # the created `BreakType` object and might contain a set of `Error` objects if + # the request resulted in errors. + class CreateBreakTypeResponse < Internal::Types::Model + field :break_type, Square::Types::BreakType, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_card_response.rb b/lib/square/types/create_card_response.rb new file mode 100644 index 000000000..2835f7f37 --- /dev/null +++ b/lib/square/types/create_card_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CreateCard](api-endpoint:Cards-CreateCard) endpoint. + # + # Note: if there are errors processing the request, the card field will not be + # present. + class CreateCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_catalog_image_request.rb b/lib/square/types/create_catalog_image_request.rb new file mode 100644 index 000000000..d5db19540 --- /dev/null +++ b/lib/square/types/create_catalog_image_request.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateCatalogImageRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :object_id, String, optional: true, nullable: false + field :image, Square::Types::CatalogObject, optional: false, nullable: false + field :is_primary, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_catalog_image_response.rb b/lib/square/types/create_catalog_image_response.rb new file mode 100644 index 000000000..e69ef018d --- /dev/null +++ b/lib/square/types/create_catalog_image_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateCatalogImageResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :image, Square::Types::CatalogObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_checkout_response.rb b/lib/square/types/create_checkout_response.rb new file mode 100644 index 000000000..09b66e78b --- /dev/null +++ b/lib/square/types/create_checkout_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `CreateCheckout` endpoint. + class CreateCheckoutResponse < Internal::Types::Model + field :checkout, Square::Types::Checkout, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_customer_card_response.rb b/lib/square/types/create_customer_card_response.rb new file mode 100644 index 000000000..fff6acd92 --- /dev/null +++ b/lib/square/types/create_customer_card_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `CreateCustomerCard` endpoint. + # + # Either `errors` or `card` is present in a given response (never both). + class CreateCustomerCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_customer_custom_attribute_definition_response.rb b/lib/square/types/create_customer_custom_attribute_definition_response.rb new file mode 100644 index 000000000..6eed2d586 --- /dev/null +++ b/lib/square/types/create_customer_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-CreateCustomerCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class CreateCustomerCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_customer_group_response.rb b/lib/square/types/create_customer_group_response.rb new file mode 100644 index 000000000..6ef6e24b9 --- /dev/null +++ b/lib/square/types/create_customer_group_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CreateCustomerGroup](api-endpoint:CustomerGroups-CreateCustomerGroup) endpoint. + # + # Either `errors` or `group` is present in a given response (never both). + class CreateCustomerGroupResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :group, Square::Types::CustomerGroup, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_customer_response.rb b/lib/square/types/create_customer_response.rb new file mode 100644 index 000000000..5561496c8 --- /dev/null +++ b/lib/square/types/create_customer_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CreateCustomer](api-endpoint:Customers-CreateCustomer) or + # [BulkCreateCustomers](api-endpoint:Customers-BulkCreateCustomers) endpoint. + # + # Either `errors` or `customer` is present in a given response (never both). + class CreateCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :customer, Square::Types::Customer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_device_code_response.rb b/lib/square/types/create_device_code_response.rb new file mode 100644 index 000000000..fcf72379a --- /dev/null +++ b/lib/square/types/create_device_code_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateDeviceCodeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :device_code, Square::Types::DeviceCode, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_dispute_evidence_file_request.rb b/lib/square/types/create_dispute_evidence_file_request.rb new file mode 100644 index 000000000..4b7f9a80f --- /dev/null +++ b/lib/square/types/create_dispute_evidence_file_request.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the parameters for a `CreateDisputeEvidenceFile` request. + class CreateDisputeEvidenceFileRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :evidence_type, Square::Types::DisputeEvidenceType, optional: true, nullable: false + field :content_type, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_dispute_evidence_file_response.rb b/lib/square/types/create_dispute_evidence_file_response.rb new file mode 100644 index 000000000..ed3972323 --- /dev/null +++ b/lib/square/types/create_dispute_evidence_file_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `CreateDisputeEvidenceFile` response. + class CreateDisputeEvidenceFileResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :evidence, Square::Types::DisputeEvidence, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_dispute_evidence_text_response.rb b/lib/square/types/create_dispute_evidence_text_response.rb new file mode 100644 index 000000000..a34217161 --- /dev/null +++ b/lib/square/types/create_dispute_evidence_text_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `CreateDisputeEvidenceText` response. + class CreateDisputeEvidenceTextResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :evidence, Square::Types::DisputeEvidence, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_gift_card_activity_response.rb b/lib/square/types/create_gift_card_activity_response.rb new file mode 100644 index 000000000..7ff8eef6d --- /dev/null +++ b/lib/square/types/create_gift_card_activity_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a `GiftCardActivity` that was created. + # The response might contain a set of `Error` objects if the request resulted in errors. + class CreateGiftCardActivityResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card_activity, Square::Types::GiftCardActivity, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_gift_card_response.rb b/lib/square/types/create_gift_card_response.rb new file mode 100644 index 000000000..ece6c28f4 --- /dev/null +++ b/lib/square/types/create_gift_card_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a `GiftCard`. The response might contain a set of `Error` objects if the request + # resulted in errors. + class CreateGiftCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_invoice_attachment_request_data.rb b/lib/square/types/create_invoice_attachment_request_data.rb new file mode 100644 index 000000000..c910f2fda --- /dev/null +++ b/lib/square/types/create_invoice_attachment_request_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) request. + class CreateInvoiceAttachmentRequestData < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_invoice_attachment_response.rb b/lib/square/types/create_invoice_attachment_response.rb new file mode 100644 index 000000000..287331801 --- /dev/null +++ b/lib/square/types/create_invoice_attachment_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateInvoiceAttachment](api-endpoint:Invoices-CreateInvoiceAttachment) response. + class CreateInvoiceAttachmentResponse < Internal::Types::Model + field :attachment, Square::Types::InvoiceAttachment, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_invoice_response.rb b/lib/square/types/create_invoice_response.rb new file mode 100644 index 000000000..56f682579 --- /dev/null +++ b/lib/square/types/create_invoice_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response returned by the `CreateInvoice` request. + class CreateInvoiceResponse < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_job_response.rb b/lib/square/types/create_job_response.rb new file mode 100644 index 000000000..a11a4a803 --- /dev/null +++ b/lib/square/types/create_job_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateJob](api-endpoint:Team-CreateJob) response. Either `job` or `errors` + # is present in the response. + class CreateJobResponse < Internal::Types::Model + field :job, Square::Types::Job, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_location_custom_attribute_definition_response.rb b/lib/square/types/create_location_custom_attribute_definition_response.rb new file mode 100644 index 000000000..6aafa22fe --- /dev/null +++ b/lib/square/types/create_location_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-CreateLocationCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class CreateLocationCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_location_response.rb b/lib/square/types/create_location_response.rb new file mode 100644 index 000000000..5e9f9fc95 --- /dev/null +++ b/lib/square/types/create_location_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response object returned by the [CreateLocation](api-endpoint:Locations-CreateLocation) endpoint. + class CreateLocationResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :location, Square::Types::Location, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_loyalty_account_response.rb b/lib/square/types/create_loyalty_account_response.rb new file mode 100644 index 000000000..b3c517f8e --- /dev/null +++ b/lib/square/types/create_loyalty_account_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes loyalty account created. + class CreateLoyaltyAccountResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_account, Square::Types::LoyaltyAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_loyalty_promotion_response.rb b/lib/square/types/create_loyalty_promotion_response.rb new file mode 100644 index 000000000..f029882c7 --- /dev/null +++ b/lib/square/types/create_loyalty_promotion_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateLoyaltyPromotion](api-endpoint:Loyalty-CreateLoyaltyPromotion) response. + # Either `loyalty_promotion` or `errors` is present in the response. + class CreateLoyaltyPromotionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_loyalty_reward_response.rb b/lib/square/types/create_loyalty_reward_response.rb new file mode 100644 index 000000000..d58eed6a7 --- /dev/null +++ b/lib/square/types/create_loyalty_reward_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes the loyalty reward created. + class CreateLoyaltyRewardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :reward, Square::Types::LoyaltyReward, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_merchant_custom_attribute_definition_response.rb b/lib/square/types/create_merchant_custom_attribute_definition_response.rb new file mode 100644 index 000000000..48ccbb5ad --- /dev/null +++ b/lib/square/types/create_merchant_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-CreateMerchantCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class CreateMerchantCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_mobile_authorization_code_response.rb b/lib/square/types/create_mobile_authorization_code_response.rb new file mode 100644 index 000000000..92f893ffb --- /dev/null +++ b/lib/square/types/create_mobile_authorization_code_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `CreateMobileAuthorizationCode` endpoint. + class CreateMobileAuthorizationCodeResponse < Internal::Types::Model + field :authorization_code, String, optional: true, nullable: false + field :expires_at, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_order_custom_attribute_definition_response.rb b/lib/square/types/create_order_custom_attribute_definition_response.rb new file mode 100644 index 000000000..11e90a21c --- /dev/null +++ b/lib/square/types/create_order_custom_attribute_definition_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from creating an order custom attribute definition. + class CreateOrderCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_order_request.rb b/lib/square/types/create_order_request.rb new file mode 100644 index 000000000..5643c3189 --- /dev/null +++ b/lib/square/types/create_order_request.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateOrderRequest < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_order_response.rb b/lib/square/types/create_order_response.rb new file mode 100644 index 000000000..213b8814d --- /dev/null +++ b/lib/square/types/create_order_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `CreateOrder` endpoint. + # + # Either `errors` or `order` is present in a given response, but never both. + class CreateOrderResponse < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_payment_link_response.rb b/lib/square/types/create_payment_link_response.rb new file mode 100644 index 000000000..16639f56e --- /dev/null +++ b/lib/square/types/create_payment_link_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CreatePaymentLinkResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment_link, Square::Types::PaymentLink, optional: true, nullable: false + field :related_resources, Square::Types::PaymentLinkRelatedResources, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_payment_response.rb b/lib/square/types/create_payment_response.rb new file mode 100644 index 000000000..2475da6de --- /dev/null +++ b/lib/square/types/create_payment_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [CreatePayment](api-endpoint:Payments-CreatePayment). + # + # If there are errors processing the request, the `payment` field might not be + # present, or it might be present with a status of `FAILED`. + class CreatePaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_scheduled_shift_response.rb b/lib/square/types/create_scheduled_shift_response.rb new file mode 100644 index 000000000..14395de64 --- /dev/null +++ b/lib/square/types/create_scheduled_shift_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [CreateScheduledShift](api-endpoint:Labor-CreateScheduledShift) response. + # Either `scheduled_shift` or `errors` is present in the response. + class CreateScheduledShiftResponse < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_shift_response.rb b/lib/square/types/create_shift_response.rb new file mode 100644 index 000000000..18b824cdc --- /dev/null +++ b/lib/square/types/create_shift_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to create a `Shift`. The response contains + # the created `Shift` object and might contain a set of `Error` objects if + # the request resulted in errors. + class CreateShiftResponse < Internal::Types::Model + field :shift, Square::Types::Shift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_subscription_response.rb b/lib/square/types/create_subscription_response.rb new file mode 100644 index 000000000..4fb048b5f --- /dev/null +++ b/lib/square/types/create_subscription_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint. + class CreateSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_team_member_request.rb b/lib/square/types/create_team_member_request.rb new file mode 100644 index 000000000..2cd30722c --- /dev/null +++ b/lib/square/types/create_team_member_request.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a create request for a `TeamMember` object. + class CreateTeamMemberRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_team_member_response.rb b/lib/square/types/create_team_member_response.rb new file mode 100644 index 000000000..d1fb502c3 --- /dev/null +++ b/lib/square/types/create_team_member_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a create request containing the created `TeamMember` object or error messages. + class CreateTeamMemberResponse < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_terminal_action_response.rb b/lib/square/types/create_terminal_action_response.rb new file mode 100644 index 000000000..d1797f353 --- /dev/null +++ b/lib/square/types/create_terminal_action_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateTerminalActionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_terminal_checkout_response.rb b/lib/square/types/create_terminal_checkout_response.rb new file mode 100644 index 000000000..6487f8f0f --- /dev/null +++ b/lib/square/types/create_terminal_checkout_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateTerminalCheckoutResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_terminal_refund_response.rb b/lib/square/types/create_terminal_refund_response.rb new file mode 100644 index 000000000..c5261ffcf --- /dev/null +++ b/lib/square/types/create_terminal_refund_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class CreateTerminalRefundResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_timecard_response.rb b/lib/square/types/create_timecard_response.rb new file mode 100644 index 000000000..48cb72f40 --- /dev/null +++ b/lib/square/types/create_timecard_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to create a `Timecard`. The response contains + # the created `Timecard` object and might contain a set of `Error` objects if + # the request resulted in errors. + class CreateTimecardResponse < Internal::Types::Model + field :timecard, Square::Types::Timecard, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_vendor_response.rb b/lib/square/types/create_vendor_response.rb new file mode 100644 index 000000000..8cb1c8077 --- /dev/null +++ b/lib/square/types/create_vendor_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [CreateVendor](api-endpoint:Vendors-CreateVendor). + class CreateVendorResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/create_webhook_subscription_response.rb b/lib/square/types/create_webhook_subscription_response.rb new file mode 100644 index 000000000..25d607aca --- /dev/null +++ b/lib/square/types/create_webhook_subscription_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [CreateWebhookSubscription](api-endpoint:WebhookSubscriptions-CreateWebhookSubscription) endpoint. + # + # Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be + # present. + class CreateWebhookSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::WebhookSubscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/currency.rb b/lib/square/types/currency.rb new file mode 100644 index 000000000..1a17f74c3 --- /dev/null +++ b/lib/square/types/currency.rb @@ -0,0 +1,191 @@ +# frozen_string_literal: true + +module Square + module Types + module Currency + extend Square::Internal::Types::Enum + UNKNOWN_CURRENCY = "UNKNOWN_CURRENCY" + AED = "AED" + AFN = "AFN" + ALL = "ALL" + AMD = "AMD" + ANG = "ANG" + AOA = "AOA" + ARS = "ARS" + AUD = "AUD" + AWG = "AWG" + AZN = "AZN" + BAM = "BAM" + BBD = "BBD" + BDT = "BDT" + BGN = "BGN" + BHD = "BHD" + BIF = "BIF" + BMD = "BMD" + BND = "BND" + BOB = "BOB" + BOV = "BOV" + BRL = "BRL" + BSD = "BSD" + BTN = "BTN" + BWP = "BWP" + BYR = "BYR" + BZD = "BZD" + CAD = "CAD" + CDF = "CDF" + CHE = "CHE" + CHF = "CHF" + CHW = "CHW" + CLF = "CLF" + CLP = "CLP" + CNY = "CNY" + COP = "COP" + COU = "COU" + CRC = "CRC" + CUC = "CUC" + CUP = "CUP" + CVE = "CVE" + CZK = "CZK" + DJF = "DJF" + DKK = "DKK" + DOP = "DOP" + DZD = "DZD" + EGP = "EGP" + ERN = "ERN" + ETB = "ETB" + EUR = "EUR" + FJD = "FJD" + FKP = "FKP" + GBP = "GBP" + GEL = "GEL" + GHS = "GHS" + GIP = "GIP" + GMD = "GMD" + GNF = "GNF" + GTQ = "GTQ" + GYD = "GYD" + HKD = "HKD" + HNL = "HNL" + HRK = "HRK" + HTG = "HTG" + HUF = "HUF" + IDR = "IDR" + ILS = "ILS" + INR = "INR" + IQD = "IQD" + IRR = "IRR" + ISK = "ISK" + JMD = "JMD" + JOD = "JOD" + JPY = "JPY" + KES = "KES" + KGS = "KGS" + KHR = "KHR" + KMF = "KMF" + KPW = "KPW" + KRW = "KRW" + KWD = "KWD" + KYD = "KYD" + KZT = "KZT" + LAK = "LAK" + LBP = "LBP" + LKR = "LKR" + LRD = "LRD" + LSL = "LSL" + LTL = "LTL" + LVL = "LVL" + LYD = "LYD" + MAD = "MAD" + MDL = "MDL" + MGA = "MGA" + MKD = "MKD" + MMK = "MMK" + MNT = "MNT" + MOP = "MOP" + MRO = "MRO" + MUR = "MUR" + MVR = "MVR" + MWK = "MWK" + MXN = "MXN" + MXV = "MXV" + MYR = "MYR" + MZN = "MZN" + NAD = "NAD" + NGN = "NGN" + NIO = "NIO" + NOK = "NOK" + NPR = "NPR" + NZD = "NZD" + OMR = "OMR" + PAB = "PAB" + PEN = "PEN" + PGK = "PGK" + PHP = "PHP" + PKR = "PKR" + PLN = "PLN" + PYG = "PYG" + QAR = "QAR" + RON = "RON" + RSD = "RSD" + RUB = "RUB" + RWF = "RWF" + SAR = "SAR" + SBD = "SBD" + SCR = "SCR" + SDG = "SDG" + SEK = "SEK" + SGD = "SGD" + SHP = "SHP" + SLL = "SLL" + SLE = "SLE" + SOS = "SOS" + SRD = "SRD" + SSP = "SSP" + STD = "STD" + SVC = "SVC" + SYP = "SYP" + SZL = "SZL" + THB = "THB" + TJS = "TJS" + TMT = "TMT" + TND = "TND" + TOP = "TOP" + TRY = "TRY" + TTD = "TTD" + TWD = "TWD" + TZS = "TZS" + UAH = "UAH" + UGX = "UGX" + USD = "USD" + USN = "USN" + USS = "USS" + UYI = "UYI" + UYU = "UYU" + UZS = "UZS" + VEF = "VEF" + VND = "VND" + VUV = "VUV" + WST = "WST" + XAF = "XAF" + XAG = "XAG" + XAU = "XAU" + XBA = "XBA" + XBB = "XBB" + XBC = "XBC" + XBD = "XBD" + XCD = "XCD" + XDR = "XDR" + XOF = "XOF" + XPD = "XPD" + XPF = "XPF" + XPT = "XPT" + XTS = "XTS" + XXX = "XXX" + YER = "YER" + ZAR = "ZAR" + ZMK = "ZMK" + ZMW = "ZMW" + BTC = "BTC" + XUS = "XUS"end + end +end diff --git a/lib/square/types/custom_attribute.rb b/lib/square/types/custom_attribute.rb new file mode 100644 index 000000000..5c2dc33d7 --- /dev/null +++ b/lib/square/types/custom_attribute.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A custom attribute value. Each custom attribute value has a corresponding + # `CustomAttributeDefinition` object. + class CustomAttribute < Internal::Types::Model + field :key, String, optional: true, nullable: false + field :value, Internal::Types::Hash[String, ], optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :visibility, Square::Types::CustomAttributeDefinitionVisibility, optional: true, nullable: false + field :definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_definition.rb b/lib/square/types/custom_attribute_definition.rb new file mode 100644 index 000000000..89c39c6d1 --- /dev/null +++ b/lib/square/types/custom_attribute_definition.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a definition for custom attribute values. A custom attribute definition + # specifies the key, visibility, schema, and other properties for a custom attribute. + class CustomAttributeDefinition < Internal::Types::Model + field :key, String, optional: true, nullable: false + field :schema, Internal::Types::Hash[String, Internal::Types::Hash[String, ]], optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :visibility, Square::Types::CustomAttributeDefinitionVisibility, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_definition_event_data.rb b/lib/square/types/custom_attribute_definition_event_data.rb new file mode 100644 index 000000000..268dd9c96 --- /dev/null +++ b/lib/square/types/custom_attribute_definition_event_data.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an object in the CustomAttributeDefinition event notification + # payload that contains the affected custom attribute definition. + class CustomAttributeDefinitionEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CustomAttributeDefinitionEventDataObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_definition_event_data_object.rb b/lib/square/types/custom_attribute_definition_event_data_object.rb new file mode 100644 index 000000000..428ab187d --- /dev/null +++ b/lib/square/types/custom_attribute_definition_event_data_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CustomAttributeDefinitionEventDataObject < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_definition_visibility.rb b/lib/square/types/custom_attribute_definition_visibility.rb new file mode 100644 index 000000000..7b8aadcd5 --- /dev/null +++ b/lib/square/types/custom_attribute_definition_visibility.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module CustomAttributeDefinitionVisibility + extend Square::Internal::Types::Enum + VISIBILITY_HIDDEN = "VISIBILITY_HIDDEN" + VISIBILITY_READ_ONLY = "VISIBILITY_READ_ONLY" + VISIBILITY_READ_WRITE_VALUES = "VISIBILITY_READ_WRITE_VALUES"end + end +end diff --git a/lib/square/types/custom_attribute_event_data.rb b/lib/square/types/custom_attribute_event_data.rb new file mode 100644 index 000000000..8779761b0 --- /dev/null +++ b/lib/square/types/custom_attribute_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class CustomAttributeEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CustomAttributeEventDataObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_event_data_object.rb b/lib/square/types/custom_attribute_event_data_object.rb new file mode 100644 index 000000000..c0e9d47cf --- /dev/null +++ b/lib/square/types/custom_attribute_event_data_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class CustomAttributeEventDataObject < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_attribute_filter.rb b/lib/square/types/custom_attribute_filter.rb new file mode 100644 index 000000000..41af10e73 --- /dev/null +++ b/lib/square/types/custom_attribute_filter.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Supported custom attribute query expressions for calling the + # [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) + # endpoint to search for items or item variations. + class CustomAttributeFilter < Internal::Types::Model + field :custom_attribute_definition_id, String, optional: true, nullable: false + field :key, String, optional: true, nullable: false + field :string_filter, String, optional: true, nullable: false + field :number_filter, Square::Types::Range, optional: true, nullable: false + field :selection_uids_filter, Internal::Types::Array[String], optional: true, nullable: false + field :bool_filter, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/custom_field.rb b/lib/square/types/custom_field.rb new file mode 100644 index 000000000..acfe4450e --- /dev/null +++ b/lib/square/types/custom_field.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a custom form field to add to the checkout page to collect more information from buyers during checkout. + # For more information, + # see [Specify checkout options](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations#specify-checkout-options-1). + class CustomField < Internal::Types::Model + field :title, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/customer.rb b/lib/square/types/customer.rb new file mode 100644 index 000000000..b54f819b1 --- /dev/null +++ b/lib/square/types/customer.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a Square customer profile in the Customer Directory of a Square seller. + class Customer < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :nickname, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :birthday, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :preferences, Square::Types::CustomerPreferences, optional: true, nullable: false + field :creation_source, Square::Types::CustomerCreationSource, optional: true, nullable: false + field :group_ids, Internal::Types::Array[String], optional: true, nullable: false + field :segment_ids, Internal::Types::Array[String], optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :tax_ids, Square::Types::CustomerTaxIds, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_address_filter.rb b/lib/square/types/customer_address_filter.rb new file mode 100644 index 000000000..b5a2e8198 --- /dev/null +++ b/lib/square/types/customer_address_filter.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The customer address filter. This filter is used in a [CustomerCustomAttributeFilterValue](entity:CustomerCustomAttributeFilterValue) filter when + # searching by an `Address`-type custom attribute. + class CustomerAddressFilter < Internal::Types::Model + field :postal_code, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :country, Square::Types::Country, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_created_event.rb b/lib/square/types/customer_created_event.rb new file mode 100644 index 000000000..a86b1a440 --- /dev/null +++ b/lib/square/types/customer_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [customer](entity:Customer) is created. Subscribe to this event to track customer profiles affected by a merge operation. + # For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). + # + # The `customer` object in the event notification does not include the `segment_ids` field. + class CustomerCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomerCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_created_event_data.rb b/lib/square/types/customer_created_event_data.rb new file mode 100644 index 000000000..216c373e3 --- /dev/null +++ b/lib/square/types/customer_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with the event. + class CustomerCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CustomerCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_created_event_event_context.rb b/lib/square/types/customer_created_event_event_context.rb new file mode 100644 index 000000000..fedd72da5 --- /dev/null +++ b/lib/square/types/customer_created_event_event_context.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about the change that triggered the event. + class CustomerCreatedEventEventContext < Internal::Types::Model + field :merge, Square::Types::CustomerCreatedEventEventContextMerge, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_created_event_event_context_merge.rb b/lib/square/types/customer_created_event_event_context_merge.rb new file mode 100644 index 000000000..f28c106db --- /dev/null +++ b/lib/square/types/customer_created_event_event_context_merge.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers. + class CustomerCreatedEventEventContextMerge < Internal::Types::Model + field :from_customer_ids, Internal::Types::Array[String], optional: true, nullable: false + field :to_customer_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_created_event_object.rb b/lib/square/types/customer_created_event_object.rb new file mode 100644 index 000000000..3d5d368a6 --- /dev/null +++ b/lib/square/types/customer_created_event_object.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the customer associated with the event. + class CustomerCreatedEventObject < Internal::Types::Model + field :customer, Square::Types::Customer, optional: true, nullable: false + field :event_context, Square::Types::CustomerCreatedEventEventContext, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_creation_source.rb b/lib/square/types/customer_creation_source.rb new file mode 100644 index 000000000..00a6aede8 --- /dev/null +++ b/lib/square/types/customer_creation_source.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Square + module Types + module CustomerCreationSource + extend Square::Internal::Types::Enum + OTHER = "OTHER" + APPOINTMENTS = "APPOINTMENTS" + COUPON = "COUPON" + DELETION_RECOVERY = "DELETION_RECOVERY" + DIRECTORY = "DIRECTORY" + EGIFTING = "EGIFTING" + EMAIL_COLLECTION = "EMAIL_COLLECTION" + FEEDBACK = "FEEDBACK" + IMPORT = "IMPORT" + INVOICES = "INVOICES" + LOYALTY = "LOYALTY" + MARKETING = "MARKETING" + MERGE = "MERGE" + ONLINE_STORE = "ONLINE_STORE" + INSTANT_PROFILE = "INSTANT_PROFILE" + TERMINAL = "TERMINAL" + THIRD_PARTY = "THIRD_PARTY" + THIRD_PARTY_IMPORT = "THIRD_PARTY_IMPORT" + UNMERGE_RECOVERY = "UNMERGE_RECOVERY"end + end +end diff --git a/lib/square/types/customer_creation_source_filter.rb b/lib/square/types/customer_creation_source_filter.rb new file mode 100644 index 000000000..3d9b8c161 --- /dev/null +++ b/lib/square/types/customer_creation_source_filter.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The creation source filter. + # + # If one or more creation sources are set, customer profiles are included in, + # or excluded from, the result if they match at least one of the filter criteria. + class CustomerCreationSourceFilter < Internal::Types::Model + field :values, Internal::Types::Array[Square::Types::CustomerCreationSource], optional: true, nullable: false + field :rule, Square::Types::CustomerInclusionExclusion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_created_event.rb b/lib/square/types/customer_custom_attribute_definition_created_event.rb new file mode 100644 index 000000000..8f8eaa75b --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_created_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # is created by the subscribing application. + # + # This event is replaced by + # [customer.custom_attribute_definition.owned.created](webhook:customer.custom_attribute_definition.owned.created). + class CustomerCustomAttributeDefinitionCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_created_public_event.rb b/lib/square/types/customer_custom_attribute_definition_created_public_event.rb new file mode 100644 index 000000000..81fed79df --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_created_public_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to all applications is created. A notification is sent when any application creates a custom + # attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # This event is replaced by + # [customer.custom_attribute_definition.visible.created](webhook:customer.custom_attribute_definition.visible.created), + # which applies to custom attribute definitions that are visible to the subscribing application. + class CustomerCustomAttributeDefinitionCreatedPublicEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_deleted_event.rb b/lib/square/types/customer_custom_attribute_definition_deleted_event.rb new file mode 100644 index 000000000..11b01b47c --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_deleted_event.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is deleted. A custom attribute definition can only be deleted by + # the application that created it. + # + # This event is replaced by + # [customer.custom_attribute_definition.owned.deleted](webhook:customer.custom_attribute_definition.owned.deleted). + class CustomerCustomAttributeDefinitionDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_deleted_public_event.rb b/lib/square/types/customer_custom_attribute_definition_deleted_public_event.rb new file mode 100644 index 000000000..4a0349419 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_deleted_public_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to all applications is deleted. A notification is sent when any application deletes a custom + # attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # This event is replaced by + # [customer.custom_attribute_definition.visible.deleted](webhook:customer.custom_attribute_definition.visible.deleted), + # which applies to custom attribute definitions that are visible to the subscribing application. + class CustomerCustomAttributeDefinitionDeletedPublicEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_owned_created_event.rb b/lib/square/types/customer_custom_attribute_definition_owned_created_event.rb new file mode 100644 index 000000000..e87aa618b --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_owned_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # is created by the subscribing application. + class CustomerCustomAttributeDefinitionOwnedCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_owned_deleted_event.rb b/lib/square/types/customer_custom_attribute_definition_owned_deleted_event.rb new file mode 100644 index 000000000..e6bc4afe1 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_owned_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is deleted. A custom attribute definition can only be deleted by + # the application that created it. + class CustomerCustomAttributeDefinitionOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_owned_updated_event.rb b/lib/square/types/customer_custom_attribute_definition_owned_updated_event.rb new file mode 100644 index 000000000..bca911501 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_owned_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is updated. A custom attribute definition can only be updated by + # the application that created it. + class CustomerCustomAttributeDefinitionOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_updated_event.rb b/lib/square/types/customer_custom_attribute_definition_updated_event.rb new file mode 100644 index 000000000..4b9bf250b --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_updated_event.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is updated. A custom attribute definition can only be updated by + # the application that created it. + # + # This event is replaced by + # [customer.custom_attribute_definition.owned.updated](webhook:customer.custom_attribute_definition.owned.updated). + class CustomerCustomAttributeDefinitionUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_updated_public_event.rb b/lib/square/types/customer_custom_attribute_definition_updated_public_event.rb new file mode 100644 index 000000000..435726bfe --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_updated_public_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to all applications is updated. A notification is sent when any application updates a custom + # attribute definition whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # This event is replaced by + # [customer.custom_attribute_definition.visible.updated](webhook:customer.custom_attribute_definition.visible.updated), + # which applies to custom attribute definitions that are visible to the subscribing application. + class CustomerCustomAttributeDefinitionUpdatedPublicEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_visible_created_event.rb b/lib/square/types/customer_custom_attribute_definition_visible_created_event.rb new file mode 100644 index 000000000..e959aee3d --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_visible_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is created. A notification is sent when your application + # creates a custom attribute definition or another application creates a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class CustomerCustomAttributeDefinitionVisibleCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_visible_deleted_event.rb b/lib/square/types/customer_custom_attribute_definition_visible_deleted_event.rb new file mode 100644 index 000000000..b8ce79a78 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_visible_deleted_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is deleted. A custom attribute definition can only be deleted + # by the application that created it. A notification is sent when your application deletes a custom attribute + # definition or when another application deletes a custom attribute definition whose `visibility` is + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class CustomerCustomAttributeDefinitionVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_definition_visible_updated_event.rb b/lib/square/types/customer_custom_attribute_definition_visible_updated_event.rb new file mode 100644 index 000000000..eb9097de6 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_definition_visible_updated_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is updated. A custom attribute definition can only be updated + # by the application that created it. A notification is sent when your application updates a custom + # attribute definition or when another application updates a custom attribute definition whose `visibility` is + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class CustomerCustomAttributeDefinitionVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_deleted_event.rb b/lib/square/types/customer_custom_attribute_deleted_event.rb new file mode 100644 index 000000000..1ead1e74e --- /dev/null +++ b/lib/square/types/customer_custom_attribute_deleted_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) owned by the + # subscribing application is deleted. Custom attributes are owned by the application that created the + # corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose + # `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. + # + # This event is replaced by + # [customer.custom_attribute.owned.deleted](webhook:customer.custom_attribute.owned.deleted). + class CustomerCustomAttributeDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_deleted_public_event.rb b/lib/square/types/customer_custom_attribute_deleted_public_event.rb new file mode 100644 index 000000000..a6ce1b338 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_deleted_public_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) that is visible + # to all applications is deleted. A notification is sent when any application deletes a custom attribute + # whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # This event is replaced by + # [customer.custom_attribute.visible.deleted](webhook:customer.custom_attribute.visible.deleted), + # which applies to custom attributes that are visible to the subscribing application. + class CustomerCustomAttributeDeletedPublicEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_filter.rb b/lib/square/types/customer_custom_attribute_filter.rb new file mode 100644 index 000000000..44939a43d --- /dev/null +++ b/lib/square/types/customer_custom_attribute_filter.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The custom attribute filter. Use this filter in a set of [custom attribute filters](entity:CustomerCustomAttributeFilters) to search + # based on the value or last updated date of a customer-related [custom attribute](entity:CustomAttribute). + class CustomerCustomAttributeFilter < Internal::Types::Model + field :key, String, optional: false, nullable: false + field :filter, Square::Types::CustomerCustomAttributeFilterValue, optional: true, nullable: false + field :updated_at, Square::Types::TimeRange, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_filter_value.rb b/lib/square/types/customer_custom_attribute_filter_value.rb new file mode 100644 index 000000000..f8dde4ed4 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_filter_value.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # A type-specific filter used in a [custom attribute filter](entity:CustomerCustomAttributeFilter) to search based on the value + # of a customer-related [custom attribute](entity:CustomAttribute). + class CustomerCustomAttributeFilterValue < Internal::Types::Model + field :email, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :phone, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :text, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :selection, Square::Types::FilterValue, optional: true, nullable: false + field :date, Square::Types::TimeRange, optional: true, nullable: false + field :number, Square::Types::FloatNumberRange, optional: true, nullable: false + field :boolean, Internal::Types::Boolean, optional: true, nullable: false + field :address, Square::Types::CustomerAddressFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_filters.rb b/lib/square/types/customer_custom_attribute_filters.rb new file mode 100644 index 000000000..acd45f965 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_filters.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The custom attribute filters in a set of [customer filters](entity:CustomerFilter) used in a search query. Use this filter + # to search based on [custom attributes](entity:CustomAttribute) that are assigned to customer profiles. For more information, see + # [Search by custom attribute](https://developer.squareup.com/docs/customers-api/use-the-api/search-customers#search-by-custom-attribute). + class CustomerCustomAttributeFilters < Internal::Types::Model + field :filters, Internal::Types::Array[Square::Types::CustomerCustomAttributeFilter], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_owned_deleted_event.rb b/lib/square/types/customer_custom_attribute_owned_deleted_event.rb new file mode 100644 index 000000000..c92c35a1c --- /dev/null +++ b/lib/square/types/customer_custom_attribute_owned_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) owned by the + # subscribing application is deleted. Custom attributes are owned by the application that created the + # corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose + # `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. + class CustomerCustomAttributeOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_owned_updated_event.rb b/lib/square/types/customer_custom_attribute_owned_updated_event.rb new file mode 100644 index 000000000..90bdc3e33 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_owned_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) owned by the + # subscribing application is created or updated. Custom attributes are owned by the application that created + # the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose + # `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. + class CustomerCustomAttributeOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_updated_event.rb b/lib/square/types/customer_custom_attribute_updated_event.rb new file mode 100644 index 000000000..96650eb9d --- /dev/null +++ b/lib/square/types/customer_custom_attribute_updated_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) owned by the + # subscribing application is created or updated. Custom attributes are owned by the application that created + # the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose + # `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. + # + # This event is replaced by + # [customer.custom_attribute.owned.updated](webhook:customer.custom_attribute.owned.updated). + class CustomerCustomAttributeUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_updated_public_event.rb b/lib/square/types/customer_custom_attribute_updated_public_event.rb new file mode 100644 index 000000000..067aee659 --- /dev/null +++ b/lib/square/types/customer_custom_attribute_updated_public_event.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) that is visible + # to all applications is created or updated. A notification is sent when any application creates or updates + # a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + # + # This event is replaced by + # [customer.custom_attribute.visible.updated](webhook:customer.custom_attribute.visible.updated), + # which applies to custom attributes that are visible to the subscribing application. + class CustomerCustomAttributeUpdatedPublicEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_visible_deleted_event.rb b/lib/square/types/customer_custom_attribute_visible_deleted_event.rb new file mode 100644 index 000000000..a9324d81e --- /dev/null +++ b/lib/square/types/customer_custom_attribute_visible_deleted_event.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the + # subscribing application is deleted. A notification is sent when: + # - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting. + # - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` + # or `VISIBILITY_READ_WRITE_VALUES`. + # + # Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to + # `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned + # by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). + class CustomerCustomAttributeVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_custom_attribute_visible_updated_event.rb b/lib/square/types/customer_custom_attribute_visible_updated_event.rb new file mode 100644 index 000000000..4fedb159b --- /dev/null +++ b/lib/square/types/customer_custom_attribute_visible_updated_event.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a customer [custom attribute](entity:CustomAttribute) that is visible to the + # subscribing application is created or updated. A notification is sent when: + # - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting. + # - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` + # or `VISIBILITY_READ_WRITE_VALUES`. + # + # Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to + # `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned + # by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). + class CustomerCustomAttributeVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_deleted_event.rb b/lib/square/types/customer_deleted_event.rb new file mode 100644 index 000000000..879fa7d66 --- /dev/null +++ b/lib/square/types/customer_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [customer](entity:Customer) is deleted. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). + # + # The `customer` object in the event notification does not include the following fields: `group_ids` and `segment_ids`. + class CustomerDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomerDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_deleted_event_data.rb b/lib/square/types/customer_deleted_event_data.rb new file mode 100644 index 000000000..5e57832aa --- /dev/null +++ b/lib/square/types/customer_deleted_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with the event. + class CustomerDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CustomerDeletedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_deleted_event_event_context.rb b/lib/square/types/customer_deleted_event_event_context.rb new file mode 100644 index 000000000..26a4d1622 --- /dev/null +++ b/lib/square/types/customer_deleted_event_event_context.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about the change that triggered the event. + class CustomerDeletedEventEventContext < Internal::Types::Model + field :merge, Square::Types::CustomerDeletedEventEventContextMerge, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_deleted_event_event_context_merge.rb b/lib/square/types/customer_deleted_event_event_context_merge.rb new file mode 100644 index 000000000..1e7ff2342 --- /dev/null +++ b/lib/square/types/customer_deleted_event_event_context_merge.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about a merge operation, which creates a new customer using aggregated properties from two or more existing customers. + class CustomerDeletedEventEventContextMerge < Internal::Types::Model + field :from_customer_ids, Internal::Types::Array[String], optional: true, nullable: false + field :to_customer_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_deleted_event_object.rb b/lib/square/types/customer_deleted_event_object.rb new file mode 100644 index 000000000..fe6345db6 --- /dev/null +++ b/lib/square/types/customer_deleted_event_object.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the customer associated with the event. + class CustomerDeletedEventObject < Internal::Types::Model + field :customer, Square::Types::Customer, optional: true, nullable: false + field :event_context, Square::Types::CustomerDeletedEventEventContext, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_details.rb b/lib/square/types/customer_details.rb new file mode 100644 index 000000000..5bf68587c --- /dev/null +++ b/lib/square/types/customer_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Details about the customer making the payment. + class CustomerDetails < Internal::Types::Model + field :customer_initiated, Internal::Types::Boolean, optional: true, nullable: false + field :seller_keyed_in, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_filter.rb b/lib/square/types/customer_filter.rb new file mode 100644 index 000000000..6b2f3f959 --- /dev/null +++ b/lib/square/types/customer_filter.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the filtering criteria in a [search query](entity:CustomerQuery) that defines how to filter + # customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. + class CustomerFilter < Internal::Types::Model + field :creation_source, Square::Types::CustomerCreationSourceFilter, optional: true, nullable: false + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + field :updated_at, Square::Types::TimeRange, optional: true, nullable: false + field :email_address, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :phone_number, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :reference_id, Square::Types::CustomerTextFilter, optional: true, nullable: false + field :group_ids, Square::Types::FilterValue, optional: true, nullable: false + field :custom_attribute, Square::Types::CustomerCustomAttributeFilters, optional: true, nullable: false + field :segment_ids, Square::Types::FilterValue, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_group.rb b/lib/square/types/customer_group.rb new file mode 100644 index 000000000..ebf485816 --- /dev/null +++ b/lib/square/types/customer_group.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a group of customer profiles. + # + # Customer groups can be created, be modified, and have their membership defined using + # the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. + class CustomerGroup < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: false, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_inclusion_exclusion.rb b/lib/square/types/customer_inclusion_exclusion.rb new file mode 100644 index 000000000..c6cede2e4 --- /dev/null +++ b/lib/square/types/customer_inclusion_exclusion.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CustomerInclusionExclusion + extend Square::Internal::Types::Enum + INCLUDE = "INCLUDE" + EXCLUDE = "EXCLUDE"end + end +end diff --git a/lib/square/types/customer_preferences.rb b/lib/square/types/customer_preferences.rb new file mode 100644 index 000000000..25de7c1bf --- /dev/null +++ b/lib/square/types/customer_preferences.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents communication preferences for the customer profile. + class CustomerPreferences < Internal::Types::Model + field :email_unsubscribed, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_query.rb b/lib/square/types/customer_query.rb new file mode 100644 index 000000000..cde69a8e0 --- /dev/null +++ b/lib/square/types/customer_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents filtering and sorting criteria for a [SearchCustomers](api-endpoint:Customers-SearchCustomers) request. + class CustomerQuery < Internal::Types::Model + field :filter, Square::Types::CustomerFilter, optional: true, nullable: false + field :sort, Square::Types::CustomerSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_segment.rb b/lib/square/types/customer_segment.rb new file mode 100644 index 000000000..466516181 --- /dev/null +++ b/lib/square/types/customer_segment.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a group of customer profiles that match one or more predefined filter criteria. + # + # Segments (also known as Smart Groups) are defined and created within the Customer Directory in the + # Square Seller Dashboard or Point of Sale. + class CustomerSegment < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_sort.rb b/lib/square/types/customer_sort.rb new file mode 100644 index 000000000..ef8fa7d0b --- /dev/null +++ b/lib/square/types/customer_sort.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the sorting criteria in a [search query](entity:CustomerQuery) that defines how to sort + # customer profiles returned in [SearchCustomers](api-endpoint:Customers-SearchCustomers) results. + class CustomerSort < Internal::Types::Model + field :field, Square::Types::CustomerSortField, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_sort_field.rb b/lib/square/types/customer_sort_field.rb new file mode 100644 index 000000000..2c71af283 --- /dev/null +++ b/lib/square/types/customer_sort_field.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module CustomerSortField + extend Square::Internal::Types::Enum + DEFAULT = "DEFAULT" + CREATED_AT = "CREATED_AT"end + end +end diff --git a/lib/square/types/customer_tax_ids.rb b/lib/square/types/customer_tax_ids.rb new file mode 100644 index 000000000..8fc008bf7 --- /dev/null +++ b/lib/square/types/customer_tax_ids.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the tax ID associated with a [customer profile](entity:Customer). The corresponding `tax_ids` field is available only for customers of sellers in EU countries or the United Kingdom. + # For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids). + class CustomerTaxIds < Internal::Types::Model + field :eu_vat, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_text_filter.rb b/lib/square/types/customer_text_filter.rb new file mode 100644 index 000000000..f1afcf3bc --- /dev/null +++ b/lib/square/types/customer_text_filter.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A filter to select customers based on exact or fuzzy matching of + # customer attributes against a specified query. Depending on the customer attributes, + # the filter can be case-sensitive. This filter can be exact or fuzzy, but it cannot be both. + class CustomerTextFilter < Internal::Types::Model + field :exact, String, optional: true, nullable: false + field :fuzzy, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_updated_event.rb b/lib/square/types/customer_updated_event.rb new file mode 100644 index 000000000..b4a4643d5 --- /dev/null +++ b/lib/square/types/customer_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [customer](entity:Customer) is updated. For more information, see [Use Customer Webhooks](https://developer.squareup.com/docs/customers-api/use-the-api/customer-webhooks). + # + # Updates to the 'segment_ids' customer field does not invoke a `customer.updated` event. In addition, the `customer` object in the event notification does not include this field. + class CustomerUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomerUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_updated_event_data.rb b/lib/square/types/customer_updated_event_data.rb new file mode 100644 index 000000000..2038a72ec --- /dev/null +++ b/lib/square/types/customer_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with the event. + class CustomerUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::CustomerUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/customer_updated_event_object.rb b/lib/square/types/customer_updated_event_object.rb new file mode 100644 index 000000000..5af253667 --- /dev/null +++ b/lib/square/types/customer_updated_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the customer associated with the event. + class CustomerUpdatedEventObject < Internal::Types::Model + field :customer, Square::Types::Customer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/data_collection_options.rb b/lib/square/types/data_collection_options.rb new file mode 100644 index 000000000..b0c43e812 --- /dev/null +++ b/lib/square/types/data_collection_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class DataCollectionOptions < Internal::Types::Model + field :title, String, optional: false, nullable: false + field :body, String, optional: false, nullable: false + field :input_type, Square::Types::DataCollectionOptionsInputType, optional: false, nullable: false + field :collected_data, Square::Types::CollectedData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/data_collection_options_input_type.rb b/lib/square/types/data_collection_options_input_type.rb new file mode 100644 index 000000000..c6bf4dbd7 --- /dev/null +++ b/lib/square/types/data_collection_options_input_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module DataCollectionOptionsInputType + extend Square::Internal::Types::Enum + EMAIL = "EMAIL" + PHONE_NUMBER = "PHONE_NUMBER"end + end +end diff --git a/lib/square/types/date_range.rb b/lib/square/types/date_range.rb new file mode 100644 index 000000000..1c687271c --- /dev/null +++ b/lib/square/types/date_range.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A range defined by two dates. Used for filtering a query for Connect v2 + # objects that have date properties. + class DateRange < Internal::Types::Model + field :start_date, String, optional: true, nullable: false + field :end_date, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/day_of_week.rb b/lib/square/types/day_of_week.rb new file mode 100644 index 000000000..a692b3b44 --- /dev/null +++ b/lib/square/types/day_of_week.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module DayOfWeek + extend Square::Internal::Types::Enum + SUN = "SUN" + MON = "MON" + TUE = "TUE" + WED = "WED" + THU = "THU" + FRI = "FRI" + SAT = "SAT"end + end +end diff --git a/lib/square/types/delete_booking_custom_attribute_definition_response.rb b/lib/square/types/delete_booking_custom_attribute_definition_response.rb new file mode 100644 index 000000000..10481fa64 --- /dev/null +++ b/lib/square/types/delete_booking_custom_attribute_definition_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttributeDefinition) response + # containing error messages when errors occurred during the request. The successful response does not contain any payload. + class DeleteBookingCustomAttributeDefinitionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_booking_custom_attribute_response.rb b/lib/square/types/delete_booking_custom_attribute_response.rb new file mode 100644 index 000000000..0cb5b6f73 --- /dev/null +++ b/lib/square/types/delete_booking_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteBookingCustomAttribute](api-endpoint:BookingCustomAttributes-DeleteBookingCustomAttribute) response. + # Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + class DeleteBookingCustomAttributeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_break_type_response.rb b/lib/square/types/delete_break_type_response.rb new file mode 100644 index 000000000..de1e5ffe9 --- /dev/null +++ b/lib/square/types/delete_break_type_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to delete a `BreakType`. The response might contain a set + # of `Error` objects if the request resulted in errors. + class DeleteBreakTypeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_catalog_object_response.rb b/lib/square/types/delete_catalog_object_response.rb new file mode 100644 index 000000000..5cedbb19a --- /dev/null +++ b/lib/square/types/delete_catalog_object_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DeleteCatalogObjectResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :deleted_object_ids, Internal::Types::Array[String], optional: true, nullable: false + field :deleted_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_customer_card_response.rb b/lib/square/types/delete_customer_card_response.rb new file mode 100644 index 000000000..fe8852bf7 --- /dev/null +++ b/lib/square/types/delete_customer_card_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `DeleteCustomerCard` endpoint. + class DeleteCustomerCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_customer_custom_attribute_definition_response.rb b/lib/square/types/delete_customer_custom_attribute_definition_response.rb new file mode 100644 index 000000000..6f4f5e666 --- /dev/null +++ b/lib/square/types/delete_customer_custom_attribute_definition_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a delete request containing error messages if there are any. + class DeleteCustomerCustomAttributeDefinitionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_customer_custom_attribute_response.rb b/lib/square/types/delete_customer_custom_attribute_response.rb new file mode 100644 index 000000000..b3e1fe380 --- /dev/null +++ b/lib/square/types/delete_customer_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-DeleteCustomerCustomAttribute) response. + # Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + class DeleteCustomerCustomAttributeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_customer_group_response.rb b/lib/square/types/delete_customer_group_response.rb new file mode 100644 index 000000000..34f384378 --- /dev/null +++ b/lib/square/types/delete_customer_group_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [DeleteCustomerGroup](api-endpoint:CustomerGroups-DeleteCustomerGroup) endpoint. + class DeleteCustomerGroupResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_customer_response.rb b/lib/square/types/delete_customer_response.rb new file mode 100644 index 000000000..4e8328f67 --- /dev/null +++ b/lib/square/types/delete_customer_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `DeleteCustomer` endpoint. + class DeleteCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_dispute_evidence_response.rb b/lib/square/types/delete_dispute_evidence_response.rb new file mode 100644 index 000000000..5e3d8458d --- /dev/null +++ b/lib/square/types/delete_dispute_evidence_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `DeleteDisputeEvidence` response. + class DeleteDisputeEvidenceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_invoice_attachment_response.rb b/lib/square/types/delete_invoice_attachment_response.rb new file mode 100644 index 000000000..c3a2f880e --- /dev/null +++ b/lib/square/types/delete_invoice_attachment_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteInvoiceAttachment](api-endpoint:Invoices-DeleteInvoiceAttachment) response. + class DeleteInvoiceAttachmentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_invoice_response.rb b/lib/square/types/delete_invoice_response.rb new file mode 100644 index 000000000..2b8c98093 --- /dev/null +++ b/lib/square/types/delete_invoice_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `DeleteInvoice` response. + class DeleteInvoiceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_location_custom_attribute_definition_response.rb b/lib/square/types/delete_location_custom_attribute_definition_response.rb new file mode 100644 index 000000000..a331c59c7 --- /dev/null +++ b/lib/square/types/delete_location_custom_attribute_definition_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a delete request containing error messages if there are any. + class DeleteLocationCustomAttributeDefinitionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_location_custom_attribute_response.rb b/lib/square/types/delete_location_custom_attribute_response.rb new file mode 100644 index 000000000..0438e9c60 --- /dev/null +++ b/lib/square/types/delete_location_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteLocationCustomAttribute](api-endpoint:LocationCustomAttributes-DeleteLocationCustomAttribute) response. + # Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + class DeleteLocationCustomAttributeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_loyalty_reward_response.rb b/lib/square/types/delete_loyalty_reward_response.rb new file mode 100644 index 000000000..623b7fc9b --- /dev/null +++ b/lib/square/types/delete_loyalty_reward_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # A response returned by the API call. + class DeleteLoyaltyRewardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_merchant_custom_attribute_definition_response.rb b/lib/square/types/delete_merchant_custom_attribute_definition_response.rb new file mode 100644 index 000000000..574530345 --- /dev/null +++ b/lib/square/types/delete_merchant_custom_attribute_definition_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a delete request containing error messages if there are any. + class DeleteMerchantCustomAttributeDefinitionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_merchant_custom_attribute_response.rb b/lib/square/types/delete_merchant_custom_attribute_response.rb new file mode 100644 index 000000000..a4ca0a138 --- /dev/null +++ b/lib/square/types/delete_merchant_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [DeleteMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-DeleteMerchantCustomAttribute) response. + # Either an empty object `{}` (for a successful deletion) or `errors` is present in the response. + class DeleteMerchantCustomAttributeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_order_custom_attribute_definition_response.rb b/lib/square/types/delete_order_custom_attribute_definition_response.rb new file mode 100644 index 000000000..70c842d83 --- /dev/null +++ b/lib/square/types/delete_order_custom_attribute_definition_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from deleting an order custom attribute definition. + class DeleteOrderCustomAttributeDefinitionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_order_custom_attribute_response.rb b/lib/square/types/delete_order_custom_attribute_response.rb new file mode 100644 index 000000000..404cbdeaa --- /dev/null +++ b/lib/square/types/delete_order_custom_attribute_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from deleting an order custom attribute. + class DeleteOrderCustomAttributeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_payment_link_response.rb b/lib/square/types/delete_payment_link_response.rb new file mode 100644 index 000000000..1297eacd6 --- /dev/null +++ b/lib/square/types/delete_payment_link_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DeletePaymentLinkResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :cancelled_order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_shift_response.rb b/lib/square/types/delete_shift_response.rb new file mode 100644 index 000000000..4726a1f49 --- /dev/null +++ b/lib/square/types/delete_shift_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to delete a `Shift`. The response might contain a set of + # `Error` objects if the request resulted in errors. + class DeleteShiftResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_snippet_response.rb b/lib/square/types/delete_snippet_response.rb new file mode 100644 index 000000000..9f2eb5a5b --- /dev/null +++ b/lib/square/types/delete_snippet_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a `DeleteSnippet` response. + class DeleteSnippetResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_subscription_action_response.rb b/lib/square/types/delete_subscription_action_response.rb new file mode 100644 index 000000000..66b5844b2 --- /dev/null +++ b/lib/square/types/delete_subscription_action_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response of the [DeleteSubscriptionAction](api-endpoint:Subscriptions-DeleteSubscriptionAction) + # endpoint. + class DeleteSubscriptionActionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_timecard_response.rb b/lib/square/types/delete_timecard_response.rb new file mode 100644 index 000000000..7cf93b176 --- /dev/null +++ b/lib/square/types/delete_timecard_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to delete a `Timecard`. The response might contain a set of + # `Error` objects if the request resulted in errors. + class DeleteTimecardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/delete_webhook_subscription_response.rb b/lib/square/types/delete_webhook_subscription_response.rb new file mode 100644 index 000000000..fb4d8c57b --- /dev/null +++ b/lib/square/types/delete_webhook_subscription_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [DeleteWebhookSubscription](api-endpoint:WebhookSubscriptions-DeleteWebhookSubscription) endpoint. + class DeleteWebhookSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination.rb b/lib/square/types/destination.rb new file mode 100644 index 000000000..a0944a1d5 --- /dev/null +++ b/lib/square/types/destination.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about the destination against which the payout was made. + class Destination < Internal::Types::Model + field :type, Square::Types::DestinationType, optional: true, nullable: false + field :id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination_details.rb b/lib/square/types/destination_details.rb new file mode 100644 index 000000000..c15ea9b31 --- /dev/null +++ b/lib/square/types/destination_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Details about a refund's destination. + class DestinationDetails < Internal::Types::Model + field :card_details, Square::Types::DestinationDetailsCardRefundDetails, optional: true, nullable: false + field :cash_details, Square::Types::DestinationDetailsCashRefundDetails, optional: true, nullable: false + field :external_details, Square::Types::DestinationDetailsExternalRefundDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination_details_card_refund_details.rb b/lib/square/types/destination_details_card_refund_details.rb new file mode 100644 index 000000000..eded6fd8f --- /dev/null +++ b/lib/square/types/destination_details_card_refund_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DestinationDetailsCardRefundDetails < Internal::Types::Model + field :card, Square::Types::Card, optional: true, nullable: false + field :entry_method, String, optional: true, nullable: false + field :auth_result_code, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination_details_cash_refund_details.rb b/lib/square/types/destination_details_cash_refund_details.rb new file mode 100644 index 000000000..abc915c36 --- /dev/null +++ b/lib/square/types/destination_details_cash_refund_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Stores details about a cash refund. Contains only non-confidential information. + class DestinationDetailsCashRefundDetails < Internal::Types::Model + field :seller_supplied_money, Square::Types::Money, optional: false, nullable: false + field :change_back_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination_details_external_refund_details.rb b/lib/square/types/destination_details_external_refund_details.rb new file mode 100644 index 000000000..559b99374 --- /dev/null +++ b/lib/square/types/destination_details_external_refund_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Stores details about an external refund. Contains only non-confidential information. + class DestinationDetailsExternalRefundDetails < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :source, String, optional: false, nullable: false + field :source_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/destination_type.rb b/lib/square/types/destination_type.rb new file mode 100644 index 000000000..80d952972 --- /dev/null +++ b/lib/square/types/destination_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module DestinationType + extend Square::Internal::Types::Enum + BANK_ACCOUNT = "BANK_ACCOUNT" + CARD = "CARD" + SQUARE_BALANCE = "SQUARE_BALANCE" + SQUARE_STORED_BALANCE = "SQUARE_STORED_BALANCE"end + end +end diff --git a/lib/square/types/device.rb b/lib/square/types/device.rb new file mode 100644 index 000000000..ca79dd0d2 --- /dev/null +++ b/lib/square/types/device.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class Device < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :attributes, Square::Types::DeviceAttributes, optional: false, nullable: false + field :components, Internal::Types::Array[Square::Types::Component], optional: true, nullable: false + field :status, Square::Types::DeviceStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_attributes.rb b/lib/square/types/device_attributes.rb new file mode 100644 index 000000000..7df6c721c --- /dev/null +++ b/lib/square/types/device_attributes.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceAttributes < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :manufacturer, String, optional: false, nullable: false + field :model, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :manufacturers_id, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, String, optional: true, nullable: false + field :merchant_token, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_checkout_options.rb b/lib/square/types/device_checkout_options.rb new file mode 100644 index 000000000..30a9b0af2 --- /dev/null +++ b/lib/square/types/device_checkout_options.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCheckoutOptions < Internal::Types::Model + field :device_id, String, optional: false, nullable: false + field :skip_receipt_screen, Internal::Types::Boolean, optional: true, nullable: false + field :collect_signature, Internal::Types::Boolean, optional: true, nullable: false + field :tip_settings, Square::Types::TipSettings, optional: true, nullable: false + field :show_itemized_cart, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_code.rb b/lib/square/types/device_code.rb new file mode 100644 index 000000000..0d91b283a --- /dev/null +++ b/lib/square/types/device_code.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCode < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :code, String, optional: true, nullable: false + field :device_id, String, optional: true, nullable: false + field :product_type, String, optional: false, nullable: false + field :location_id, String, optional: true, nullable: false + field :status, Square::Types::DeviceCodeStatus, optional: true, nullable: false + field :pair_by, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :status_changed_at, String, optional: true, nullable: false + field :paired_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_code_paired_event.rb b/lib/square/types/device_code_paired_event.rb new file mode 100644 index 000000000..4c4b35c68 --- /dev/null +++ b/lib/square/types/device_code_paired_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Square Terminal has been paired with a + # Terminal API client and the device_id of the paired Square Terminal is + # available. + class DeviceCodePairedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DeviceCodePairedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_code_paired_event_data.rb b/lib/square/types/device_code_paired_event_data.rb new file mode 100644 index 000000000..aa664fe18 --- /dev/null +++ b/lib/square/types/device_code_paired_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCodePairedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DeviceCodePairedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_code_paired_event_object.rb b/lib/square/types/device_code_paired_event_object.rb new file mode 100644 index 000000000..ff4056b65 --- /dev/null +++ b/lib/square/types/device_code_paired_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCodePairedEventObject < Internal::Types::Model + field :device_code, Square::Types::DeviceCode, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_code_status.rb b/lib/square/types/device_code_status.rb new file mode 100644 index 000000000..deae03343 --- /dev/null +++ b/lib/square/types/device_code_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module DeviceCodeStatus + extend Square::Internal::Types::Enum + UNKNOWN = "UNKNOWN" + UNPAIRED = "UNPAIRED" + PAIRED = "PAIRED" + EXPIRED = "EXPIRED"end + end +end diff --git a/lib/square/types/device_component_details_application_details.rb b/lib/square/types/device_component_details_application_details.rb new file mode 100644 index 000000000..93359a261 --- /dev/null +++ b/lib/square/types/device_component_details_application_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceComponentDetailsApplicationDetails < Internal::Types::Model + field :application_type, String, optional: true, nullable: false + field :version, String, optional: true, nullable: false + field :session_location, String, optional: true, nullable: false + field :device_code_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_component_details_battery_details.rb b/lib/square/types/device_component_details_battery_details.rb new file mode 100644 index 000000000..c697a7e3d --- /dev/null +++ b/lib/square/types/device_component_details_battery_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceComponentDetailsBatteryDetails < Internal::Types::Model + field :visible_percent, Integer, optional: true, nullable: false + field :external_power, Square::Types::DeviceComponentDetailsExternalPower, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_component_details_card_reader_details.rb b/lib/square/types/device_component_details_card_reader_details.rb new file mode 100644 index 000000000..2494c72b1 --- /dev/null +++ b/lib/square/types/device_component_details_card_reader_details.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceComponentDetailsCardReaderDetails < Internal::Types::Model + field :version, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_component_details_ethernet_details.rb b/lib/square/types/device_component_details_ethernet_details.rb new file mode 100644 index 000000000..d36ccee43 --- /dev/null +++ b/lib/square/types/device_component_details_ethernet_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceComponentDetailsEthernetDetails < Internal::Types::Model + field :active, Internal::Types::Boolean, optional: true, nullable: false + field :ip_address_v_4, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_component_details_external_power.rb b/lib/square/types/device_component_details_external_power.rb new file mode 100644 index 000000000..d4e54501e --- /dev/null +++ b/lib/square/types/device_component_details_external_power.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module DeviceComponentDetailsExternalPower + extend Square::Internal::Types::Enum + AVAILABLE_CHARGING = "AVAILABLE_CHARGING" + AVAILABLE_NOT_IN_USE = "AVAILABLE_NOT_IN_USE" + UNAVAILABLE = "UNAVAILABLE" + AVAILABLE_INSUFFICIENT = "AVAILABLE_INSUFFICIENT"end + end +end diff --git a/lib/square/types/device_component_details_measurement.rb b/lib/square/types/device_component_details_measurement.rb new file mode 100644 index 000000000..d5b19acff --- /dev/null +++ b/lib/square/types/device_component_details_measurement.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # A value qualified by unit of measure. + class DeviceComponentDetailsMeasurement < Internal::Types::Model + field :value, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_component_details_wi_fi_details.rb b/lib/square/types/device_component_details_wi_fi_details.rb new file mode 100644 index 000000000..6ed364663 --- /dev/null +++ b/lib/square/types/device_component_details_wi_fi_details.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceComponentDetailsWiFiDetails < Internal::Types::Model + field :active, Internal::Types::Boolean, optional: true, nullable: false + field :ssid, String, optional: true, nullable: false + field :ip_address_v_4, String, optional: true, nullable: false + field :secure_connection, String, optional: true, nullable: false + field :signal_strength, Square::Types::DeviceComponentDetailsMeasurement, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_created_event.rb b/lib/square/types/device_created_event.rb new file mode 100644 index 000000000..71e9303e0 --- /dev/null +++ b/lib/square/types/device_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Device is created. + class DeviceCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DeviceCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_created_event_data.rb b/lib/square/types/device_created_event_data.rb new file mode 100644 index 000000000..5154834b9 --- /dev/null +++ b/lib/square/types/device_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DeviceCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_created_event_object.rb b/lib/square/types/device_created_event_object.rb new file mode 100644 index 000000000..4baf9abd8 --- /dev/null +++ b/lib/square/types/device_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceCreatedEventObject < Internal::Types::Model + field :device, Square::Types::Device, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_details.rb b/lib/square/types/device_details.rb new file mode 100644 index 000000000..d6f5003a6 --- /dev/null +++ b/lib/square/types/device_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Details about the device that took the payment. + class DeviceDetails < Internal::Types::Model + field :device_id, String, optional: true, nullable: false + field :device_installation_id, String, optional: true, nullable: false + field :device_name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_metadata.rb b/lib/square/types/device_metadata.rb new file mode 100644 index 000000000..5b79ef051 --- /dev/null +++ b/lib/square/types/device_metadata.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceMetadata < Internal::Types::Model + field :battery_percentage, String, optional: true, nullable: false + field :charging_state, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :network_connection_type, String, optional: true, nullable: false + field :payment_region, String, optional: true, nullable: false + field :serial_number, String, optional: true, nullable: false + field :os_version, String, optional: true, nullable: false + field :app_version, String, optional: true, nullable: false + field :wifi_network_name, String, optional: true, nullable: false + field :wifi_network_strength, String, optional: true, nullable: false + field :ip_address, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_status.rb b/lib/square/types/device_status.rb new file mode 100644 index 000000000..1609be0f8 --- /dev/null +++ b/lib/square/types/device_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DeviceStatus < Internal::Types::Model + field :category, Square::Types::DeviceStatusCategory, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/device_status_category.rb b/lib/square/types/device_status_category.rb new file mode 100644 index 000000000..c00b3bfba --- /dev/null +++ b/lib/square/types/device_status_category.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module DeviceStatusCategory + extend Square::Internal::Types::Enum + AVAILABLE = "AVAILABLE" + NEEDS_ATTENTION = "NEEDS_ATTENTION" + OFFLINE = "OFFLINE"end + end +end diff --git a/lib/square/types/digital_wallet_details.rb b/lib/square/types/digital_wallet_details.rb new file mode 100644 index 000000000..6d57f7e7a --- /dev/null +++ b/lib/square/types/digital_wallet_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about `WALLET` type payments. Contains only non-confidential information. + class DigitalWalletDetails < Internal::Types::Model + field :status, String, optional: true, nullable: false + field :brand, String, optional: true, nullable: false + field :cash_app_details, Square::Types::CashAppDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/disable_card_response.rb b/lib/square/types/disable_card_response.rb new file mode 100644 index 000000000..907646c79 --- /dev/null +++ b/lib/square/types/disable_card_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [DisableCard](api-endpoint:Cards-DisableCard) endpoint. + # + # Note: if there are errors processing the request, the card field will not be + # present. + class DisableCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/disable_events_response.rb b/lib/square/types/disable_events_response.rb new file mode 100644 index 000000000..b0bce454b --- /dev/null +++ b/lib/square/types/disable_events_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [DisableEvents](api-endpoint:Events-DisableEvents) endpoint. + # + # Note: if there are errors processing the request, the events field will not be + # present. + class DisableEventsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dismiss_terminal_action_response.rb b/lib/square/types/dismiss_terminal_action_response.rb new file mode 100644 index 000000000..e80c8a6bb --- /dev/null +++ b/lib/square/types/dismiss_terminal_action_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class DismissTerminalActionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dismiss_terminal_checkout_response.rb b/lib/square/types/dismiss_terminal_checkout_response.rb new file mode 100644 index 000000000..1420c93b2 --- /dev/null +++ b/lib/square/types/dismiss_terminal_checkout_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class DismissTerminalCheckoutResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dismiss_terminal_refund_response.rb b/lib/square/types/dismiss_terminal_refund_response.rb new file mode 100644 index 000000000..d84c42e75 --- /dev/null +++ b/lib/square/types/dismiss_terminal_refund_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class DismissTerminalRefundResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute.rb b/lib/square/types/dispute.rb new file mode 100644 index 000000000..d5c96e639 --- /dev/null +++ b/lib/square/types/dispute.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [dispute](https://developer.squareup.com/docs/disputes-api/overview) a cardholder initiated with their bank. + class Dispute < Internal::Types::Model + field :dispute_id, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :reason, Square::Types::DisputeReason, optional: true, nullable: false + field :state, Square::Types::DisputeState, optional: true, nullable: false + field :due_at, String, optional: true, nullable: false + field :disputed_payment, Square::Types::DisputedPayment, optional: true, nullable: false + field :evidence_ids, Internal::Types::Array[String], optional: true, nullable: false + field :card_brand, Square::Types::CardBrand, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :brand_dispute_id, String, optional: true, nullable: false + field :reported_date, String, optional: true, nullable: false + field :reported_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_created_event.rb b/lib/square/types/dispute_created_event.rb new file mode 100644 index 000000000..41e42c762 --- /dev/null +++ b/lib/square/types/dispute_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Dispute](entity:Dispute) is created. + class DisputeCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_created_event_data.rb b/lib/square/types/dispute_created_event_data.rb new file mode 100644 index 000000000..d3074d776 --- /dev/null +++ b/lib/square/types/dispute_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_created_event_object.rb b/lib/square/types/dispute_created_event_object.rb new file mode 100644 index 000000000..727dff05d --- /dev/null +++ b/lib/square/types/dispute_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeCreatedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence.rb b/lib/square/types/dispute_evidence.rb new file mode 100644 index 000000000..4c633fffd --- /dev/null +++ b/lib/square/types/dispute_evidence.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidence < Internal::Types::Model + field :evidence_id, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :dispute_id, String, optional: true, nullable: false + field :evidence_file, Square::Types::DisputeEvidenceFile, optional: true, nullable: false + field :evidence_text, String, optional: true, nullable: false + field :uploaded_at, String, optional: true, nullable: false + field :evidence_type, Square::Types::DisputeEvidenceType, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_added_event.rb b/lib/square/types/dispute_evidence_added_event.rb new file mode 100644 index 000000000..73ebad177 --- /dev/null +++ b/lib/square/types/dispute_evidence_added_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when evidence is added to a [Dispute](entity:Dispute) + # from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, + # or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText). + class DisputeEvidenceAddedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeEvidenceAddedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_added_event_data.rb b/lib/square/types/dispute_evidence_added_event_data.rb new file mode 100644 index 000000000..bf50bc03e --- /dev/null +++ b/lib/square/types/dispute_evidence_added_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceAddedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeEvidenceAddedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_added_event_object.rb b/lib/square/types/dispute_evidence_added_event_object.rb new file mode 100644 index 000000000..96916c1b3 --- /dev/null +++ b/lib/square/types/dispute_evidence_added_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceAddedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_created_event.rb b/lib/square/types/dispute_evidence_created_event.rb new file mode 100644 index 000000000..db60f235c --- /dev/null +++ b/lib/square/types/dispute_evidence_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when evidence is added to a [Dispute](entity:Dispute) + # from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, + # or by calling either [CreateDisputeEvidenceFile](api-endpoint:Disputes-CreateDisputeEvidenceFile) or [CreateDisputeEvidenceText](api-endpoint:Disputes-CreateDisputeEvidenceText). + class DisputeEvidenceCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeEvidenceCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_created_event_data.rb b/lib/square/types/dispute_evidence_created_event_data.rb new file mode 100644 index 000000000..ce52e3e36 --- /dev/null +++ b/lib/square/types/dispute_evidence_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeEvidenceCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_created_event_object.rb b/lib/square/types/dispute_evidence_created_event_object.rb new file mode 100644 index 000000000..9873209d2 --- /dev/null +++ b/lib/square/types/dispute_evidence_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceCreatedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_deleted_event.rb b/lib/square/types/dispute_evidence_deleted_event.rb new file mode 100644 index 000000000..5352c8792 --- /dev/null +++ b/lib/square/types/dispute_evidence_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when evidence is removed from a [Dispute](entity:Dispute) + # from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, + # or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence). + class DisputeEvidenceDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeEvidenceDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_deleted_event_data.rb b/lib/square/types/dispute_evidence_deleted_event_data.rb new file mode 100644 index 000000000..8661d4e7c --- /dev/null +++ b/lib/square/types/dispute_evidence_deleted_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeEvidenceDeletedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_deleted_event_object.rb b/lib/square/types/dispute_evidence_deleted_event_object.rb new file mode 100644 index 000000000..4fdf328d4 --- /dev/null +++ b/lib/square/types/dispute_evidence_deleted_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceDeletedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_file.rb b/lib/square/types/dispute_evidence_file.rb new file mode 100644 index 000000000..a6e3c7ba5 --- /dev/null +++ b/lib/square/types/dispute_evidence_file.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A file to be uploaded as dispute evidence. + class DisputeEvidenceFile < Internal::Types::Model + field :filename, String, optional: true, nullable: false + field :filetype, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_removed_event.rb b/lib/square/types/dispute_evidence_removed_event.rb new file mode 100644 index 000000000..a6810018e --- /dev/null +++ b/lib/square/types/dispute_evidence_removed_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when evidence is removed from a [Dispute](entity:Dispute) + # from the Disputes Dashboard in the Seller Dashboard, the Square Point of Sale app, + # or by calling [DeleteDisputeEvidence](api-endpoint:Disputes-DeleteDisputeEvidence). + class DisputeEvidenceRemovedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeEvidenceRemovedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_removed_event_data.rb b/lib/square/types/dispute_evidence_removed_event_data.rb new file mode 100644 index 000000000..3da57d370 --- /dev/null +++ b/lib/square/types/dispute_evidence_removed_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceRemovedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeEvidenceRemovedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_removed_event_object.rb b/lib/square/types/dispute_evidence_removed_event_object.rb new file mode 100644 index 000000000..74019b24f --- /dev/null +++ b/lib/square/types/dispute_evidence_removed_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeEvidenceRemovedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_evidence_type.rb b/lib/square/types/dispute_evidence_type.rb new file mode 100644 index 000000000..d671f31b9 --- /dev/null +++ b/lib/square/types/dispute_evidence_type.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + module DisputeEvidenceType + extend Square::Internal::Types::Enum + GENERIC_EVIDENCE = "GENERIC_EVIDENCE" + ONLINE_OR_APP_ACCESS_LOG = "ONLINE_OR_APP_ACCESS_LOG" + AUTHORIZATION_DOCUMENTATION = "AUTHORIZATION_DOCUMENTATION" + CANCELLATION_OR_REFUND_DOCUMENTATION = "CANCELLATION_OR_REFUND_DOCUMENTATION" + CARDHOLDER_COMMUNICATION = "CARDHOLDER_COMMUNICATION" + CARDHOLDER_INFORMATION = "CARDHOLDER_INFORMATION" + PURCHASE_ACKNOWLEDGEMENT = "PURCHASE_ACKNOWLEDGEMENT" + DUPLICATE_CHARGE_DOCUMENTATION = "DUPLICATE_CHARGE_DOCUMENTATION" + PRODUCT_OR_SERVICE_DESCRIPTION = "PRODUCT_OR_SERVICE_DESCRIPTION" + RECEIPT = "RECEIPT" + SERVICE_RECEIVED_DOCUMENTATION = "SERVICE_RECEIVED_DOCUMENTATION" + PROOF_OF_DELIVERY_DOCUMENTATION = "PROOF_OF_DELIVERY_DOCUMENTATION" + RELATED_TRANSACTION_DOCUMENTATION = "RELATED_TRANSACTION_DOCUMENTATION" + REBUTTAL_EXPLANATION = "REBUTTAL_EXPLANATION" + TRACKING_NUMBER = "TRACKING_NUMBER"end + end +end diff --git a/lib/square/types/dispute_reason.rb b/lib/square/types/dispute_reason.rb new file mode 100644 index 000000000..d32a8252c --- /dev/null +++ b/lib/square/types/dispute_reason.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + module DisputeReason + extend Square::Internal::Types::Enum + AMOUNT_DIFFERS = "AMOUNT_DIFFERS" + CANCELLED = "CANCELLED" + DUPLICATE = "DUPLICATE" + NO_KNOWLEDGE = "NO_KNOWLEDGE" + NOT_AS_DESCRIBED = "NOT_AS_DESCRIBED" + NOT_RECEIVED = "NOT_RECEIVED" + PAID_BY_OTHER_MEANS = "PAID_BY_OTHER_MEANS" + CUSTOMER_REQUESTS_CREDIT = "CUSTOMER_REQUESTS_CREDIT" + EMV_LIABILITY_SHIFT = "EMV_LIABILITY_SHIFT"end + end +end diff --git a/lib/square/types/dispute_state.rb b/lib/square/types/dispute_state.rb new file mode 100644 index 000000000..4e61f93c9 --- /dev/null +++ b/lib/square/types/dispute_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module DisputeState + extend Square::Internal::Types::Enum + INQUIRY_EVIDENCE_REQUIRED = "INQUIRY_EVIDENCE_REQUIRED" + INQUIRY_PROCESSING = "INQUIRY_PROCESSING" + INQUIRY_CLOSED = "INQUIRY_CLOSED" + EVIDENCE_REQUIRED = "EVIDENCE_REQUIRED" + PROCESSING = "PROCESSING" + WON = "WON" + LOST = "LOST" + ACCEPTED = "ACCEPTED"end + end +end diff --git a/lib/square/types/dispute_state_changed_event.rb b/lib/square/types/dispute_state_changed_event.rb new file mode 100644 index 000000000..c17c8ece1 --- /dev/null +++ b/lib/square/types/dispute_state_changed_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when the state of a [Dispute](entity:Dispute) changes. + # This includes the dispute resolution (WON, LOST) reported by the bank. The event + # data includes details of what changed. + class DisputeStateChangedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeStateChangedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_state_changed_event_data.rb b/lib/square/types/dispute_state_changed_event_data.rb new file mode 100644 index 000000000..4425fb0d3 --- /dev/null +++ b/lib/square/types/dispute_state_changed_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeStateChangedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeStateChangedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_state_changed_event_object.rb b/lib/square/types/dispute_state_changed_event_object.rb new file mode 100644 index 000000000..b34a535be --- /dev/null +++ b/lib/square/types/dispute_state_changed_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeStateChangedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_state_updated_event.rb b/lib/square/types/dispute_state_updated_event.rb new file mode 100644 index 000000000..4c781c3bb --- /dev/null +++ b/lib/square/types/dispute_state_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when the state of a [Dispute](entity:Dispute) changes. + # This includes the dispute resolution (WON, LOST) reported by the bank. The event + # data includes details of what changed. + class DisputeStateUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::DisputeStateUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_state_updated_event_data.rb b/lib/square/types/dispute_state_updated_event_data.rb new file mode 100644 index 000000000..54f5d213e --- /dev/null +++ b/lib/square/types/dispute_state_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeStateUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::DisputeStateUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/dispute_state_updated_event_object.rb b/lib/square/types/dispute_state_updated_event_object.rb new file mode 100644 index 000000000..740b9ab0f --- /dev/null +++ b/lib/square/types/dispute_state_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class DisputeStateUpdatedEventObject < Internal::Types::Model + field :object, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/disputed_payment.rb b/lib/square/types/disputed_payment.rb new file mode 100644 index 000000000..63a83a797 --- /dev/null +++ b/lib/square/types/disputed_payment.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The payment the cardholder disputed. + class DisputedPayment < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/ecom_visibility.rb b/lib/square/types/ecom_visibility.rb new file mode 100644 index 000000000..91857ea3b --- /dev/null +++ b/lib/square/types/ecom_visibility.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module EcomVisibility + extend Square::Internal::Types::Enum + UNINDEXED = "UNINDEXED" + UNAVAILABLE = "UNAVAILABLE" + HIDDEN = "HIDDEN" + VISIBLE = "VISIBLE"end + end +end diff --git a/lib/square/types/employee.rb b/lib/square/types/employee.rb new file mode 100644 index 000000000..22523ac56 --- /dev/null +++ b/lib/square/types/employee.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + # An employee object that is used by the external API. + # + # DEPRECATED at version 2020-08-26. Replaced by [TeamMember](entity:TeamMember). + class Employee < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :first_name, String, optional: true, nullable: false + field :last_name, String, optional: true, nullable: false + field :email, String, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :status, Square::Types::EmployeeStatus, optional: true, nullable: false + field :is_owner, Internal::Types::Boolean, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/employee_status.rb b/lib/square/types/employee_status.rb new file mode 100644 index 000000000..40e82e115 --- /dev/null +++ b/lib/square/types/employee_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module EmployeeStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + INACTIVE = "INACTIVE"end + end +end diff --git a/lib/square/types/employee_wage.rb b/lib/square/types/employee_wage.rb new file mode 100644 index 000000000..2e22424f0 --- /dev/null +++ b/lib/square/types/employee_wage.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). + class EmployeeWage < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :title, String, optional: true, nullable: false + field :hourly_rate, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/enable_events_response.rb b/lib/square/types/enable_events_response.rb new file mode 100644 index 000000000..b89f7fe23 --- /dev/null +++ b/lib/square/types/enable_events_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [EnableEvents](api-endpoint:Events-EnableEvents) endpoint. + # + # Note: if there are errors processing the request, the events field will not be + # present. + class EnableEventsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/error.rb b/lib/square/types/error.rb new file mode 100644 index 000000000..0423b8acb --- /dev/null +++ b/lib/square/types/error.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an error encountered during a request to the Connect API. + # + # See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. + class Error < Internal::Types::Model + field :category, Square::Types::ErrorCategory, optional: false, nullable: false + field :code, Square::Types::ErrorCode, optional: false, nullable: false + field :detail, String, optional: true, nullable: false + field :field, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/error_category.rb b/lib/square/types/error_category.rb new file mode 100644 index 000000000..6d856882b --- /dev/null +++ b/lib/square/types/error_category.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module ErrorCategory + extend Square::Internal::Types::Enum + API_ERROR = "API_ERROR" + AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR" + INVALID_REQUEST_ERROR = "INVALID_REQUEST_ERROR" + RATE_LIMIT_ERROR = "RATE_LIMIT_ERROR" + PAYMENT_METHOD_ERROR = "PAYMENT_METHOD_ERROR" + REFUND_ERROR = "REFUND_ERROR" + MERCHANT_SUBSCRIPTION_ERROR = "MERCHANT_SUBSCRIPTION_ERROR" + EXTERNAL_VENDOR_ERROR = "EXTERNAL_VENDOR_ERROR"end + end +end diff --git a/lib/square/types/error_code.rb b/lib/square/types/error_code.rb new file mode 100644 index 000000000..1e386d214 --- /dev/null +++ b/lib/square/types/error_code.rb @@ -0,0 +1,161 @@ +# frozen_string_literal: true + +module Square + module Types + module ErrorCode + extend Square::Internal::Types::Enum + INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR" + UNAUTHORIZED = "UNAUTHORIZED" + ACCESS_TOKEN_EXPIRED = "ACCESS_TOKEN_EXPIRED" + ACCESS_TOKEN_REVOKED = "ACCESS_TOKEN_REVOKED" + CLIENT_DISABLED = "CLIENT_DISABLED" + FORBIDDEN = "FORBIDDEN" + INSUFFICIENT_SCOPES = "INSUFFICIENT_SCOPES" + APPLICATION_DISABLED = "APPLICATION_DISABLED" + V_1_APPLICATION = "V1_APPLICATION" + V_1_ACCESS_TOKEN = "V1_ACCESS_TOKEN" + CARD_PROCESSING_NOT_ENABLED = "CARD_PROCESSING_NOT_ENABLED" + MERCHANT_SUBSCRIPTION_NOT_FOUND = "MERCHANT_SUBSCRIPTION_NOT_FOUND" + BAD_REQUEST = "BAD_REQUEST" + MISSING_REQUIRED_PARAMETER = "MISSING_REQUIRED_PARAMETER" + INCORRECT_TYPE = "INCORRECT_TYPE" + INVALID_TIME = "INVALID_TIME" + INVALID_TIME_RANGE = "INVALID_TIME_RANGE" + INVALID_VALUE = "INVALID_VALUE" + INVALID_CURSOR = "INVALID_CURSOR" + UNKNOWN_QUERY_PARAMETER = "UNKNOWN_QUERY_PARAMETER" + CONFLICTING_PARAMETERS = "CONFLICTING_PARAMETERS" + EXPECTED_JSON_BODY = "EXPECTED_JSON_BODY" + INVALID_SORT_ORDER = "INVALID_SORT_ORDER" + VALUE_REGEX_MISMATCH = "VALUE_REGEX_MISMATCH" + VALUE_TOO_SHORT = "VALUE_TOO_SHORT" + VALUE_TOO_LONG = "VALUE_TOO_LONG" + VALUE_TOO_LOW = "VALUE_TOO_LOW" + VALUE_TOO_HIGH = "VALUE_TOO_HIGH" + VALUE_EMPTY = "VALUE_EMPTY" + ARRAY_LENGTH_TOO_LONG = "ARRAY_LENGTH_TOO_LONG" + ARRAY_LENGTH_TOO_SHORT = "ARRAY_LENGTH_TOO_SHORT" + ARRAY_EMPTY = "ARRAY_EMPTY" + EXPECTED_BOOLEAN = "EXPECTED_BOOLEAN" + EXPECTED_INTEGER = "EXPECTED_INTEGER" + EXPECTED_FLOAT = "EXPECTED_FLOAT" + EXPECTED_STRING = "EXPECTED_STRING" + EXPECTED_OBJECT = "EXPECTED_OBJECT" + EXPECTED_ARRAY = "EXPECTED_ARRAY" + EXPECTED_MAP = "EXPECTED_MAP" + EXPECTED_BASE_64_ENCODED_BYTE_ARRAY = "EXPECTED_BASE64_ENCODED_BYTE_ARRAY" + INVALID_ARRAY_VALUE = "INVALID_ARRAY_VALUE" + INVALID_ENUM_VALUE = "INVALID_ENUM_VALUE" + INVALID_CONTENT_TYPE = "INVALID_CONTENT_TYPE" + INVALID_FORM_VALUE = "INVALID_FORM_VALUE" + CUSTOMER_NOT_FOUND = "CUSTOMER_NOT_FOUND" + ONE_INSTRUMENT_EXPECTED = "ONE_INSTRUMENT_EXPECTED" + NO_FIELDS_SET = "NO_FIELDS_SET" + TOO_MANY_MAP_ENTRIES = "TOO_MANY_MAP_ENTRIES" + MAP_KEY_LENGTH_TOO_SHORT = "MAP_KEY_LENGTH_TOO_SHORT" + MAP_KEY_LENGTH_TOO_LONG = "MAP_KEY_LENGTH_TOO_LONG" + CUSTOMER_MISSING_NAME = "CUSTOMER_MISSING_NAME" + CUSTOMER_MISSING_EMAIL = "CUSTOMER_MISSING_EMAIL" + INVALID_PAUSE_LENGTH = "INVALID_PAUSE_LENGTH" + INVALID_DATE = "INVALID_DATE" + UNSUPPORTED_COUNTRY = "UNSUPPORTED_COUNTRY" + UNSUPPORTED_CURRENCY = "UNSUPPORTED_CURRENCY" + APPLE_TTP_PIN_TOKEN = "APPLE_TTP_PIN_TOKEN" + CARD_EXPIRED = "CARD_EXPIRED" + INVALID_EXPIRATION = "INVALID_EXPIRATION" + INVALID_EXPIRATION_YEAR = "INVALID_EXPIRATION_YEAR" + INVALID_EXPIRATION_DATE = "INVALID_EXPIRATION_DATE" + UNSUPPORTED_CARD_BRAND = "UNSUPPORTED_CARD_BRAND" + UNSUPPORTED_ENTRY_METHOD = "UNSUPPORTED_ENTRY_METHOD" + INVALID_ENCRYPTED_CARD = "INVALID_ENCRYPTED_CARD" + INVALID_CARD = "INVALID_CARD" + PAYMENT_AMOUNT_MISMATCH = "PAYMENT_AMOUNT_MISMATCH" + GENERIC_DECLINE = "GENERIC_DECLINE" + CVV_FAILURE = "CVV_FAILURE" + ADDRESS_VERIFICATION_FAILURE = "ADDRESS_VERIFICATION_FAILURE" + INVALID_ACCOUNT = "INVALID_ACCOUNT" + CURRENCY_MISMATCH = "CURRENCY_MISMATCH" + INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS" + INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS" + CARDHOLDER_INSUFFICIENT_PERMISSIONS = "CARDHOLDER_INSUFFICIENT_PERMISSIONS" + INVALID_LOCATION = "INVALID_LOCATION" + TRANSACTION_LIMIT = "TRANSACTION_LIMIT" + VOICE_FAILURE = "VOICE_FAILURE" + PAN_FAILURE = "PAN_FAILURE" + EXPIRATION_FAILURE = "EXPIRATION_FAILURE" + CARD_NOT_SUPPORTED = "CARD_NOT_SUPPORTED" + READER_DECLINED = "READER_DECLINED" + INVALID_PIN = "INVALID_PIN" + MISSING_PIN = "MISSING_PIN" + MISSING_ACCOUNT_TYPE = "MISSING_ACCOUNT_TYPE" + INVALID_POSTAL_CODE = "INVALID_POSTAL_CODE" + INVALID_FEES = "INVALID_FEES" + MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED = "MANUALLY_ENTERED_PAYMENT_NOT_SUPPORTED" + PAYMENT_LIMIT_EXCEEDED = "PAYMENT_LIMIT_EXCEEDED" + GIFT_CARD_AVAILABLE_AMOUNT = "GIFT_CARD_AVAILABLE_AMOUNT" + ACCOUNT_UNUSABLE = "ACCOUNT_UNUSABLE" + BUYER_REFUSED_PAYMENT = "BUYER_REFUSED_PAYMENT" + DELAYED_TRANSACTION_EXPIRED = "DELAYED_TRANSACTION_EXPIRED" + DELAYED_TRANSACTION_CANCELED = "DELAYED_TRANSACTION_CANCELED" + DELAYED_TRANSACTION_CAPTURED = "DELAYED_TRANSACTION_CAPTURED" + DELAYED_TRANSACTION_FAILED = "DELAYED_TRANSACTION_FAILED" + CARD_TOKEN_EXPIRED = "CARD_TOKEN_EXPIRED" + CARD_TOKEN_USED = "CARD_TOKEN_USED" + AMOUNT_TOO_HIGH = "AMOUNT_TOO_HIGH" + UNSUPPORTED_INSTRUMENT_TYPE = "UNSUPPORTED_INSTRUMENT_TYPE" + REFUND_AMOUNT_INVALID = "REFUND_AMOUNT_INVALID" + REFUND_ALREADY_PENDING = "REFUND_ALREADY_PENDING" + PAYMENT_NOT_REFUNDABLE = "PAYMENT_NOT_REFUNDABLE" + PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE = "PAYMENT_NOT_REFUNDABLE_DUE_TO_DISPUTE" + REFUND_ERROR_PAYMENT_NEEDS_COMPLETION = "REFUND_ERROR_PAYMENT_NEEDS_COMPLETION" + REFUND_DECLINED = "REFUND_DECLINED" + INSUFFICIENT_PERMISSIONS_FOR_REFUND = "INSUFFICIENT_PERMISSIONS_FOR_REFUND" + INVALID_CARD_DATA = "INVALID_CARD_DATA" + SOURCE_USED = "SOURCE_USED" + SOURCE_EXPIRED = "SOURCE_EXPIRED" + UNSUPPORTED_LOYALTY_REWARD_TIER = "UNSUPPORTED_LOYALTY_REWARD_TIER" + LOCATION_MISMATCH = "LOCATION_MISMATCH" + ORDER_UNPAID_NOT_RETURNABLE = "ORDER_UNPAID_NOT_RETURNABLE" + IDEMPOTENCY_KEY_REUSED = "IDEMPOTENCY_KEY_REUSED" + UNEXPECTED_VALUE = "UNEXPECTED_VALUE" + SANDBOX_NOT_SUPPORTED = "SANDBOX_NOT_SUPPORTED" + INVALID_EMAIL_ADDRESS = "INVALID_EMAIL_ADDRESS" + INVALID_PHONE_NUMBER = "INVALID_PHONE_NUMBER" + CHECKOUT_EXPIRED = "CHECKOUT_EXPIRED" + BAD_CERTIFICATE = "BAD_CERTIFICATE" + INVALID_SQUARE_VERSION_FORMAT = "INVALID_SQUARE_VERSION_FORMAT" + API_VERSION_INCOMPATIBLE = "API_VERSION_INCOMPATIBLE" + CARD_PRESENCE_REQUIRED = "CARD_PRESENCE_REQUIRED" + UNSUPPORTED_SOURCE_TYPE = "UNSUPPORTED_SOURCE_TYPE" + CARD_MISMATCH = "CARD_MISMATCH" + PLAID_ERROR = "PLAID_ERROR" + PLAID_ERROR_ITEM_LOGIN_REQUIRED = "PLAID_ERROR_ITEM_LOGIN_REQUIRED" + PLAID_ERROR_RATE_LIMIT = "PLAID_ERROR_RATE_LIMIT" + CARD_DECLINED = "CARD_DECLINED" + VERIFY_CVV_FAILURE = "VERIFY_CVV_FAILURE" + VERIFY_AVS_FAILURE = "VERIFY_AVS_FAILURE" + CARD_DECLINED_CALL_ISSUER = "CARD_DECLINED_CALL_ISSUER" + CARD_DECLINED_VERIFICATION_REQUIRED = "CARD_DECLINED_VERIFICATION_REQUIRED" + BAD_EXPIRATION = "BAD_EXPIRATION" + CHIP_INSERTION_REQUIRED = "CHIP_INSERTION_REQUIRED" + ALLOWABLE_PIN_TRIES_EXCEEDED = "ALLOWABLE_PIN_TRIES_EXCEEDED" + RESERVATION_DECLINED = "RESERVATION_DECLINED" + UNKNOWN_BODY_PARAMETER = "UNKNOWN_BODY_PARAMETER" + NOT_FOUND = "NOT_FOUND" + APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND = "APPLE_PAYMENT_PROCESSING_CERTIFICATE_HASH_NOT_FOUND" + METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED" + NOT_ACCEPTABLE = "NOT_ACCEPTABLE" + REQUEST_TIMEOUT = "REQUEST_TIMEOUT" + CONFLICT = "CONFLICT" + GONE = "GONE" + REQUEST_ENTITY_TOO_LARGE = "REQUEST_ENTITY_TOO_LARGE" + UNSUPPORTED_MEDIA_TYPE = "UNSUPPORTED_MEDIA_TYPE" + UNPROCESSABLE_ENTITY = "UNPROCESSABLE_ENTITY" + RATE_LIMITED = "RATE_LIMITED" + NOT_IMPLEMENTED = "NOT_IMPLEMENTED" + BAD_GATEWAY = "BAD_GATEWAY" + SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE" + TEMPORARY_ERROR = "TEMPORARY_ERROR" + GATEWAY_TIMEOUT = "GATEWAY_TIMEOUT"end + end +end diff --git a/lib/square/types/event.rb b/lib/square/types/event.rb new file mode 100644 index 000000000..7cea184f5 --- /dev/null +++ b/lib/square/types/event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + class Event < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::EventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/event_data.rb b/lib/square/types/event_data.rb new file mode 100644 index 000000000..c46c21c96 --- /dev/null +++ b/lib/square/types/event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class EventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :deleted, Internal::Types::Boolean, optional: true, nullable: false + field :object, Internal::Types::Hash[String, Internal::Types::Hash[String, ]], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/event_metadata.rb b/lib/square/types/event_metadata.rb new file mode 100644 index 000000000..4da3853ed --- /dev/null +++ b/lib/square/types/event_metadata.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains metadata about a particular [Event](entity:Event). + class EventMetadata < Internal::Types::Model + field :event_id, String, optional: true, nullable: false + field :api_version, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/event_type_metadata.rb b/lib/square/types/event_type_metadata.rb new file mode 100644 index 000000000..800a96722 --- /dev/null +++ b/lib/square/types/event_type_metadata.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains the metadata of a webhook event type. + class EventTypeMetadata < Internal::Types::Model + field :event_type, String, optional: true, nullable: false + field :api_version_introduced, String, optional: true, nullable: false + field :release_status, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/exclude_strategy.rb b/lib/square/types/exclude_strategy.rb new file mode 100644 index 000000000..7dbc8077f --- /dev/null +++ b/lib/square/types/exclude_strategy.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ExcludeStrategy + extend Square::Internal::Types::Enum + LEAST_EXPENSIVE = "LEAST_EXPENSIVE" + MOST_EXPENSIVE = "MOST_EXPENSIVE"end + end +end diff --git a/lib/square/types/external_payment_details.rb b/lib/square/types/external_payment_details.rb new file mode 100644 index 000000000..1bcc5bc9f --- /dev/null +++ b/lib/square/types/external_payment_details.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Stores details about an external payment. Contains only non-confidential information. + # For more information, see + # [Take External Payments](https://developer.squareup.com/docs/payments-api/take-payments/external-payments). + class ExternalPaymentDetails < Internal::Types::Model + field :type, String, optional: false, nullable: false + field :source, String, optional: false, nullable: false + field :source_id, String, optional: true, nullable: false + field :source_fee_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/filter_value.rb b/lib/square/types/filter_value.rb new file mode 100644 index 000000000..2df5b9b39 --- /dev/null +++ b/lib/square/types/filter_value.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # A filter to select resources based on an exact field value. For any given + # value, the value can only be in one property. Depending on the field, either + # all properties can be set or only a subset will be available. + # + # Refer to the documentation of the field. + class FilterValue < Internal::Types::Model + field :all, Internal::Types::Array[String], optional: true, nullable: false + field :any, Internal::Types::Array[String], optional: true, nullable: false + field :none, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/float_number_range.rb b/lib/square/types/float_number_range.rb new file mode 100644 index 000000000..1427d8186 --- /dev/null +++ b/lib/square/types/float_number_range.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Specifies a decimal number range. + class FloatNumberRange < Internal::Types::Model + field :start_at, String, optional: true, nullable: false + field :end_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment.rb b/lib/square/types/fulfillment.rb new file mode 100644 index 000000000..020b1bcc1 --- /dev/null +++ b/lib/square/types/fulfillment.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains details about how to fulfill this order. + # Orders can only be created with at most one fulfillment using the API. + # However, orders returned by the Orders API might contain multiple fulfillments because sellers can create multiple fulfillments using Square products such as Square Online. + class Fulfillment < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :type, Square::Types::FulfillmentType, optional: true, nullable: false + field :state, Square::Types::FulfillmentState, optional: true, nullable: false + field :line_item_application, Square::Types::FulfillmentFulfillmentLineItemApplication, optional: true, nullable: false + field :entries, Internal::Types::Array[Square::Types::FulfillmentFulfillmentEntry], optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :pickup_details, Square::Types::FulfillmentPickupDetails, optional: true, nullable: false + field :shipment_details, Square::Types::FulfillmentShipmentDetails, optional: true, nullable: false + field :delivery_details, Square::Types::FulfillmentDeliveryDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_delivery_details.rb b/lib/square/types/fulfillment_delivery_details.rb new file mode 100644 index 000000000..12f092117 --- /dev/null +++ b/lib/square/types/fulfillment_delivery_details.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes delivery details of an order fulfillment. + class FulfillmentDeliveryDetails < Internal::Types::Model + field :recipient, Square::Types::FulfillmentRecipient, optional: true, nullable: false + field :schedule_type, Square::Types::FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType, optional: true, nullable: false + field :placed_at, String, optional: true, nullable: false + field :deliver_at, String, optional: true, nullable: false + field :prep_time_duration, String, optional: true, nullable: false + field :delivery_window_duration, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :completed_at, String, optional: true, nullable: false + field :in_progress_at, String, optional: true, nullable: false + field :rejected_at, String, optional: true, nullable: false + field :ready_at, String, optional: true, nullable: false + field :delivered_at, String, optional: true, nullable: false + field :canceled_at, String, optional: true, nullable: false + field :cancel_reason, String, optional: true, nullable: false + field :courier_pickup_at, String, optional: true, nullable: false + field :courier_pickup_window_duration, String, optional: true, nullable: false + field :is_no_contact_delivery, Internal::Types::Boolean, optional: true, nullable: false + field :dropoff_notes, String, optional: true, nullable: false + field :courier_provider_name, String, optional: true, nullable: false + field :courier_support_phone_number, String, optional: true, nullable: false + field :square_delivery_id, String, optional: true, nullable: false + field :external_delivery_id, String, optional: true, nullable: false + field :managed_delivery, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.rb b/lib/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.rb new file mode 100644 index 000000000..ae92799e8 --- /dev/null +++ b/lib/square/types/fulfillment_delivery_details_order_fulfillment_delivery_details_schedule_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType + extend Square::Internal::Types::Enum + SCHEDULED = "SCHEDULED" + ASAP = "ASAP"end + end +end diff --git a/lib/square/types/fulfillment_fulfillment_entry.rb b/lib/square/types/fulfillment_fulfillment_entry.rb new file mode 100644 index 000000000..502e87946 --- /dev/null +++ b/lib/square/types/fulfillment_fulfillment_entry.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Links an order line item to a fulfillment. Each entry must reference + # a valid `uid` for an order line item in the `line_item_uid` field, as well as a `quantity` to + # fulfill. + class FulfillmentFulfillmentEntry < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :line_item_uid, String, optional: false, nullable: false + field :quantity, String, optional: false, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_fulfillment_line_item_application.rb b/lib/square/types/fulfillment_fulfillment_line_item_application.rb new file mode 100644 index 000000000..8d8a0063e --- /dev/null +++ b/lib/square/types/fulfillment_fulfillment_line_item_application.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module FulfillmentFulfillmentLineItemApplication + extend Square::Internal::Types::Enum + ALL = "ALL" + ENTRY_LIST = "ENTRY_LIST"end + end +end diff --git a/lib/square/types/fulfillment_pickup_details.rb b/lib/square/types/fulfillment_pickup_details.rb new file mode 100644 index 000000000..490f902cf --- /dev/null +++ b/lib/square/types/fulfillment_pickup_details.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains details necessary to fulfill a pickup order. + class FulfillmentPickupDetails < Internal::Types::Model + field :recipient, Square::Types::FulfillmentRecipient, optional: true, nullable: false + field :expires_at, String, optional: true, nullable: false + field :auto_complete_duration, String, optional: true, nullable: false + field :schedule_type, Square::Types::FulfillmentPickupDetailsScheduleType, optional: true, nullable: false + field :pickup_at, String, optional: true, nullable: false + field :pickup_window_duration, String, optional: true, nullable: false + field :prep_time_duration, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :placed_at, String, optional: true, nullable: false + field :accepted_at, String, optional: true, nullable: false + field :rejected_at, String, optional: true, nullable: false + field :ready_at, String, optional: true, nullable: false + field :expired_at, String, optional: true, nullable: false + field :picked_up_at, String, optional: true, nullable: false + field :canceled_at, String, optional: true, nullable: false + field :cancel_reason, String, optional: true, nullable: false + field :is_curbside_pickup, Internal::Types::Boolean, optional: true, nullable: false + field :curbside_pickup_details, Square::Types::FulfillmentPickupDetailsCurbsidePickupDetails, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_pickup_details_curbside_pickup_details.rb b/lib/square/types/fulfillment_pickup_details_curbside_pickup_details.rb new file mode 100644 index 000000000..0da1b2ee6 --- /dev/null +++ b/lib/square/types/fulfillment_pickup_details_curbside_pickup_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Specific details for curbside pickup. + class FulfillmentPickupDetailsCurbsidePickupDetails < Internal::Types::Model + field :curbside_details, String, optional: true, nullable: false + field :buyer_arrived_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_pickup_details_schedule_type.rb b/lib/square/types/fulfillment_pickup_details_schedule_type.rb new file mode 100644 index 000000000..b44369775 --- /dev/null +++ b/lib/square/types/fulfillment_pickup_details_schedule_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module FulfillmentPickupDetailsScheduleType + extend Square::Internal::Types::Enum + SCHEDULED = "SCHEDULED" + ASAP = "ASAP"end + end +end diff --git a/lib/square/types/fulfillment_recipient.rb b/lib/square/types/fulfillment_recipient.rb new file mode 100644 index 000000000..1c8caac2b --- /dev/null +++ b/lib/square/types/fulfillment_recipient.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about the fulfillment recipient. + class FulfillmentRecipient < Internal::Types::Model + field :customer_id, String, optional: true, nullable: false + field :display_name, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_shipment_details.rb b/lib/square/types/fulfillment_shipment_details.rb new file mode 100644 index 000000000..e38872ee2 --- /dev/null +++ b/lib/square/types/fulfillment_shipment_details.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains the details necessary to fulfill a shipment order. + class FulfillmentShipmentDetails < Internal::Types::Model + field :recipient, Square::Types::FulfillmentRecipient, optional: true, nullable: false + field :carrier, String, optional: true, nullable: false + field :shipping_note, String, optional: true, nullable: false + field :shipping_type, String, optional: true, nullable: false + field :tracking_number, String, optional: true, nullable: false + field :tracking_url, String, optional: true, nullable: false + field :placed_at, String, optional: true, nullable: false + field :in_progress_at, String, optional: true, nullable: false + field :packaged_at, String, optional: true, nullable: false + field :expected_shipped_at, String, optional: true, nullable: false + field :shipped_at, String, optional: true, nullable: false + field :canceled_at, String, optional: true, nullable: false + field :cancel_reason, String, optional: true, nullable: false + field :failed_at, String, optional: true, nullable: false + field :failure_reason, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/fulfillment_state.rb b/lib/square/types/fulfillment_state.rb new file mode 100644 index 000000000..ec8d06c8d --- /dev/null +++ b/lib/square/types/fulfillment_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module FulfillmentState + extend Square::Internal::Types::Enum + PROPOSED = "PROPOSED" + RESERVED = "RESERVED" + PREPARED = "PREPARED" + COMPLETED = "COMPLETED" + CANCELED = "CANCELED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/fulfillment_type.rb b/lib/square/types/fulfillment_type.rb new file mode 100644 index 000000000..8bf7cd31f --- /dev/null +++ b/lib/square/types/fulfillment_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module FulfillmentType + extend Square::Internal::Types::Enum + PICKUP = "PICKUP" + SHIPMENT = "SHIPMENT" + DELIVERY = "DELIVERY"end + end +end diff --git a/lib/square/types/get_bank_account_by_v_1_id_response.rb b/lib/square/types/get_bank_account_by_v_1_id_response.rb new file mode 100644 index 000000000..8bb06d0d8 --- /dev/null +++ b/lib/square/types/get_bank_account_by_v_1_id_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Response object returned by GetBankAccountByV1Id. + class GetBankAccountByV1IdResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :bank_account, Square::Types::BankAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_bank_account_response.rb b/lib/square/types/get_bank_account_response.rb new file mode 100644 index 000000000..518591ceb --- /dev/null +++ b/lib/square/types/get_bank_account_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Response object returned by `GetBankAccount`. + class GetBankAccountResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :bank_account, Square::Types::BankAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_booking_response.rb b/lib/square/types/get_booking_response.rb new file mode 100644 index 000000000..e8a1df0b3 --- /dev/null +++ b/lib/square/types/get_booking_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetBookingResponse < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_break_type_response.rb b/lib/square/types/get_break_type_response.rb new file mode 100644 index 000000000..899d11931 --- /dev/null +++ b/lib/square/types/get_break_type_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to get a `BreakType`. The response contains + # the requested `BreakType` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class GetBreakTypeResponse < Internal::Types::Model + field :break_type, Square::Types::BreakType, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_business_booking_profile_response.rb b/lib/square/types/get_business_booking_profile_response.rb new file mode 100644 index 000000000..d446e6e82 --- /dev/null +++ b/lib/square/types/get_business_booking_profile_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetBusinessBookingProfileResponse < Internal::Types::Model + field :business_booking_profile, Square::Types::BusinessBookingProfile, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_card_response.rb b/lib/square/types/get_card_response.rb new file mode 100644 index 000000000..b7f188585 --- /dev/null +++ b/lib/square/types/get_card_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RetrieveCard](api-endpoint:Cards-RetrieveCard) endpoint. + # + # Note: if there are errors processing the request, the card field will not be + # present. + class GetCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_cash_drawer_shift_response.rb b/lib/square/types/get_cash_drawer_shift_response.rb new file mode 100644 index 000000000..e930ed293 --- /dev/null +++ b/lib/square/types/get_cash_drawer_shift_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetCashDrawerShiftResponse < Internal::Types::Model + field :cash_drawer_shift, Square::Types::CashDrawerShift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_catalog_object_response.rb b/lib/square/types/get_catalog_object_response.rb new file mode 100644 index 000000000..2a484d02b --- /dev/null +++ b/lib/square/types/get_catalog_object_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class GetCatalogObjectResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :object, Square::Types::CatalogObject, optional: true, nullable: false + field :related_objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_customer_custom_attribute_definition_response.rb b/lib/square/types/get_customer_custom_attribute_definition_response.rb new file mode 100644 index 000000000..0b743996f --- /dev/null +++ b/lib/square/types/get_customer_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class GetCustomerCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_customer_custom_attribute_response.rb b/lib/square/types/get_customer_custom_attribute_response.rb new file mode 100644 index 000000000..de4ef6dd4 --- /dev/null +++ b/lib/square/types/get_customer_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-RetrieveCustomerCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class GetCustomerCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_customer_group_response.rb b/lib/square/types/get_customer_group_response.rb new file mode 100644 index 000000000..040bb851b --- /dev/null +++ b/lib/square/types/get_customer_group_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RetrieveCustomerGroup](api-endpoint:CustomerGroups-RetrieveCustomerGroup) endpoint. + # + # Either `errors` or `group` is present in a given response (never both). + class GetCustomerGroupResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :group, Square::Types::CustomerGroup, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_customer_response.rb b/lib/square/types/get_customer_response.rb new file mode 100644 index 000000000..2554b307b --- /dev/null +++ b/lib/square/types/get_customer_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `RetrieveCustomer` endpoint. + # + # Either `errors` or `customer` is present in a given response (never both). + class GetCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :customer, Square::Types::Customer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_customer_segment_response.rb b/lib/square/types/get_customer_segment_response.rb new file mode 100644 index 000000000..4f97ea423 --- /dev/null +++ b/lib/square/types/get_customer_segment_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body for requests to the `RetrieveCustomerSegment` endpoint. + # + # Either `errors` or `segment` is present in a given response (never both). + class GetCustomerSegmentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :segment, Square::Types::CustomerSegment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_device_code_response.rb b/lib/square/types/get_device_code_response.rb new file mode 100644 index 000000000..a1eb5eeaf --- /dev/null +++ b/lib/square/types/get_device_code_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetDeviceCodeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :device_code, Square::Types::DeviceCode, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_device_response.rb b/lib/square/types/get_device_response.rb new file mode 100644 index 000000000..71fa2b0f7 --- /dev/null +++ b/lib/square/types/get_device_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetDeviceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :device, Square::Types::Device, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_dispute_evidence_response.rb b/lib/square/types/get_dispute_evidence_response.rb new file mode 100644 index 000000000..d50f9e9a7 --- /dev/null +++ b/lib/square/types/get_dispute_evidence_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `RetrieveDisputeEvidence` response. + class GetDisputeEvidenceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :evidence, Square::Types::DisputeEvidence, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_dispute_response.rb b/lib/square/types/get_dispute_response.rb new file mode 100644 index 000000000..ae6c33eff --- /dev/null +++ b/lib/square/types/get_dispute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines fields in a `RetrieveDispute` response. + class GetDisputeResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :dispute, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_employee_response.rb b/lib/square/types/get_employee_response.rb new file mode 100644 index 000000000..5560c5539 --- /dev/null +++ b/lib/square/types/get_employee_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetEmployeeResponse < Internal::Types::Model + field :employee, Square::Types::Employee, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_employee_wage_response.rb b/lib/square/types/get_employee_wage_response.rb new file mode 100644 index 000000000..2f9d8728a --- /dev/null +++ b/lib/square/types/get_employee_wage_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response to a request to get an `EmployeeWage`. The response contains + # the requested `EmployeeWage` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class GetEmployeeWageResponse < Internal::Types::Model + field :employee_wage, Square::Types::EmployeeWage, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_gift_card_from_gan_response.rb b/lib/square/types/get_gift_card_from_gan_response.rb new file mode 100644 index 000000000..64966b949 --- /dev/null +++ b/lib/square/types/get_gift_card_from_gan_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a `GiftCard`. This response might contain a set of `Error` objects + # if the request resulted in errors. + class GetGiftCardFromGanResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_gift_card_from_nonce_response.rb b/lib/square/types/get_gift_card_from_nonce_response.rb new file mode 100644 index 000000000..8b2fedaca --- /dev/null +++ b/lib/square/types/get_gift_card_from_nonce_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a `GiftCard` object. If the request resulted in errors, + # the response contains a set of `Error` objects. + class GetGiftCardFromNonceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_gift_card_response.rb b/lib/square/types/get_gift_card_response.rb new file mode 100644 index 000000000..626e6e26c --- /dev/null +++ b/lib/square/types/get_gift_card_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a `GiftCard`. The response might contain a set of `Error` objects + # if the request resulted in errors. + class GetGiftCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_inventory_adjustment_response.rb b/lib/square/types/get_inventory_adjustment_response.rb new file mode 100644 index 000000000..eb26a469d --- /dev/null +++ b/lib/square/types/get_inventory_adjustment_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetInventoryAdjustmentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :adjustment, Square::Types::InventoryAdjustment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_inventory_changes_response.rb b/lib/square/types/get_inventory_changes_response.rb new file mode 100644 index 000000000..74f422c6b --- /dev/null +++ b/lib/square/types/get_inventory_changes_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class GetInventoryChangesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :changes, Internal::Types::Array[Square::Types::InventoryChange], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_inventory_count_response.rb b/lib/square/types/get_inventory_count_response.rb new file mode 100644 index 000000000..84eb28ff3 --- /dev/null +++ b/lib/square/types/get_inventory_count_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class GetInventoryCountResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :counts, Internal::Types::Array[Square::Types::InventoryCount], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_inventory_physical_count_response.rb b/lib/square/types/get_inventory_physical_count_response.rb new file mode 100644 index 000000000..98fd1a316 --- /dev/null +++ b/lib/square/types/get_inventory_physical_count_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetInventoryPhysicalCountResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :count, Square::Types::InventoryPhysicalCount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_inventory_transfer_response.rb b/lib/square/types/get_inventory_transfer_response.rb new file mode 100644 index 000000000..7c788c408 --- /dev/null +++ b/lib/square/types/get_inventory_transfer_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetInventoryTransferResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :transfer, Square::Types::InventoryTransfer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_invoice_response.rb b/lib/square/types/get_invoice_response.rb new file mode 100644 index 000000000..f2a5b052e --- /dev/null +++ b/lib/square/types/get_invoice_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `GetInvoice` response. + class GetInvoiceResponse < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_location_response.rb b/lib/square/types/get_location_response.rb new file mode 100644 index 000000000..6f6b5ffe9 --- /dev/null +++ b/lib/square/types/get_location_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that the [RetrieveLocation](api-endpoint:Locations-RetrieveLocation) + # endpoint returns in a response. + class GetLocationResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :location, Square::Types::Location, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_loyalty_account_response.rb b/lib/square/types/get_loyalty_account_response.rb new file mode 100644 index 000000000..f415c3f79 --- /dev/null +++ b/lib/square/types/get_loyalty_account_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes the loyalty account. + class GetLoyaltyAccountResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_account, Square::Types::LoyaltyAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_loyalty_program_response.rb b/lib/square/types/get_loyalty_program_response.rb new file mode 100644 index 000000000..cea05bec3 --- /dev/null +++ b/lib/square/types/get_loyalty_program_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains the loyalty program. + class GetLoyaltyProgramResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :program, Square::Types::LoyaltyProgram, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_loyalty_promotion_response.rb b/lib/square/types/get_loyalty_promotion_response.rb new file mode 100644 index 000000000..8986f429f --- /dev/null +++ b/lib/square/types/get_loyalty_promotion_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveLoyaltyPromotionPromotions](api-endpoint:Loyalty-RetrieveLoyaltyPromotion) response. + class GetLoyaltyPromotionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_loyalty_reward_response.rb b/lib/square/types/get_loyalty_reward_response.rb new file mode 100644 index 000000000..68c4497ac --- /dev/null +++ b/lib/square/types/get_loyalty_reward_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes the loyalty reward. + class GetLoyaltyRewardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :reward, Square::Types::LoyaltyReward, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_merchant_response.rb b/lib/square/types/get_merchant_response.rb new file mode 100644 index 000000000..de1f2abda --- /dev/null +++ b/lib/square/types/get_merchant_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response object returned by the [RetrieveMerchant](api-endpoint:Merchants-RetrieveMerchant) endpoint. + class GetMerchantResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :merchant, Square::Types::Merchant, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_order_response.rb b/lib/square/types/get_order_response.rb new file mode 100644 index 000000000..c18497e21 --- /dev/null +++ b/lib/square/types/get_order_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetOrderResponse < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_payment_link_response.rb b/lib/square/types/get_payment_link_response.rb new file mode 100644 index 000000000..179a46317 --- /dev/null +++ b/lib/square/types/get_payment_link_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetPaymentLinkResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment_link, Square::Types::PaymentLink, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_payment_refund_response.rb b/lib/square/types/get_payment_refund_response.rb new file mode 100644 index 000000000..de452c33c --- /dev/null +++ b/lib/square/types/get_payment_refund_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund). + # + # Note: If there are errors processing the request, the refund field might not be + # present or it might be present in a FAILED state. + class GetPaymentRefundResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::PaymentRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_payment_response.rb b/lib/square/types/get_payment_response.rb new file mode 100644 index 000000000..86dc7f566 --- /dev/null +++ b/lib/square/types/get_payment_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [GetPayment](api-endpoint:Payments-GetPayment). + class GetPaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_payout_response.rb b/lib/square/types/get_payout_response.rb new file mode 100644 index 000000000..08ece4023 --- /dev/null +++ b/lib/square/types/get_payout_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetPayoutResponse < Internal::Types::Model + field :payout, Square::Types::Payout, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_shift_response.rb b/lib/square/types/get_shift_response.rb new file mode 100644 index 000000000..61efc44eb --- /dev/null +++ b/lib/square/types/get_shift_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response to a request to get a `Shift`. The response contains + # the requested `Shift` object and might contain a set of `Error` objects if + # the request resulted in errors. + class GetShiftResponse < Internal::Types::Model + field :shift, Square::Types::Shift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_snippet_response.rb b/lib/square/types/get_snippet_response.rb new file mode 100644 index 000000000..ff98d5967 --- /dev/null +++ b/lib/square/types/get_snippet_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a `RetrieveSnippet` response. The response can include either `snippet` or `errors`. + class GetSnippetResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :snippet, Square::Types::Snippet, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_subscription_response.rb b/lib/square/types/get_subscription_response.rb new file mode 100644 index 000000000..f6e8ffc4f --- /dev/null +++ b/lib/square/types/get_subscription_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [RetrieveSubscription](api-endpoint:Subscriptions-RetrieveSubscription) endpoint. + class GetSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_team_member_booking_profile_response.rb b/lib/square/types/get_team_member_booking_profile_response.rb new file mode 100644 index 000000000..984a89508 --- /dev/null +++ b/lib/square/types/get_team_member_booking_profile_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetTeamMemberBookingProfileResponse < Internal::Types::Model + field :team_member_booking_profile, Square::Types::TeamMemberBookingProfile, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_team_member_response.rb b/lib/square/types/get_team_member_response.rb new file mode 100644 index 000000000..5f0ca8adb --- /dev/null +++ b/lib/square/types/get_team_member_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a retrieve request containing a `TeamMember` object or error messages. + class GetTeamMemberResponse < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_team_member_wage_response.rb b/lib/square/types/get_team_member_wage_response.rb new file mode 100644 index 000000000..974e282b5 --- /dev/null +++ b/lib/square/types/get_team_member_wage_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response to a request to get a `TeamMemberWage`. The response contains + # the requested `TeamMemberWage` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class GetTeamMemberWageResponse < Internal::Types::Model + field :team_member_wage, Square::Types::TeamMemberWage, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_terminal_action_response.rb b/lib/square/types/get_terminal_action_response.rb new file mode 100644 index 000000000..f25105db8 --- /dev/null +++ b/lib/square/types/get_terminal_action_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetTerminalActionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_terminal_checkout_response.rb b/lib/square/types/get_terminal_checkout_response.rb new file mode 100644 index 000000000..921ef71f0 --- /dev/null +++ b/lib/square/types/get_terminal_checkout_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetTerminalCheckoutResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_terminal_refund_response.rb b/lib/square/types/get_terminal_refund_response.rb new file mode 100644 index 000000000..05a4d8e7b --- /dev/null +++ b/lib/square/types/get_terminal_refund_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class GetTerminalRefundResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_transaction_response.rb b/lib/square/types/get_transaction_response.rb new file mode 100644 index 000000000..57b04d267 --- /dev/null +++ b/lib/square/types/get_transaction_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RetrieveTransaction](api-endpoint:Transactions-RetrieveTransaction) endpoint. + # + # One of `errors` or `transaction` is present in a given response (never both). + class GetTransactionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :transaction, Square::Types::Transaction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_vendor_response.rb b/lib/square/types/get_vendor_response.rb new file mode 100644 index 000000000..5df07f152 --- /dev/null +++ b/lib/square/types/get_vendor_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [RetrieveVendor](api-endpoint:Vendors-RetrieveVendor). + class GetVendorResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_wage_setting_response.rb b/lib/square/types/get_wage_setting_response.rb new file mode 100644 index 000000000..77729520f --- /dev/null +++ b/lib/square/types/get_wage_setting_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a retrieve request containing the specified `WageSetting` object or error messages. + class GetWageSettingResponse < Internal::Types::Model + field :wage_setting, Square::Types::WageSetting, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/get_webhook_subscription_response.rb b/lib/square/types/get_webhook_subscription_response.rb new file mode 100644 index 000000000..248756789 --- /dev/null +++ b/lib/square/types/get_webhook_subscription_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RetrieveWebhookSubscription](api-endpoint:WebhookSubscriptions-RetrieveWebhookSubscription) endpoint. + # + # Note: if there are errors processing the request, the [Subscription](entity:WebhookSubscription) will not be + # present. + class GetWebhookSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::WebhookSubscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card.rb b/lib/square/types/gift_card.rb new file mode 100644 index 000000000..843dd69e8 --- /dev/null +++ b/lib/square/types/gift_card.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a Square gift card. + class GiftCard < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :type, Square::Types::GiftCardType, optional: false, nullable: false + field :gan_source, Square::Types::GiftCardGanSource, optional: true, nullable: false + field :state, Square::Types::GiftCardStatus, optional: true, nullable: false + field :balance_money, Square::Types::Money, optional: true, nullable: false + field :gan, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :customer_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity.rb b/lib/square/types/gift_card_activity.rb new file mode 100644 index 000000000..19653849f --- /dev/null +++ b/lib/square/types/gift_card_activity.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an action performed on a [gift card](entity:GiftCard) that affects its state or balance. + # A gift card activity contains information about a specific activity type. For example, a `REDEEM` activity + # includes a `redeem_activity_details` field that contains information about the redemption. + class GiftCardActivity < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :type, Square::Types::GiftCardActivityType, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + field :created_at, String, optional: true, nullable: false + field :gift_card_id, String, optional: true, nullable: false + field :gift_card_gan, String, optional: true, nullable: false + field :gift_card_balance_money, Square::Types::Money, optional: true, nullable: false + field :load_activity_details, Square::Types::GiftCardActivityLoad, optional: true, nullable: false + field :activate_activity_details, Square::Types::GiftCardActivityActivate, optional: true, nullable: false + field :redeem_activity_details, Square::Types::GiftCardActivityRedeem, optional: true, nullable: false + field :clear_balance_activity_details, Square::Types::GiftCardActivityClearBalance, optional: true, nullable: false + field :deactivate_activity_details, Square::Types::GiftCardActivityDeactivate, optional: true, nullable: false + field :adjust_increment_activity_details, Square::Types::GiftCardActivityAdjustIncrement, optional: true, nullable: false + field :adjust_decrement_activity_details, Square::Types::GiftCardActivityAdjustDecrement, optional: true, nullable: false + field :refund_activity_details, Square::Types::GiftCardActivityRefund, optional: true, nullable: false + field :unlinked_activity_refund_activity_details, Square::Types::GiftCardActivityUnlinkedActivityRefund, optional: true, nullable: false + field :import_activity_details, Square::Types::GiftCardActivityImport, optional: true, nullable: false + field :block_activity_details, Square::Types::GiftCardActivityBlock, optional: true, nullable: false + field :unblock_activity_details, Square::Types::GiftCardActivityUnblock, optional: true, nullable: false + field :import_reversal_activity_details, Square::Types::GiftCardActivityImportReversal, optional: true, nullable: false + field :transfer_balance_to_activity_details, Square::Types::GiftCardActivityTransferBalanceTo, optional: true, nullable: false + field :transfer_balance_from_activity_details, Square::Types::GiftCardActivityTransferBalanceFrom, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_activate.rb b/lib/square/types/gift_card_activity_activate.rb new file mode 100644 index 000000000..ca4856383 --- /dev/null +++ b/lib/square/types/gift_card_activity_activate.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `ACTIVATE` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityActivate < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :line_item_uid, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :buyer_payment_instrument_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_adjust_decrement.rb b/lib/square/types/gift_card_activity_adjust_decrement.rb new file mode 100644 index 000000000..b6021cf03 --- /dev/null +++ b/lib/square/types/gift_card_activity_adjust_decrement.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `ADJUST_DECREMENT` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityAdjustDecrement < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :reason, Square::Types::GiftCardActivityAdjustDecrementReason, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_adjust_decrement_reason.rb b/lib/square/types/gift_card_activity_adjust_decrement_reason.rb new file mode 100644 index 000000000..30fc6901e --- /dev/null +++ b/lib/square/types/gift_card_activity_adjust_decrement_reason.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityAdjustDecrementReason + extend Square::Internal::Types::Enum + SUSPICIOUS_ACTIVITY = "SUSPICIOUS_ACTIVITY" + BALANCE_ACCIDENTALLY_INCREASED = "BALANCE_ACCIDENTALLY_INCREASED" + SUPPORT_ISSUE = "SUPPORT_ISSUE" + PURCHASE_WAS_REFUNDED = "PURCHASE_WAS_REFUNDED"end + end +end diff --git a/lib/square/types/gift_card_activity_adjust_increment.rb b/lib/square/types/gift_card_activity_adjust_increment.rb new file mode 100644 index 000000000..1dc882bbd --- /dev/null +++ b/lib/square/types/gift_card_activity_adjust_increment.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `ADJUST_INCREMENT` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityAdjustIncrement < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :reason, Square::Types::GiftCardActivityAdjustIncrementReason, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_adjust_increment_reason.rb b/lib/square/types/gift_card_activity_adjust_increment_reason.rb new file mode 100644 index 000000000..2e7c4a052 --- /dev/null +++ b/lib/square/types/gift_card_activity_adjust_increment_reason.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityAdjustIncrementReason + extend Square::Internal::Types::Enum + COMPLIMENTARY = "COMPLIMENTARY" + SUPPORT_ISSUE = "SUPPORT_ISSUE" + TRANSACTION_VOIDED = "TRANSACTION_VOIDED"end + end +end diff --git a/lib/square/types/gift_card_activity_block.rb b/lib/square/types/gift_card_activity_block.rb new file mode 100644 index 000000000..2aa00304d --- /dev/null +++ b/lib/square/types/gift_card_activity_block.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `BLOCK` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityBlock < Internal::Types::Model + field :reason, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_clear_balance.rb b/lib/square/types/gift_card_activity_clear_balance.rb new file mode 100644 index 000000000..778a844a5 --- /dev/null +++ b/lib/square/types/gift_card_activity_clear_balance.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `CLEAR_BALANCE` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityClearBalance < Internal::Types::Model + field :reason, Square::Types::GiftCardActivityClearBalanceReason, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_clear_balance_reason.rb b/lib/square/types/gift_card_activity_clear_balance_reason.rb new file mode 100644 index 000000000..bd1f5d105 --- /dev/null +++ b/lib/square/types/gift_card_activity_clear_balance_reason.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityClearBalanceReason + extend Square::Internal::Types::Enum + SUSPICIOUS_ACTIVITY = "SUSPICIOUS_ACTIVITY" + REUSE_GIFTCARD = "REUSE_GIFTCARD" + UNKNOWN_REASON = "UNKNOWN_REASON"end + end +end diff --git a/lib/square/types/gift_card_activity_created_event.rb b/lib/square/types/gift_card_activity_created_event.rb new file mode 100644 index 000000000..ed466bd0a --- /dev/null +++ b/lib/square/types/gift_card_activity_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [gift card activity](entity:GiftCardActivity) is created. + class GiftCardActivityCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardActivityCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_created_event_data.rb b/lib/square/types/gift_card_activity_created_event_data.rb new file mode 100644 index 000000000..4eaa0e132 --- /dev/null +++ b/lib/square/types/gift_card_activity_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the data associated with a `gift_card.activity.created` event. + class GiftCardActivityCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardActivityCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_created_event_object.rb b/lib/square/types/gift_card_activity_created_event_object.rb new file mode 100644 index 000000000..56383a2ce --- /dev/null +++ b/lib/square/types/gift_card_activity_created_event_object.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card activity associated with a + # `gift_card.activity.created` event. + class GiftCardActivityCreatedEventObject < Internal::Types::Model + field :gift_card_activity, Square::Types::GiftCardActivity, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_deactivate.rb b/lib/square/types/gift_card_activity_deactivate.rb new file mode 100644 index 000000000..e15df0dbc --- /dev/null +++ b/lib/square/types/gift_card_activity_deactivate.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `DEACTIVATE` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityDeactivate < Internal::Types::Model + field :reason, Square::Types::GiftCardActivityDeactivateReason, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_deactivate_reason.rb b/lib/square/types/gift_card_activity_deactivate_reason.rb new file mode 100644 index 000000000..3f5948c31 --- /dev/null +++ b/lib/square/types/gift_card_activity_deactivate_reason.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityDeactivateReason + extend Square::Internal::Types::Enum + SUSPICIOUS_ACTIVITY = "SUSPICIOUS_ACTIVITY" + UNKNOWN_REASON = "UNKNOWN_REASON" + CHARGEBACK_DEACTIVATE = "CHARGEBACK_DEACTIVATE"end + end +end diff --git a/lib/square/types/gift_card_activity_import.rb b/lib/square/types/gift_card_activity_import.rb new file mode 100644 index 000000000..38f6326e5 --- /dev/null +++ b/lib/square/types/gift_card_activity_import.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `IMPORT` [gift card activity type](entity:GiftCardActivityType). + # This activity type is used when Square imports a third-party gift card, in which case the + # `gan_source` of the gift card is set to `OTHER`. + class GiftCardActivityImport < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_import_reversal.rb b/lib/square/types/gift_card_activity_import_reversal.rb new file mode 100644 index 000000000..298e391d2 --- /dev/null +++ b/lib/square/types/gift_card_activity_import_reversal.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `IMPORT_REVERSAL` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityImportReversal < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_load.rb b/lib/square/types/gift_card_activity_load.rb new file mode 100644 index 000000000..00ec24e3a --- /dev/null +++ b/lib/square/types/gift_card_activity_load.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `LOAD` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityLoad < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :line_item_uid, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :buyer_payment_instrument_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_redeem.rb b/lib/square/types/gift_card_activity_redeem.rb new file mode 100644 index 000000000..94c93d585 --- /dev/null +++ b/lib/square/types/gift_card_activity_redeem.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `REDEEM` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityRedeem < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :payment_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :status, Square::Types::GiftCardActivityRedeemStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_redeem_status.rb b/lib/square/types/gift_card_activity_redeem_status.rb new file mode 100644 index 000000000..9e046b33a --- /dev/null +++ b/lib/square/types/gift_card_activity_redeem_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityRedeemStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + COMPLETED = "COMPLETED" + CANCELED = "CANCELED"end + end +end diff --git a/lib/square/types/gift_card_activity_refund.rb b/lib/square/types/gift_card_activity_refund.rb new file mode 100644 index 000000000..2b5f54303 --- /dev/null +++ b/lib/square/types/gift_card_activity_refund.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `REFUND` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityRefund < Internal::Types::Model + field :redeem_activity_id, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_transfer_balance_from.rb b/lib/square/types/gift_card_activity_transfer_balance_from.rb new file mode 100644 index 000000000..3e90ae118 --- /dev/null +++ b/lib/square/types/gift_card_activity_transfer_balance_from.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `TRANSFER_BALANCE_FROM` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityTransferBalanceFrom < Internal::Types::Model + field :transfer_to_gift_card_id, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_transfer_balance_to.rb b/lib/square/types/gift_card_activity_transfer_balance_to.rb new file mode 100644 index 000000000..48f3d493b --- /dev/null +++ b/lib/square/types/gift_card_activity_transfer_balance_to.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about a `TRANSFER_BALANCE_TO` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityTransferBalanceTo < Internal::Types::Model + field :transfer_from_gift_card_id, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_type.rb b/lib/square/types/gift_card_activity_type.rb new file mode 100644 index 000000000..3e9e4d56f --- /dev/null +++ b/lib/square/types/gift_card_activity_type.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardActivityType + extend Square::Internal::Types::Enum + ACTIVATE = "ACTIVATE" + LOAD = "LOAD" + REDEEM = "REDEEM" + CLEAR_BALANCE = "CLEAR_BALANCE" + DEACTIVATE = "DEACTIVATE" + ADJUST_INCREMENT = "ADJUST_INCREMENT" + ADJUST_DECREMENT = "ADJUST_DECREMENT" + REFUND = "REFUND" + UNLINKED_ACTIVITY_REFUND = "UNLINKED_ACTIVITY_REFUND" + IMPORT = "IMPORT" + BLOCK = "BLOCK" + UNBLOCK = "UNBLOCK" + IMPORT_REVERSAL = "IMPORT_REVERSAL" + TRANSFER_BALANCE_FROM = "TRANSFER_BALANCE_FROM" + TRANSFER_BALANCE_TO = "TRANSFER_BALANCE_TO"end + end +end diff --git a/lib/square/types/gift_card_activity_unblock.rb b/lib/square/types/gift_card_activity_unblock.rb new file mode 100644 index 000000000..03e1c7cf9 --- /dev/null +++ b/lib/square/types/gift_card_activity_unblock.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `UNBLOCK` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityUnblock < Internal::Types::Model + field :reason, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_unlinked_activity_refund.rb b/lib/square/types/gift_card_activity_unlinked_activity_refund.rb new file mode 100644 index 000000000..4814cdf7c --- /dev/null +++ b/lib/square/types/gift_card_activity_unlinked_activity_refund.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents details about an `UNLINKED_ACTIVITY_REFUND` [gift card activity type](entity:GiftCardActivityType). + class GiftCardActivityUnlinkedActivityRefund < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :reference_id, String, optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_updated_event.rb b/lib/square/types/gift_card_activity_updated_event.rb new file mode 100644 index 000000000..b9b2fd77f --- /dev/null +++ b/lib/square/types/gift_card_activity_updated_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [gift card activity](entity:GiftCardActivity) is updated. + # Subscribe to this event to be notified about the following changes: + # - An update to the `REDEEM` activity for a gift card redemption made from a Square product (such as Square Point of Sale). + # These redemptions are initially assigned a `PENDING` state, but then change to a `COMPLETED` or `CANCELED` state. + # - An update to the `IMPORT` activity for an imported gift card when the balance is later adjusted by Square. + class GiftCardActivityUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardActivityUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_updated_event_data.rb b/lib/square/types/gift_card_activity_updated_event_data.rb new file mode 100644 index 000000000..7953ce202 --- /dev/null +++ b/lib/square/types/gift_card_activity_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `gift_card.activity.updated` event. + class GiftCardActivityUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardActivityUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_activity_updated_event_object.rb b/lib/square/types/gift_card_activity_updated_event_object.rb new file mode 100644 index 000000000..eb7239d95 --- /dev/null +++ b/lib/square/types/gift_card_activity_updated_event_object.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card activity associated with a + # `gift_card.activity.updated` event. + class GiftCardActivityUpdatedEventObject < Internal::Types::Model + field :gift_card_activity, Square::Types::GiftCardActivity, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_created_event.rb b/lib/square/types/gift_card_created_event.rb new file mode 100644 index 000000000..e0b23b49c --- /dev/null +++ b/lib/square/types/gift_card_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [gift card](entity:GiftCard) is created. + class GiftCardCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_created_event_data.rb b/lib/square/types/gift_card_created_event_data.rb new file mode 100644 index 000000000..ba0d40849 --- /dev/null +++ b/lib/square/types/gift_card_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `gift_card.created` event. + class GiftCardCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_created_event_object.rb b/lib/square/types/gift_card_created_event_object.rb new file mode 100644 index 000000000..62b44b610 --- /dev/null +++ b/lib/square/types/gift_card_created_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card associated with a `gift_card.created` event. + class GiftCardCreatedEventObject < Internal::Types::Model + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_linked_event.rb b/lib/square/types/gift_card_customer_linked_event.rb new file mode 100644 index 000000000..041e60431 --- /dev/null +++ b/lib/square/types/gift_card_customer_linked_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [customer](entity:Customer) is linked to a [gift card](entity:GiftCard). + class GiftCardCustomerLinkedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardCustomerLinkedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_linked_event_data.rb b/lib/square/types/gift_card_customer_linked_event_data.rb new file mode 100644 index 000000000..6154e7d61 --- /dev/null +++ b/lib/square/types/gift_card_customer_linked_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `gift_card.customer_linked` event. + class GiftCardCustomerLinkedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardCustomerLinkedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_linked_event_object.rb b/lib/square/types/gift_card_customer_linked_event_object.rb new file mode 100644 index 000000000..b21c253ac --- /dev/null +++ b/lib/square/types/gift_card_customer_linked_event_object.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card and customer ID associated with a + # `gift_card.customer_linked` event. + class GiftCardCustomerLinkedEventObject < Internal::Types::Model + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + field :linked_customer_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_unlinked_event.rb b/lib/square/types/gift_card_customer_unlinked_event.rb new file mode 100644 index 000000000..93d0f86a1 --- /dev/null +++ b/lib/square/types/gift_card_customer_unlinked_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [customer](entity:Customer) is unlinked from a [gift card](entity:GiftCard). + class GiftCardCustomerUnlinkedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardCustomerUnlinkedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_unlinked_event_data.rb b/lib/square/types/gift_card_customer_unlinked_event_data.rb new file mode 100644 index 000000000..2822a0d2f --- /dev/null +++ b/lib/square/types/gift_card_customer_unlinked_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `gift_card.customer_unlinked` event. + class GiftCardCustomerUnlinkedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardCustomerUnlinkedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_customer_unlinked_event_object.rb b/lib/square/types/gift_card_customer_unlinked_event_object.rb new file mode 100644 index 000000000..d51ffdd54 --- /dev/null +++ b/lib/square/types/gift_card_customer_unlinked_event_object.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card and the customer ID associated with a + # `gift_card.customer_linked` event. + class GiftCardCustomerUnlinkedEventObject < Internal::Types::Model + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + field :unlinked_customer_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_gan_source.rb b/lib/square/types/gift_card_gan_source.rb new file mode 100644 index 000000000..b9f8ffd9d --- /dev/null +++ b/lib/square/types/gift_card_gan_source.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardGanSource + extend Square::Internal::Types::Enum + SQUARE = "SQUARE" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/gift_card_status.rb b/lib/square/types/gift_card_status.rb new file mode 100644 index 000000000..01f652a96 --- /dev/null +++ b/lib/square/types/gift_card_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + DEACTIVATED = "DEACTIVATED" + BLOCKED = "BLOCKED" + PENDING = "PENDING"end + end +end diff --git a/lib/square/types/gift_card_type.rb b/lib/square/types/gift_card_type.rb new file mode 100644 index 000000000..0b5493837 --- /dev/null +++ b/lib/square/types/gift_card_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module GiftCardType + extend Square::Internal::Types::Enum + PHYSICAL = "PHYSICAL" + DIGITAL = "DIGITAL"end + end +end diff --git a/lib/square/types/gift_card_updated_event.rb b/lib/square/types/gift_card_updated_event.rb new file mode 100644 index 000000000..2672e3fc1 --- /dev/null +++ b/lib/square/types/gift_card_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [gift card](entity:GiftCard) is updated. This includes + # changes to the state, balance, and customer association. + class GiftCardUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::GiftCardUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_updated_event_data.rb b/lib/square/types/gift_card_updated_event_data.rb new file mode 100644 index 000000000..4117221d3 --- /dev/null +++ b/lib/square/types/gift_card_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `gift_card.updated` event. + class GiftCardUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::GiftCardUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/gift_card_updated_event_object.rb b/lib/square/types/gift_card_updated_event_object.rb new file mode 100644 index 000000000..7f901251b --- /dev/null +++ b/lib/square/types/gift_card_updated_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the gift card associated with a `gift_card.updated` event. + class GiftCardUpdatedEventObject < Internal::Types::Model + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_adjustment.rb b/lib/square/types/inventory_adjustment.rb new file mode 100644 index 000000000..e9dcef961 --- /dev/null +++ b/lib/square/types/inventory_adjustment.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a change in state or quantity of product inventory at a + # particular time and location. + class InventoryAdjustment < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :from_state, Square::Types::InventoryState, optional: true, nullable: false + field :to_state, Square::Types::InventoryState, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_object_type, String, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + field :total_price_money, Square::Types::Money, optional: true, nullable: false + field :occurred_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :source, Square::Types::SourceApplication, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :transaction_id, String, optional: true, nullable: false + field :refund_id, String, optional: true, nullable: false + field :purchase_order_id, String, optional: true, nullable: false + field :goods_receipt_id, String, optional: true, nullable: false + field :adjustment_group, Square::Types::InventoryAdjustmentGroup, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_adjustment_group.rb b/lib/square/types/inventory_adjustment_group.rb new file mode 100644 index 000000000..331ff764b --- /dev/null +++ b/lib/square/types/inventory_adjustment_group.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class InventoryAdjustmentGroup < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :root_adjustment_id, String, optional: true, nullable: false + field :from_state, Square::Types::InventoryState, optional: true, nullable: false + field :to_state, Square::Types::InventoryState, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_alert_type.rb b/lib/square/types/inventory_alert_type.rb new file mode 100644 index 000000000..368d3adb4 --- /dev/null +++ b/lib/square/types/inventory_alert_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module InventoryAlertType + extend Square::Internal::Types::Enum + NONE = "NONE" + LOW_QUANTITY = "LOW_QUANTITY"end + end +end diff --git a/lib/square/types/inventory_change.rb b/lib/square/types/inventory_change.rb new file mode 100644 index 000000000..79695697a --- /dev/null +++ b/lib/square/types/inventory_change.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a single physical count, inventory, adjustment, or transfer + # that is part of the history of inventory changes for a particular + # [CatalogObject](entity:CatalogObject) instance. + class InventoryChange < Internal::Types::Model + field :type, Square::Types::InventoryChangeType, optional: true, nullable: false + field :physical_count, Square::Types::InventoryPhysicalCount, optional: true, nullable: false + field :adjustment, Square::Types::InventoryAdjustment, optional: true, nullable: false + field :transfer, Square::Types::InventoryTransfer, optional: true, nullable: false + field :measurement_unit, Square::Types::CatalogMeasurementUnit, optional: true, nullable: false + field :measurement_unit_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_change_type.rb b/lib/square/types/inventory_change_type.rb new file mode 100644 index 000000000..283d7e008 --- /dev/null +++ b/lib/square/types/inventory_change_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module InventoryChangeType + extend Square::Internal::Types::Enum + PHYSICAL_COUNT = "PHYSICAL_COUNT" + ADJUSTMENT = "ADJUSTMENT" + TRANSFER = "TRANSFER"end + end +end diff --git a/lib/square/types/inventory_count.rb b/lib/square/types/inventory_count.rb new file mode 100644 index 000000000..a69b78797 --- /dev/null +++ b/lib/square/types/inventory_count.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents Square-estimated quantity of items in a particular state at a + # particular seller location based on the known history of physical counts and + # inventory adjustments. + class InventoryCount < Internal::Types::Model + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_object_type, String, optional: true, nullable: false + field :state, Square::Types::InventoryState, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + field :calculated_at, String, optional: true, nullable: false + field :is_estimated, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_count_updated_event.rb b/lib/square/types/inventory_count_updated_event.rb new file mode 100644 index 000000000..7dbbe90e1 --- /dev/null +++ b/lib/square/types/inventory_count_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when the quantity is updated for a + # [CatalogItemVariation](entity:CatalogItemVariation). + class InventoryCountUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InventoryCountUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_count_updated_event_data.rb b/lib/square/types/inventory_count_updated_event_data.rb new file mode 100644 index 000000000..2e2bfd7bf --- /dev/null +++ b/lib/square/types/inventory_count_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InventoryCountUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InventoryCountUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_count_updated_event_object.rb b/lib/square/types/inventory_count_updated_event_object.rb new file mode 100644 index 000000000..b46011fd0 --- /dev/null +++ b/lib/square/types/inventory_count_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InventoryCountUpdatedEventObject < Internal::Types::Model + field :inventory_counts, Internal::Types::Array[Square::Types::InventoryCount], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_physical_count.rb b/lib/square/types/inventory_physical_count.rb new file mode 100644 index 000000000..8ed5f2dd7 --- /dev/null +++ b/lib/square/types/inventory_physical_count.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the quantity of an item variation that is physically present + # at a specific location, verified by a seller or a seller's employee. For example, + # a physical count might come from an employee counting the item variations on + # hand or from syncing with an external system. + class InventoryPhysicalCount < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_object_type, String, optional: true, nullable: false + field :state, Square::Types::InventoryState, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + field :source, Square::Types::SourceApplication, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :occurred_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/inventory_state.rb b/lib/square/types/inventory_state.rb new file mode 100644 index 000000000..ed405b812 --- /dev/null +++ b/lib/square/types/inventory_state.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + module InventoryState + extend Square::Internal::Types::Enum + CUSTOM = "CUSTOM" + IN_STOCK = "IN_STOCK" + SOLD = "SOLD" + RETURNED_BY_CUSTOMER = "RETURNED_BY_CUSTOMER" + RESERVED_FOR_SALE = "RESERVED_FOR_SALE" + SOLD_ONLINE = "SOLD_ONLINE" + ORDERED_FROM_VENDOR = "ORDERED_FROM_VENDOR" + RECEIVED_FROM_VENDOR = "RECEIVED_FROM_VENDOR" + IN_TRANSIT_TO = "IN_TRANSIT_TO" + NONE = "NONE" + WASTE = "WASTE" + UNLINKED_RETURN = "UNLINKED_RETURN" + COMPOSED = "COMPOSED" + DECOMPOSED = "DECOMPOSED" + SUPPORTED_BY_NEWER_VERSION = "SUPPORTED_BY_NEWER_VERSION" + IN_TRANSIT = "IN_TRANSIT"end + end +end diff --git a/lib/square/types/inventory_transfer.rb b/lib/square/types/inventory_transfer.rb new file mode 100644 index 000000000..ec88df8b9 --- /dev/null +++ b/lib/square/types/inventory_transfer.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the transfer of a quantity of product inventory at a + # particular time from one location to another. + class InventoryTransfer < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :state, Square::Types::InventoryState, optional: true, nullable: false + field :from_location_id, String, optional: true, nullable: false + field :to_location_id, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_object_type, String, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + field :occurred_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :source, Square::Types::SourceApplication, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice.rb b/lib/square/types/invoice.rb new file mode 100644 index 000000000..737149a6e --- /dev/null +++ b/lib/square/types/invoice.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Square + module Types + # Stores information about an invoice. You use the Invoices API to create and manage + # invoices. For more information, see [Invoices API Overview](https://developer.squareup.com/docs/invoices-api/overview). + class Invoice < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :primary_recipient, Square::Types::InvoiceRecipient, optional: true, nullable: false + field :payment_requests, Internal::Types::Array[Square::Types::InvoicePaymentRequest], optional: true, nullable: false + field :delivery_method, Square::Types::InvoiceDeliveryMethod, optional: true, nullable: false + field :invoice_number, String, optional: true, nullable: false + field :title, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :scheduled_at, String, optional: true, nullable: false + field :public_url, String, optional: true, nullable: false + field :next_payment_amount_money, Square::Types::Money, optional: true, nullable: false + field :status, Square::Types::InvoiceStatus, optional: true, nullable: false + field :timezone, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :accepted_payment_methods, Square::Types::InvoiceAcceptedPaymentMethods, optional: true, nullable: false + field :custom_fields, Internal::Types::Array[Square::Types::InvoiceCustomField], optional: true, nullable: false + field :subscription_id, String, optional: true, nullable: false + field :sale_or_service_date, String, optional: true, nullable: false + field :payment_conditions, String, optional: true, nullable: false + field :store_payment_method_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :attachments, Internal::Types::Array[Square::Types::InvoiceAttachment], optional: true, nullable: false + field :creator_team_member_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_accepted_payment_methods.rb b/lib/square/types/invoice_accepted_payment_methods.rb new file mode 100644 index 000000000..22b724b4b --- /dev/null +++ b/lib/square/types/invoice_accepted_payment_methods.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The payment methods that customers can use to pay an [invoice](entity:Invoice) on the Square-hosted invoice payment page. + class InvoiceAcceptedPaymentMethods < Internal::Types::Model + field :card, Internal::Types::Boolean, optional: true, nullable: false + field :square_gift_card, Internal::Types::Boolean, optional: true, nullable: false + field :bank_account, Internal::Types::Boolean, optional: true, nullable: false + field :buy_now_pay_later, Internal::Types::Boolean, optional: true, nullable: false + field :cash_app_pay, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_attachment.rb b/lib/square/types/invoice_attachment.rb new file mode 100644 index 000000000..e9f295344 --- /dev/null +++ b/lib/square/types/invoice_attachment.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a file attached to an [invoice](entity:Invoice). + class InvoiceAttachment < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :filename, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :filesize, Integer, optional: true, nullable: false + field :hash, String, optional: true, nullable: false + field :mime_type, String, optional: true, nullable: false + field :uploaded_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_automatic_payment_source.rb b/lib/square/types/invoice_automatic_payment_source.rb new file mode 100644 index 000000000..ff6506edb --- /dev/null +++ b/lib/square/types/invoice_automatic_payment_source.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceAutomaticPaymentSource + extend Square::Internal::Types::Enum + NONE = "NONE" + CARD_ON_FILE = "CARD_ON_FILE" + BANK_ON_FILE = "BANK_ON_FILE"end + end +end diff --git a/lib/square/types/invoice_canceled_event.rb b/lib/square/types/invoice_canceled_event.rb new file mode 100644 index 000000000..4025923dd --- /dev/null +++ b/lib/square/types/invoice_canceled_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Invoice](entity:Invoice) is canceled. + class InvoiceCanceledEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceCanceledEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_canceled_event_data.rb b/lib/square/types/invoice_canceled_event_data.rb new file mode 100644 index 000000000..9b76b0b36 --- /dev/null +++ b/lib/square/types/invoice_canceled_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceCanceledEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoiceCanceledEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_canceled_event_object.rb b/lib/square/types/invoice_canceled_event_object.rb new file mode 100644 index 000000000..f04b8b5ad --- /dev/null +++ b/lib/square/types/invoice_canceled_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceCanceledEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_created_event.rb b/lib/square/types/invoice_created_event.rb new file mode 100644 index 000000000..bac3cf6bd --- /dev/null +++ b/lib/square/types/invoice_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Invoice](entity:Invoice) is created. + class InvoiceCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_created_event_data.rb b/lib/square/types/invoice_created_event_data.rb new file mode 100644 index 000000000..2bcaf1174 --- /dev/null +++ b/lib/square/types/invoice_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoiceCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_created_event_object.rb b/lib/square/types/invoice_created_event_object.rb new file mode 100644 index 000000000..b0d7b2fa1 --- /dev/null +++ b/lib/square/types/invoice_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceCreatedEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_custom_field.rb b/lib/square/types/invoice_custom_field.rb new file mode 100644 index 000000000..035a4fbc3 --- /dev/null +++ b/lib/square/types/invoice_custom_field.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # An additional seller-defined and customer-facing field to include on the invoice. For more information, + # see [Custom fields](https://developer.squareup.com/docs/invoices-api/overview#custom-fields). + # + # Adding custom fields to an invoice requires an + # [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + class InvoiceCustomField < Internal::Types::Model + field :label, String, optional: true, nullable: false + field :value, String, optional: true, nullable: false + field :placement, Square::Types::InvoiceCustomFieldPlacement, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_custom_field_placement.rb b/lib/square/types/invoice_custom_field_placement.rb new file mode 100644 index 000000000..f6e2998bd --- /dev/null +++ b/lib/square/types/invoice_custom_field_placement.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceCustomFieldPlacement + extend Square::Internal::Types::Enum + ABOVE_LINE_ITEMS = "ABOVE_LINE_ITEMS" + BELOW_LINE_ITEMS = "BELOW_LINE_ITEMS"end + end +end diff --git a/lib/square/types/invoice_deleted_event.rb b/lib/square/types/invoice_deleted_event.rb new file mode 100644 index 000000000..c3061beb7 --- /dev/null +++ b/lib/square/types/invoice_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a draft [Invoice](entity:Invoice) is deleted. + class InvoiceDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_deleted_event_data.rb b/lib/square/types/invoice_deleted_event_data.rb new file mode 100644 index 000000000..2b6b35218 --- /dev/null +++ b/lib/square/types/invoice_deleted_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :deleted, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_delivery_method.rb b/lib/square/types/invoice_delivery_method.rb new file mode 100644 index 000000000..cf7a9a67b --- /dev/null +++ b/lib/square/types/invoice_delivery_method.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceDeliveryMethod + extend Square::Internal::Types::Enum + EMAIL = "EMAIL" + SHARE_MANUALLY = "SHARE_MANUALLY" + SMS = "SMS"end + end +end diff --git a/lib/square/types/invoice_filter.rb b/lib/square/types/invoice_filter.rb new file mode 100644 index 000000000..1ec0b25d3 --- /dev/null +++ b/lib/square/types/invoice_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes query filters to apply. + class InvoiceFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: false, nullable: false + field :customer_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_payment_made_event.rb b/lib/square/types/invoice_payment_made_event.rb new file mode 100644 index 000000000..a739d4b73 --- /dev/null +++ b/lib/square/types/invoice_payment_made_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a payment that is associated with an [invoice](entity:Invoice) is completed. + # For more information about invoice payments, see [Pay an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#pay-invoice). + class InvoicePaymentMadeEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoicePaymentMadeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_payment_made_event_data.rb b/lib/square/types/invoice_payment_made_event_data.rb new file mode 100644 index 000000000..6c177aacf --- /dev/null +++ b/lib/square/types/invoice_payment_made_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoicePaymentMadeEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoicePaymentMadeEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_payment_made_event_object.rb b/lib/square/types/invoice_payment_made_event_object.rb new file mode 100644 index 000000000..c9d1ea11d --- /dev/null +++ b/lib/square/types/invoice_payment_made_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoicePaymentMadeEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_payment_reminder.rb b/lib/square/types/invoice_payment_reminder.rb new file mode 100644 index 000000000..83a5c9720 --- /dev/null +++ b/lib/square/types/invoice_payment_reminder.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a payment request reminder (automatic notification) that Square sends + # to the customer. You configure a reminder relative to the payment request + # `due_date`. + class InvoicePaymentReminder < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :relative_scheduled_days, Integer, optional: true, nullable: false + field :message, String, optional: true, nullable: false + field :status, Square::Types::InvoicePaymentReminderStatus, optional: true, nullable: false + field :sent_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_payment_reminder_status.rb b/lib/square/types/invoice_payment_reminder_status.rb new file mode 100644 index 000000000..b8d5e5e66 --- /dev/null +++ b/lib/square/types/invoice_payment_reminder_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoicePaymentReminderStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + NOT_APPLICABLE = "NOT_APPLICABLE" + SENT = "SENT"end + end +end diff --git a/lib/square/types/invoice_payment_request.rb b/lib/square/types/invoice_payment_request.rb new file mode 100644 index 000000000..75cc42068 --- /dev/null +++ b/lib/square/types/invoice_payment_request.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum + # of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information, + # see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests). + # + # Adding `INSTALLMENT` payment requests to an invoice requires an + # [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription). + class InvoicePaymentRequest < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :request_method, Square::Types::InvoiceRequestMethod, optional: true, nullable: false + field :request_type, Square::Types::InvoiceRequestType, optional: true, nullable: false + field :due_date, String, optional: true, nullable: false + field :fixed_amount_requested_money, Square::Types::Money, optional: true, nullable: false + field :percentage_requested, String, optional: true, nullable: false + field :tipping_enabled, Internal::Types::Boolean, optional: true, nullable: false + field :automatic_payment_source, Square::Types::InvoiceAutomaticPaymentSource, optional: true, nullable: false + field :card_id, String, optional: true, nullable: false + field :reminders, Internal::Types::Array[Square::Types::InvoicePaymentReminder], optional: true, nullable: false + field :computed_amount_money, Square::Types::Money, optional: true, nullable: false + field :total_completed_amount_money, Square::Types::Money, optional: true, nullable: false + field :rounding_adjustment_included_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_published_event.rb b/lib/square/types/invoice_published_event.rb new file mode 100644 index 000000000..eb4448eea --- /dev/null +++ b/lib/square/types/invoice_published_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Invoice](entity:Invoice) transitions from a draft to a non-draft status. + class InvoicePublishedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoicePublishedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_published_event_data.rb b/lib/square/types/invoice_published_event_data.rb new file mode 100644 index 000000000..eee593444 --- /dev/null +++ b/lib/square/types/invoice_published_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoicePublishedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoicePublishedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_published_event_object.rb b/lib/square/types/invoice_published_event_object.rb new file mode 100644 index 000000000..6b3df319c --- /dev/null +++ b/lib/square/types/invoice_published_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoicePublishedEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_query.rb b/lib/square/types/invoice_query.rb new file mode 100644 index 000000000..8dcc92f66 --- /dev/null +++ b/lib/square/types/invoice_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes query criteria for searching invoices. + class InvoiceQuery < Internal::Types::Model + field :filter, Square::Types::InvoiceFilter, optional: false, nullable: false + field :sort, Square::Types::InvoiceSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_recipient.rb b/lib/square/types/invoice_recipient.rb new file mode 100644 index 000000000..9d7ce2d0f --- /dev/null +++ b/lib/square/types/invoice_recipient.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a snapshot of customer data. This object stores customer data that is displayed on the invoice + # and that Square uses to deliver the invoice. + # + # When you provide a customer ID for a draft invoice, Square retrieves the associated customer profile and populates + # the remaining `InvoiceRecipient` fields. You cannot update these fields after the invoice is published. + # Square updates the customer ID in response to a merge operation, but does not update other fields. + class InvoiceRecipient < Internal::Types::Model + field :customer_id, String, optional: true, nullable: false + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :company_name, String, optional: true, nullable: false + field :tax_ids, Square::Types::InvoiceRecipientTaxIds, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_recipient_tax_ids.rb b/lib/square/types/invoice_recipient_tax_ids.rb new file mode 100644 index 000000000..bab1e7eb7 --- /dev/null +++ b/lib/square/types/invoice_recipient_tax_ids.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the tax IDs for an invoice recipient. The country of the seller account determines + # whether the corresponding `tax_ids` field is available for the customer. For more information, + # see [Invoice recipient tax IDs](https://developer.squareup.com/docs/invoices-api/overview#recipient-tax-ids). + class InvoiceRecipientTaxIds < Internal::Types::Model + field :eu_vat, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_refunded_event.rb b/lib/square/types/invoice_refunded_event.rb new file mode 100644 index 000000000..2272930f2 --- /dev/null +++ b/lib/square/types/invoice_refunded_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a refund is applied toward a payment of an [invoice](entity:Invoice). + # For more information about invoice refunds, see [Refund an invoice](https://developer.squareup.com/docs/invoices-api/pay-refund-invoices#refund-invoice). + class InvoiceRefundedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceRefundedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_refunded_event_data.rb b/lib/square/types/invoice_refunded_event_data.rb new file mode 100644 index 000000000..c6937bc61 --- /dev/null +++ b/lib/square/types/invoice_refunded_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceRefundedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoiceRefundedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_refunded_event_object.rb b/lib/square/types/invoice_refunded_event_object.rb new file mode 100644 index 000000000..c43e3a9ca --- /dev/null +++ b/lib/square/types/invoice_refunded_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceRefundedEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_request_method.rb b/lib/square/types/invoice_request_method.rb new file mode 100644 index 000000000..0d7dbdd3d --- /dev/null +++ b/lib/square/types/invoice_request_method.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceRequestMethod + extend Square::Internal::Types::Enum + EMAIL = "EMAIL" + CHARGE_CARD_ON_FILE = "CHARGE_CARD_ON_FILE" + SHARE_MANUALLY = "SHARE_MANUALLY" + CHARGE_BANK_ON_FILE = "CHARGE_BANK_ON_FILE" + SMS = "SMS" + SMS_CHARGE_CARD_ON_FILE = "SMS_CHARGE_CARD_ON_FILE" + SMS_CHARGE_BANK_ON_FILE = "SMS_CHARGE_BANK_ON_FILE"end + end +end diff --git a/lib/square/types/invoice_request_type.rb b/lib/square/types/invoice_request_type.rb new file mode 100644 index 000000000..a6956fdcf --- /dev/null +++ b/lib/square/types/invoice_request_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceRequestType + extend Square::Internal::Types::Enum + BALANCE = "BALANCE" + DEPOSIT = "DEPOSIT" + INSTALLMENT = "INSTALLMENT"end + end +end diff --git a/lib/square/types/invoice_scheduled_charge_failed_event.rb b/lib/square/types/invoice_scheduled_charge_failed_event.rb new file mode 100644 index 000000000..0cbd2cb3b --- /dev/null +++ b/lib/square/types/invoice_scheduled_charge_failed_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an automatic scheduled payment for an [Invoice](entity:Invoice) has failed. + class InvoiceScheduledChargeFailedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceScheduledChargeFailedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_scheduled_charge_failed_event_data.rb b/lib/square/types/invoice_scheduled_charge_failed_event_data.rb new file mode 100644 index 000000000..36a1961df --- /dev/null +++ b/lib/square/types/invoice_scheduled_charge_failed_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceScheduledChargeFailedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoiceScheduledChargeFailedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_scheduled_charge_failed_event_object.rb b/lib/square/types/invoice_scheduled_charge_failed_event_object.rb new file mode 100644 index 000000000..470a409d1 --- /dev/null +++ b/lib/square/types/invoice_scheduled_charge_failed_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceScheduledChargeFailedEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_sort.rb b/lib/square/types/invoice_sort.rb new file mode 100644 index 000000000..84d9f2d99 --- /dev/null +++ b/lib/square/types/invoice_sort.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Identifies the sort field and sort order. + class InvoiceSort < Internal::Types::Model + field :field, String, optional: false, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_status.rb b/lib/square/types/invoice_status.rb new file mode 100644 index 000000000..bec70adaa --- /dev/null +++ b/lib/square/types/invoice_status.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + module InvoiceStatus + extend Square::Internal::Types::Enum + DRAFT = "DRAFT" + UNPAID = "UNPAID" + SCHEDULED = "SCHEDULED" + PARTIALLY_PAID = "PARTIALLY_PAID" + PAID = "PAID" + PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED" + REFUNDED = "REFUNDED" + CANCELED = "CANCELED" + FAILED = "FAILED" + PAYMENT_PENDING = "PAYMENT_PENDING"end + end +end diff --git a/lib/square/types/invoice_updated_event.rb b/lib/square/types/invoice_updated_event.rb new file mode 100644 index 000000000..e030a219f --- /dev/null +++ b/lib/square/types/invoice_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Invoice](entity:Invoice) is updated. + class InvoiceUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::InvoiceUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_updated_event_data.rb b/lib/square/types/invoice_updated_event_data.rb new file mode 100644 index 000000000..5b2ce685c --- /dev/null +++ b/lib/square/types/invoice_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::InvoiceUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/invoice_updated_event_object.rb b/lib/square/types/invoice_updated_event_object.rb new file mode 100644 index 000000000..1c32165fe --- /dev/null +++ b/lib/square/types/invoice_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class InvoiceUpdatedEventObject < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/item_variation_location_overrides.rb b/lib/square/types/item_variation_location_overrides.rb new file mode 100644 index 000000000..715e00c68 --- /dev/null +++ b/lib/square/types/item_variation_location_overrides.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Price and inventory alerting overrides for a `CatalogItemVariation` at a specific `Location`. + class ItemVariationLocationOverrides < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :price_money, Square::Types::Money, optional: true, nullable: false + field :pricing_type, Square::Types::CatalogPricingType, optional: true, nullable: false + field :track_inventory, Internal::Types::Boolean, optional: true, nullable: false + field :inventory_alert_type, Square::Types::InventoryAlertType, optional: true, nullable: false + field :inventory_alert_threshold, Integer, optional: true, nullable: false + field :sold_out, Internal::Types::Boolean, optional: true, nullable: false + field :sold_out_valid_until, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job.rb b/lib/square/types/job.rb new file mode 100644 index 000000000..450cfd967 --- /dev/null +++ b/lib/square/types/job.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a job that can be assigned to [team members](entity:TeamMember). This object defines the + # job's title and tip eligibility. Compensation is defined in a [job assignment](entity:JobAssignment) + # in a team member's wage setting. + class Job < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :title, String, optional: true, nullable: false + field :is_tip_eligible, Internal::Types::Boolean, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_assignment.rb b/lib/square/types/job_assignment.rb new file mode 100644 index 000000000..d79404c0e --- /dev/null +++ b/lib/square/types/job_assignment.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a job assigned to a [team member](entity:TeamMember), including the compensation the team + # member earns for the job. Job assignments are listed in the team member's [wage setting](entity:WageSetting). + class JobAssignment < Internal::Types::Model + field :job_title, String, optional: true, nullable: false + field :pay_type, Square::Types::JobAssignmentPayType, optional: false, nullable: false + field :hourly_rate, Square::Types::Money, optional: true, nullable: false + field :annual_rate, Square::Types::Money, optional: true, nullable: false + field :weekly_hours, Integer, optional: true, nullable: false + field :job_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_assignment_pay_type.rb b/lib/square/types/job_assignment_pay_type.rb new file mode 100644 index 000000000..ad1577e84 --- /dev/null +++ b/lib/square/types/job_assignment_pay_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module JobAssignmentPayType + extend Square::Internal::Types::Enum + NONE = "NONE" + HOURLY = "HOURLY" + SALARY = "SALARY"end + end +end diff --git a/lib/square/types/job_created_event.rb b/lib/square/types/job_created_event.rb new file mode 100644 index 000000000..90fe002e7 --- /dev/null +++ b/lib/square/types/job_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Job is created. + class JobCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::JobCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_created_event_data.rb b/lib/square/types/job_created_event_data.rb new file mode 100644 index 000000000..574dc2ac5 --- /dev/null +++ b/lib/square/types/job_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class JobCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::JobCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_created_event_object.rb b/lib/square/types/job_created_event_object.rb new file mode 100644 index 000000000..cc9f24c6e --- /dev/null +++ b/lib/square/types/job_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class JobCreatedEventObject < Internal::Types::Model + field :job, Square::Types::Job, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_updated_event.rb b/lib/square/types/job_updated_event.rb new file mode 100644 index 000000000..b6a3c4378 --- /dev/null +++ b/lib/square/types/job_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Job is updated. + class JobUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::JobUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_updated_event_data.rb b/lib/square/types/job_updated_event_data.rb new file mode 100644 index 000000000..efe1845a1 --- /dev/null +++ b/lib/square/types/job_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class JobUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::JobUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/job_updated_event_object.rb b/lib/square/types/job_updated_event_object.rb new file mode 100644 index 000000000..12c1ce23b --- /dev/null +++ b/lib/square/types/job_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class JobUpdatedEventObject < Internal::Types::Model + field :job, Square::Types::Job, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_created_event.rb b/lib/square/types/labor_scheduled_shift_created_event.rb new file mode 100644 index 000000000..9f6002215 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [ScheduledShift](entity:ScheduledShift) is created. + class LaborScheduledShiftCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborScheduledShiftCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_created_event_data.rb b/lib/square/types/labor_scheduled_shift_created_event_data.rb new file mode 100644 index 000000000..d79ce5865 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborScheduledShiftCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_created_event_object.rb b/lib/square/types/labor_scheduled_shift_created_event_object.rb new file mode 100644 index 000000000..8ec3d5531 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftCreatedEventObject < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_deleted_event.rb b/lib/square/types/labor_scheduled_shift_deleted_event.rb new file mode 100644 index 000000000..099293f63 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_deleted_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [ScheduledShift](entity:ScheduledShift) is deleted. + class LaborScheduledShiftDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborScheduledShiftDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_deleted_event_data.rb b/lib/square/types/labor_scheduled_shift_deleted_event_data.rb new file mode 100644 index 000000000..864a4e6d7 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_deleted_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :deleted, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_published_event.rb b/lib/square/types/labor_scheduled_shift_published_event.rb new file mode 100644 index 000000000..95260e18c --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_published_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [ScheduledShift](entity:ScheduledShift) is published. + class LaborScheduledShiftPublishedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborScheduledShiftPublishedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_published_event_data.rb b/lib/square/types/labor_scheduled_shift_published_event_data.rb new file mode 100644 index 000000000..db05aef88 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_published_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftPublishedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborScheduledShiftPublishedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_published_event_object.rb b/lib/square/types/labor_scheduled_shift_published_event_object.rb new file mode 100644 index 000000000..8f008d716 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_published_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftPublishedEventObject < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_updated_event.rb b/lib/square/types/labor_scheduled_shift_updated_event.rb new file mode 100644 index 000000000..c3c549377 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [ScheduledShift](entity:ScheduledShift) is updated. + class LaborScheduledShiftUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborScheduledShiftUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_updated_event_data.rb b/lib/square/types/labor_scheduled_shift_updated_event_data.rb new file mode 100644 index 000000000..a34064f1f --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborScheduledShiftUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_scheduled_shift_updated_event_object.rb b/lib/square/types/labor_scheduled_shift_updated_event_object.rb new file mode 100644 index 000000000..002df54b0 --- /dev/null +++ b/lib/square/types/labor_scheduled_shift_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborScheduledShiftUpdatedEventObject < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_created_event.rb b/lib/square/types/labor_shift_created_event.rb new file mode 100644 index 000000000..0a21a36a3 --- /dev/null +++ b/lib/square/types/labor_shift_created_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a worker starts a [Shift](entity:Shift). + # + # Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.created`. + class LaborShiftCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborShiftCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_created_event_data.rb b/lib/square/types/labor_shift_created_event_data.rb new file mode 100644 index 000000000..74244baed --- /dev/null +++ b/lib/square/types/labor_shift_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborShiftCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborShiftCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_created_event_object.rb b/lib/square/types/labor_shift_created_event_object.rb new file mode 100644 index 000000000..c3bf0d27a --- /dev/null +++ b/lib/square/types/labor_shift_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborShiftCreatedEventObject < Internal::Types::Model + field :shift, Square::Types::Shift, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_deleted_event.rb b/lib/square/types/labor_shift_deleted_event.rb new file mode 100644 index 000000000..5fbdf4f62 --- /dev/null +++ b/lib/square/types/labor_shift_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Shift](entity:Shift) is deleted. + # + # Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.deleted`. + class LaborShiftDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborShiftDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_deleted_event_data.rb b/lib/square/types/labor_shift_deleted_event_data.rb new file mode 100644 index 000000000..caf0b6376 --- /dev/null +++ b/lib/square/types/labor_shift_deleted_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborShiftDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :deleted, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_updated_event.rb b/lib/square/types/labor_shift_updated_event.rb new file mode 100644 index 000000000..2c6c2e289 --- /dev/null +++ b/lib/square/types/labor_shift_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Shift](entity:Shift) is updated. + # + # Deprecated at Square API version 2025-05-21. Replaced by `labor.timecard.updated`. + class LaborShiftUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborShiftUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_updated_event_data.rb b/lib/square/types/labor_shift_updated_event_data.rb new file mode 100644 index 000000000..96ead0e7b --- /dev/null +++ b/lib/square/types/labor_shift_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborShiftUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborShiftUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_shift_updated_event_object.rb b/lib/square/types/labor_shift_updated_event_object.rb new file mode 100644 index 000000000..3243fa697 --- /dev/null +++ b/lib/square/types/labor_shift_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborShiftUpdatedEventObject < Internal::Types::Model + field :shift, Square::Types::Shift, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_created_event.rb b/lib/square/types/labor_timecard_created_event.rb new file mode 100644 index 000000000..7cde66d5f --- /dev/null +++ b/lib/square/types/labor_timecard_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a worker starts a [Timecard](entity:Timecard). + class LaborTimecardCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborTimecardCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_created_event_data.rb b/lib/square/types/labor_timecard_created_event_data.rb new file mode 100644 index 000000000..c41e31e34 --- /dev/null +++ b/lib/square/types/labor_timecard_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborTimecardCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborTimecardCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_created_event_object.rb b/lib/square/types/labor_timecard_created_event_object.rb new file mode 100644 index 000000000..b4d7d1f79 --- /dev/null +++ b/lib/square/types/labor_timecard_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborTimecardCreatedEventObject < Internal::Types::Model + field :timecard, Square::Types::Timecard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_deleted_event.rb b/lib/square/types/labor_timecard_deleted_event.rb new file mode 100644 index 000000000..090431c21 --- /dev/null +++ b/lib/square/types/labor_timecard_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Timecard](entity:Timecard) is deleted. + class LaborTimecardDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborTimecardDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_deleted_event_data.rb b/lib/square/types/labor_timecard_deleted_event_data.rb new file mode 100644 index 000000000..edd295b8a --- /dev/null +++ b/lib/square/types/labor_timecard_deleted_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborTimecardDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :deleted, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_updated_event.rb b/lib/square/types/labor_timecard_updated_event.rb new file mode 100644 index 000000000..46ad7d4d1 --- /dev/null +++ b/lib/square/types/labor_timecard_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Timecard](entity:Timecard) is updated. + class LaborTimecardUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LaborTimecardUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_updated_event_data.rb b/lib/square/types/labor_timecard_updated_event_data.rb new file mode 100644 index 000000000..d5be2f334 --- /dev/null +++ b/lib/square/types/labor_timecard_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborTimecardUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LaborTimecardUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/labor_timecard_updated_event_object.rb b/lib/square/types/labor_timecard_updated_event_object.rb new file mode 100644 index 000000000..218341786 --- /dev/null +++ b/lib/square/types/labor_timecard_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LaborTimecardUpdatedEventObject < Internal::Types::Model + field :timecard, Square::Types::Timecard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/link_customer_to_gift_card_response.rb b/lib/square/types/link_customer_to_gift_card_response.rb new file mode 100644 index 000000000..f82877697 --- /dev/null +++ b/lib/square/types/link_customer_to_gift_card_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains the linked `GiftCard` object. If the request resulted in errors, + # the response contains a set of `Error` objects. + class LinkCustomerToGiftCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_bank_accounts_response.rb b/lib/square/types/list_bank_accounts_response.rb new file mode 100644 index 000000000..2c91a8f50 --- /dev/null +++ b/lib/square/types/list_bank_accounts_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Response object returned by ListBankAccounts. + class ListBankAccountsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :bank_accounts, Internal::Types::Array[Square::Types::BankAccount], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_booking_custom_attribute_definitions_response.rb b/lib/square/types/list_booking_custom_attribute_definitions_response.rb new file mode 100644 index 000000000..0cc1d8b3b --- /dev/null +++ b/lib/square/types/list_booking_custom_attribute_definitions_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListBookingCustomAttributeDefinitions](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributeDefinitions) response. + # Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + # If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + class ListBookingCustomAttributeDefinitionsResponse < Internal::Types::Model + field :custom_attribute_definitions, Internal::Types::Array[Square::Types::CustomAttributeDefinition], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_booking_custom_attributes_response.rb b/lib/square/types/list_booking_custom_attributes_response.rb new file mode 100644 index 000000000..19c43f0be --- /dev/null +++ b/lib/square/types/list_booking_custom_attributes_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListBookingCustomAttributes](api-endpoint:BookingCustomAttributes-ListBookingCustomAttributes) response. + # Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + # results are available, the `cursor` field is also present along with `custom_attributes`. + class ListBookingCustomAttributesResponse < Internal::Types::Model + field :custom_attributes, Internal::Types::Array[Square::Types::CustomAttribute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_bookings_response.rb b/lib/square/types/list_bookings_response.rb new file mode 100644 index 000000000..43d2bc456 --- /dev/null +++ b/lib/square/types/list_bookings_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListBookingsResponse < Internal::Types::Model + field :bookings, Internal::Types::Array[Square::Types::Booking], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_break_types_response.rb b/lib/square/types/list_break_types_response.rb new file mode 100644 index 000000000..3cee61743 --- /dev/null +++ b/lib/square/types/list_break_types_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for a set of `BreakType` objects. The response contains + # the requested `BreakType` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class ListBreakTypesResponse < Internal::Types::Model + field :break_types, Internal::Types::Array[Square::Types::BreakType], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_cards_response.rb b/lib/square/types/list_cards_response.rb new file mode 100644 index 000000000..eca56d390 --- /dev/null +++ b/lib/square/types/list_cards_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListCards](api-endpoint:Cards-ListCards) endpoint. + # + # Note: if there are errors processing the request, the card field will not be + # present. + class ListCardsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cards, Internal::Types::Array[Square::Types::Card], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_cash_drawer_shift_events_response.rb b/lib/square/types/list_cash_drawer_shift_events_response.rb new file mode 100644 index 000000000..aa5bbdf32 --- /dev/null +++ b/lib/square/types/list_cash_drawer_shift_events_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListCashDrawerShiftEventsResponse < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cash_drawer_shift_events, Internal::Types::Array[Square::Types::CashDrawerShiftEvent], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_cash_drawer_shifts_response.rb b/lib/square/types/list_cash_drawer_shifts_response.rb new file mode 100644 index 000000000..55de3579a --- /dev/null +++ b/lib/square/types/list_cash_drawer_shifts_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListCashDrawerShiftsResponse < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cash_drawer_shifts, Internal::Types::Array[Square::Types::CashDrawerShiftSummary], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_catalog_response.rb b/lib/square/types/list_catalog_response.rb new file mode 100644 index 000000000..e823c3cfe --- /dev/null +++ b/lib/square/types/list_catalog_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListCatalogResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_customer_custom_attribute_definitions_response.rb b/lib/square/types/list_customer_custom_attribute_definitions_response.rb new file mode 100644 index 000000000..3d048ad11 --- /dev/null +++ b/lib/square/types/list_customer_custom_attribute_definitions_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListCustomerCustomAttributeDefinitions](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributeDefinitions) response. + # Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + # If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + class ListCustomerCustomAttributeDefinitionsResponse < Internal::Types::Model + field :custom_attribute_definitions, Internal::Types::Array[Square::Types::CustomAttributeDefinition], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_customer_custom_attributes_response.rb b/lib/square/types/list_customer_custom_attributes_response.rb new file mode 100644 index 000000000..f17cad45b --- /dev/null +++ b/lib/square/types/list_customer_custom_attributes_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListCustomerCustomAttributes](api-endpoint:CustomerCustomAttributes-ListCustomerCustomAttributes) response. + # Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + # results are available, the `cursor` field is also present along with `custom_attributes`. + class ListCustomerCustomAttributesResponse < Internal::Types::Model + field :custom_attributes, Internal::Types::Array[Square::Types::CustomAttribute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_customer_groups_response.rb b/lib/square/types/list_customer_groups_response.rb new file mode 100644 index 000000000..06a91753e --- /dev/null +++ b/lib/square/types/list_customer_groups_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListCustomerGroups](api-endpoint:CustomerGroups-ListCustomerGroups) endpoint. + # + # Either `errors` or `groups` is present in a given response (never both). + class ListCustomerGroupsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :groups, Internal::Types::Array[Square::Types::CustomerGroup], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_customer_segments_response.rb b/lib/square/types/list_customer_segments_response.rb new file mode 100644 index 000000000..620985f85 --- /dev/null +++ b/lib/square/types/list_customer_segments_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body for requests to the `ListCustomerSegments` endpoint. + # + # Either `errors` or `segments` is present in a given response (never both). + class ListCustomerSegmentsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :segments, Internal::Types::Array[Square::Types::CustomerSegment], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_customers_response.rb b/lib/square/types/list_customers_response.rb new file mode 100644 index 000000000..815da474d --- /dev/null +++ b/lib/square/types/list_customers_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `ListCustomers` endpoint. + # + # Either `errors` or `customers` is present in a given response (never both). + class ListCustomersResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :customers, Internal::Types::Array[Square::Types::Customer], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :count, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_device_codes_response.rb b/lib/square/types/list_device_codes_response.rb new file mode 100644 index 000000000..5c9de3136 --- /dev/null +++ b/lib/square/types/list_device_codes_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListDeviceCodesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :device_codes, Internal::Types::Array[Square::Types::DeviceCode], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_devices_response.rb b/lib/square/types/list_devices_response.rb new file mode 100644 index 000000000..6e2a0e095 --- /dev/null +++ b/lib/square/types/list_devices_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListDevicesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :devices, Internal::Types::Array[Square::Types::Device], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_dispute_evidence_response.rb b/lib/square/types/list_dispute_evidence_response.rb new file mode 100644 index 000000000..808699b25 --- /dev/null +++ b/lib/square/types/list_dispute_evidence_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `ListDisputeEvidence` response. + class ListDisputeEvidenceResponse < Internal::Types::Model + field :evidence, Internal::Types::Array[Square::Types::DisputeEvidence], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_disputes_response.rb b/lib/square/types/list_disputes_response.rb new file mode 100644 index 000000000..b136f34b3 --- /dev/null +++ b/lib/square/types/list_disputes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines fields in a `ListDisputes` response. + class ListDisputesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :disputes, Internal::Types::Array[Square::Types::Dispute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_employee_wages_response.rb b/lib/square/types/list_employee_wages_response.rb new file mode 100644 index 000000000..02824e63a --- /dev/null +++ b/lib/square/types/list_employee_wages_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for a set of `EmployeeWage` objects. The response contains + # a set of `EmployeeWage` objects. + class ListEmployeeWagesResponse < Internal::Types::Model + field :employee_wages, Internal::Types::Array[Square::Types::EmployeeWage], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_employees_response.rb b/lib/square/types/list_employees_response.rb new file mode 100644 index 000000000..c67e274e1 --- /dev/null +++ b/lib/square/types/list_employees_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListEmployeesResponse < Internal::Types::Model + field :employees, Internal::Types::Array[Square::Types::Employee], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_event_types_response.rb b/lib/square/types/list_event_types_response.rb new file mode 100644 index 000000000..f2dacd5df --- /dev/null +++ b/lib/square/types/list_event_types_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListEventTypes](api-endpoint:Events-ListEventTypes) endpoint. + # + # Note: if there are errors processing the request, the event types field will not be + # present. + class ListEventTypesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :event_types, Internal::Types::Array[String], optional: true, nullable: false + field :metadata, Internal::Types::Array[Square::Types::EventTypeMetadata], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_gift_card_activities_response.rb b/lib/square/types/list_gift_card_activities_response.rb new file mode 100644 index 000000000..a96a23509 --- /dev/null +++ b/lib/square/types/list_gift_card_activities_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a list of `GiftCardActivity` objects. If the request resulted in errors, + # the response contains a set of `Error` objects. + class ListGiftCardActivitiesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card_activities, Internal::Types::Array[Square::Types::GiftCardActivity], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_gift_cards_response.rb b/lib/square/types/list_gift_cards_response.rb new file mode 100644 index 000000000..38f0bf754 --- /dev/null +++ b/lib/square/types/list_gift_cards_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains a list of `GiftCard` objects. If the request resulted in errors, + # the response contains a set of `Error` objects. + class ListGiftCardsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_cards, Internal::Types::Array[Square::Types::GiftCard], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_invoices_response.rb b/lib/square/types/list_invoices_response.rb new file mode 100644 index 000000000..dc3a247c8 --- /dev/null +++ b/lib/square/types/list_invoices_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `ListInvoice` response. + class ListInvoicesResponse < Internal::Types::Model + field :invoices, Internal::Types::Array[Square::Types::Invoice], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_jobs_response.rb b/lib/square/types/list_jobs_response.rb new file mode 100644 index 000000000..c81f8c694 --- /dev/null +++ b/lib/square/types/list_jobs_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListJobs](api-endpoint:Team-ListJobs) response. Either `jobs` or `errors` + # is present in the response. If additional results are available, the `cursor` field is also present. + class ListJobsResponse < Internal::Types::Model + field :jobs, Internal::Types::Array[Square::Types::Job], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_location_booking_profiles_response.rb b/lib/square/types/list_location_booking_profiles_response.rb new file mode 100644 index 000000000..1f2aa78f1 --- /dev/null +++ b/lib/square/types/list_location_booking_profiles_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListLocationBookingProfilesResponse < Internal::Types::Model + field :location_booking_profiles, Internal::Types::Array[Square::Types::LocationBookingProfile], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_location_custom_attribute_definitions_response.rb b/lib/square/types/list_location_custom_attribute_definitions_response.rb new file mode 100644 index 000000000..2802a16cb --- /dev/null +++ b/lib/square/types/list_location_custom_attribute_definitions_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListLocationCustomAttributeDefinitions](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributeDefinitions) response. + # Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + # If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + class ListLocationCustomAttributeDefinitionsResponse < Internal::Types::Model + field :custom_attribute_definitions, Internal::Types::Array[Square::Types::CustomAttributeDefinition], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_location_custom_attributes_response.rb b/lib/square/types/list_location_custom_attributes_response.rb new file mode 100644 index 000000000..83fad6dce --- /dev/null +++ b/lib/square/types/list_location_custom_attributes_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListLocationCustomAttributes](api-endpoint:LocationCustomAttributes-ListLocationCustomAttributes) response. + # Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + # results are available, the `cursor` field is also present along with `custom_attributes`. + class ListLocationCustomAttributesResponse < Internal::Types::Model + field :custom_attributes, Internal::Types::Array[Square::Types::CustomAttribute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_locations_response.rb b/lib/square/types/list_locations_response.rb new file mode 100644 index 000000000..9adc9f404 --- /dev/null +++ b/lib/square/types/list_locations_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of a request + # to the [ListLocations](api-endpoint:Locations-ListLocations) endpoint. + # + # Either `errors` or `locations` is present in a given response (never both). + class ListLocationsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :locations, Internal::Types::Array[Square::Types::Location], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_loyalty_programs_response.rb b/lib/square/types/list_loyalty_programs_response.rb new file mode 100644 index 000000000..277c869df --- /dev/null +++ b/lib/square/types/list_loyalty_programs_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains all loyalty programs. + class ListLoyaltyProgramsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :programs, Internal::Types::Array[Square::Types::LoyaltyProgram], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_loyalty_promotions_response.rb b/lib/square/types/list_loyalty_promotions_response.rb new file mode 100644 index 000000000..5cfe6973d --- /dev/null +++ b/lib/square/types/list_loyalty_promotions_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListLoyaltyPromotions](api-endpoint:Loyalty-ListLoyaltyPromotions) response. + # One of `loyalty_promotions`, an empty object, or `errors` is present in the response. + # If additional results are available, the `cursor` field is also present along with `loyalty_promotions`. + class ListLoyaltyPromotionsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_promotions, Internal::Types::Array[Square::Types::LoyaltyPromotion], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_merchant_custom_attribute_definitions_response.rb b/lib/square/types/list_merchant_custom_attribute_definitions_response.rb new file mode 100644 index 000000000..0690f561c --- /dev/null +++ b/lib/square/types/list_merchant_custom_attribute_definitions_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListMerchantCustomAttributeDefinitions](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributeDefinitions) response. + # Either `custom_attribute_definitions`, an empty object, or `errors` is present in the response. + # If additional results are available, the `cursor` field is also present along with `custom_attribute_definitions`. + class ListMerchantCustomAttributeDefinitionsResponse < Internal::Types::Model + field :custom_attribute_definitions, Internal::Types::Array[Square::Types::CustomAttributeDefinition], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_merchant_custom_attributes_response.rb b/lib/square/types/list_merchant_custom_attributes_response.rb new file mode 100644 index 000000000..cbdaad3bf --- /dev/null +++ b/lib/square/types/list_merchant_custom_attributes_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [ListMerchantCustomAttributes](api-endpoint:MerchantCustomAttributes-ListMerchantCustomAttributes) response. + # Either `custom_attributes`, an empty object, or `errors` is present in the response. If additional + # results are available, the `cursor` field is also present along with `custom_attributes`. + class ListMerchantCustomAttributesResponse < Internal::Types::Model + field :custom_attributes, Internal::Types::Array[Square::Types::CustomAttribute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_merchants_response.rb b/lib/square/types/list_merchants_response.rb new file mode 100644 index 000000000..fda9aceed --- /dev/null +++ b/lib/square/types/list_merchants_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The response object returned by the [ListMerchant](api-endpoint:Merchants-ListMerchants) endpoint. + class ListMerchantsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :merchant, Internal::Types::Array[Square::Types::Merchant], optional: true, nullable: false + field :cursor, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_order_custom_attribute_definitions_response.rb b/lib/square/types/list_order_custom_attribute_definitions_response.rb new file mode 100644 index 000000000..5265dd232 --- /dev/null +++ b/lib/square/types/list_order_custom_attribute_definitions_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from listing order custom attribute definitions. + class ListOrderCustomAttributeDefinitionsResponse < Internal::Types::Model + field :custom_attribute_definitions, Internal::Types::Array[Square::Types::CustomAttributeDefinition], optional: false, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_order_custom_attributes_response.rb b/lib/square/types/list_order_custom_attributes_response.rb new file mode 100644 index 000000000..f9ef7e8f3 --- /dev/null +++ b/lib/square/types/list_order_custom_attributes_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from listing order custom attributes. + class ListOrderCustomAttributesResponse < Internal::Types::Model + field :custom_attributes, Internal::Types::Array[Square::Types::CustomAttribute], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_payment_links_response.rb b/lib/square/types/list_payment_links_response.rb new file mode 100644 index 000000000..2cae21163 --- /dev/null +++ b/lib/square/types/list_payment_links_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListPaymentLinksResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment_links, Internal::Types::Array[Square::Types::PaymentLink], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_payment_refunds_request_sort_field.rb b/lib/square/types/list_payment_refunds_request_sort_field.rb new file mode 100644 index 000000000..b4da17998 --- /dev/null +++ b/lib/square/types/list_payment_refunds_request_sort_field.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ListPaymentRefundsRequestSortField + extend Square::Internal::Types::Enum + CREATED_AT = "CREATED_AT" + UPDATED_AT = "UPDATED_AT"end + end +end diff --git a/lib/square/types/list_payment_refunds_response.rb b/lib/square/types/list_payment_refunds_response.rb new file mode 100644 index 000000000..bc193bcba --- /dev/null +++ b/lib/square/types/list_payment_refunds_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds). + # + # Either `errors` or `refunds` is present in a given response (never both). + class ListPaymentRefundsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refunds, Internal::Types::Array[Square::Types::PaymentRefund], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_payments_request_sort_field.rb b/lib/square/types/list_payments_request_sort_field.rb new file mode 100644 index 000000000..e185d9069 --- /dev/null +++ b/lib/square/types/list_payments_request_sort_field.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ListPaymentsRequestSortField + extend Square::Internal::Types::Enum + CREATED_AT = "CREATED_AT" + OFFLINE_CREATED_AT = "OFFLINE_CREATED_AT" + UPDATED_AT = "UPDATED_AT"end + end +end diff --git a/lib/square/types/list_payments_response.rb b/lib/square/types/list_payments_response.rb new file mode 100644 index 000000000..c36639a4f --- /dev/null +++ b/lib/square/types/list_payments_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by [ListPayments](api-endpoint:Payments-ListPayments). + class ListPaymentsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payments, Internal::Types::Array[Square::Types::Payment], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_payout_entries_response.rb b/lib/square/types/list_payout_entries_response.rb new file mode 100644 index 000000000..0c60ed8f3 --- /dev/null +++ b/lib/square/types/list_payout_entries_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to retrieve payout records entries. + class ListPayoutEntriesResponse < Internal::Types::Model + field :payout_entries, Internal::Types::Array[Square::Types::PayoutEntry], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_payouts_response.rb b/lib/square/types/list_payouts_response.rb new file mode 100644 index 000000000..acf635883 --- /dev/null +++ b/lib/square/types/list_payouts_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to retrieve payout records entries. + class ListPayoutsResponse < Internal::Types::Model + field :payouts, Internal::Types::Array[Square::Types::Payout], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_sites_response.rb b/lib/square/types/list_sites_response.rb new file mode 100644 index 000000000..60d2949ce --- /dev/null +++ b/lib/square/types/list_sites_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a `ListSites` response. The response can include either `sites` or `errors`. + class ListSitesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :sites, Internal::Types::Array[Square::Types::Site], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_subscription_events_response.rb b/lib/square/types/list_subscription_events_response.rb new file mode 100644 index 000000000..0007d00b1 --- /dev/null +++ b/lib/square/types/list_subscription_events_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [ListSubscriptionEvents](api-endpoint:Subscriptions-ListSubscriptionEvents). + class ListSubscriptionEventsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription_events, Internal::Types::Array[Square::Types::SubscriptionEvent], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_team_member_booking_profiles_response.rb b/lib/square/types/list_team_member_booking_profiles_response.rb new file mode 100644 index 000000000..91cd83aee --- /dev/null +++ b/lib/square/types/list_team_member_booking_profiles_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class ListTeamMemberBookingProfilesResponse < Internal::Types::Model + field :team_member_booking_profiles, Internal::Types::Array[Square::Types::TeamMemberBookingProfile], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_team_member_wages_response.rb b/lib/square/types/list_team_member_wages_response.rb new file mode 100644 index 000000000..677774045 --- /dev/null +++ b/lib/square/types/list_team_member_wages_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for a set of `TeamMemberWage` objects. The response contains + # a set of `TeamMemberWage` objects. + class ListTeamMemberWagesResponse < Internal::Types::Model + field :team_member_wages, Internal::Types::Array[Square::Types::TeamMemberWage], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_transactions_response.rb b/lib/square/types/list_transactions_response.rb new file mode 100644 index 000000000..7c595efc6 --- /dev/null +++ b/lib/square/types/list_transactions_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListTransactions](api-endpoint:Transactions-ListTransactions) endpoint. + # + # One of `errors` or `transactions` is present in a given response (never both). + class ListTransactionsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :transactions, Internal::Types::Array[Square::Types::Transaction], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_webhook_event_types_response.rb b/lib/square/types/list_webhook_event_types_response.rb new file mode 100644 index 000000000..c30cf7434 --- /dev/null +++ b/lib/square/types/list_webhook_event_types_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListWebhookEventTypes](api-endpoint:WebhookSubscriptions-ListWebhookEventTypes) endpoint. + # + # Note: if there are errors processing the request, the event types field will not be + # present. + class ListWebhookEventTypesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :event_types, Internal::Types::Array[String], optional: true, nullable: false + field :metadata, Internal::Types::Array[Square::Types::EventTypeMetadata], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_webhook_subscriptions_response.rb b/lib/square/types/list_webhook_subscriptions_response.rb new file mode 100644 index 000000000..34aecbca9 --- /dev/null +++ b/lib/square/types/list_webhook_subscriptions_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [ListWebhookSubscriptions](api-endpoint:WebhookSubscriptions-ListWebhookSubscriptions) endpoint. + # + # Note: if there are errors processing the request, the subscriptions field will not be + # present. + class ListWebhookSubscriptionsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscriptions, Internal::Types::Array[Square::Types::WebhookSubscription], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/list_workweek_configs_response.rb b/lib/square/types/list_workweek_configs_response.rb new file mode 100644 index 000000000..4c69b73cf --- /dev/null +++ b/lib/square/types/list_workweek_configs_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for a set of `WorkweekConfig` objects. The response contains + # the requested `WorkweekConfig` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class ListWorkweekConfigsResponse < Internal::Types::Model + field :workweek_configs, Internal::Types::Array[Square::Types::WorkweekConfig], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location.rb b/lib/square/types/location.rb new file mode 100644 index 000000000..783173f44 --- /dev/null +++ b/lib/square/types/location.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents one of a business' [locations](https://developer.squareup.com/docs/locations-api). + class Location < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :timezone, String, optional: true, nullable: false + field :capabilities, Internal::Types::Array[Square::Types::LocationCapability], optional: true, nullable: false + field :status, Square::Types::LocationStatus, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :country, Square::Types::Country, optional: true, nullable: false + field :language_code, String, optional: true, nullable: false + field :currency, Square::Types::Currency, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :business_name, String, optional: true, nullable: false + field :type, Square::Types::LocationType, optional: true, nullable: false + field :website_url, String, optional: true, nullable: false + field :business_hours, Square::Types::BusinessHours, optional: true, nullable: false + field :business_email, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :twitter_username, String, optional: true, nullable: false + field :instagram_username, String, optional: true, nullable: false + field :facebook_url, String, optional: true, nullable: false + field :coordinates, Square::Types::Coordinates, optional: true, nullable: false + field :logo_url, String, optional: true, nullable: false + field :pos_background_url, String, optional: true, nullable: false + field :mcc, String, optional: true, nullable: false + field :full_format_logo_url, String, optional: true, nullable: false + field :tax_ids, Square::Types::TaxIds, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_booking_profile.rb b/lib/square/types/location_booking_profile.rb new file mode 100644 index 000000000..780dd83b3 --- /dev/null +++ b/lib/square/types/location_booking_profile.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The booking profile of a seller's location, including the location's ID and whether the location is enabled for online booking. + class LocationBookingProfile < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :booking_site_url, String, optional: true, nullable: false + field :online_booking_enabled, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_capability.rb b/lib/square/types/location_capability.rb new file mode 100644 index 000000000..908a6802c --- /dev/null +++ b/lib/square/types/location_capability.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module LocationCapability + extend Square::Internal::Types::Enum + CREDIT_CARD_PROCESSING = "CREDIT_CARD_PROCESSING" + AUTOMATIC_TRANSFERS = "AUTOMATIC_TRANSFERS" + UNLINKED_REFUNDS = "UNLINKED_REFUNDS"end + end +end diff --git a/lib/square/types/location_created_event.rb b/lib/square/types/location_created_event.rb new file mode 100644 index 000000000..dba3f778c --- /dev/null +++ b/lib/square/types/location_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Location](entity:Location) is created. + class LocationCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LocationCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_created_event_data.rb b/lib/square/types/location_created_event_data.rb new file mode 100644 index 000000000..b9cc1bd48 --- /dev/null +++ b/lib/square/types/location_created_event_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class LocationCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_owned_created_event.rb b/lib/square/types/location_custom_attribute_definition_owned_created_event.rb new file mode 100644 index 000000000..9abd0630e --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_owned_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # is created by the subscribing application. + class LocationCustomAttributeDefinitionOwnedCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_owned_deleted_event.rb b/lib/square/types/location_custom_attribute_definition_owned_deleted_event.rb new file mode 100644 index 000000000..29cb5c6df --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_owned_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is deleted. A custom attribute definition can only be deleted by + # the application that created it. + class LocationCustomAttributeDefinitionOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_owned_updated_event.rb b/lib/square/types/location_custom_attribute_definition_owned_updated_event.rb new file mode 100644 index 000000000..32bb2d211 --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_owned_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # created by the subscribing application is updated. A custom attribute definition can only be updated + # by the application that created it. + class LocationCustomAttributeDefinitionOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_visible_created_event.rb b/lib/square/types/location_custom_attribute_definition_visible_created_event.rb new file mode 100644 index 000000000..f7ae4cdb0 --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_visible_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is created. A notification is sent when your application + # creates a custom attribute definition or another application creates a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class LocationCustomAttributeDefinitionVisibleCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_visible_deleted_event.rb b/lib/square/types/location_custom_attribute_definition_visible_deleted_event.rb new file mode 100644 index 000000000..4b342beb4 --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_visible_deleted_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is deleted. A custom attribute definition can only + # be deleted by the application that created it. A notification is sent when your application deletes + # a custom attribute definition or when another application deletes a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class LocationCustomAttributeDefinitionVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_definition_visible_updated_event.rb b/lib/square/types/location_custom_attribute_definition_visible_updated_event.rb new file mode 100644 index 000000000..4f4e932f1 --- /dev/null +++ b/lib/square/types/location_custom_attribute_definition_visible_updated_event.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is updated. A custom attribute definition can only be updated + # by the application that created it. A notification is sent when your application updates a custom attribute + # definition or when another application updates a custom attribute definition whose `visibility` is + # `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class LocationCustomAttributeDefinitionVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_owned_deleted_event.rb b/lib/square/types/location_custom_attribute_owned_deleted_event.rb new file mode 100644 index 000000000..ab380103e --- /dev/null +++ b/lib/square/types/location_custom_attribute_owned_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute](entity:CustomAttribute) + # owned by the subscribing application is deleted. Custom attributes are owned by the + # application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). + # Custom attributes whose `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application. + class LocationCustomAttributeOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_owned_updated_event.rb b/lib/square/types/location_custom_attribute_owned_updated_event.rb new file mode 100644 index 000000000..b47e1b856 --- /dev/null +++ b/lib/square/types/location_custom_attribute_owned_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute](entity:CustomAttribute) owned by the + # subscribing application is created or updated. Custom attributes are owned by the application that created + # the corresponding [custom attribute definition](entity:CustomAttributeDefinition). Custom attributes whose + # `visibility` is `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application. + class LocationCustomAttributeOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_visible_deleted_event.rb b/lib/square/types/location_custom_attribute_visible_deleted_event.rb new file mode 100644 index 000000000..0b3db9dcd --- /dev/null +++ b/lib/square/types/location_custom_attribute_visible_deleted_event.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute](entity:CustomAttribute) that is visible to the + # subscribing application is deleted. A notification is sent when: + # - Your application deletes a custom attribute owned by your application, regardless of the `visibility` setting. + # - Any application deletes a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` + # or `VISIBILITY_READ_WRITE_VALUES`. + # + # Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be deleted by any application, but those set to + # `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be deleted by the owner. Custom attributes are owned + # by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). + class LocationCustomAttributeVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_custom_attribute_visible_updated_event.rb b/lib/square/types/location_custom_attribute_visible_updated_event.rb new file mode 100644 index 000000000..cbbc007c1 --- /dev/null +++ b/lib/square/types/location_custom_attribute_visible_updated_event.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a location [custom attribute](entity:CustomAttribute) that is visible + # to the subscribing application is created or updated. A notification is sent when: + # - Your application creates or updates a custom attribute owned by your application, regardless of the `visibility` setting. + # - Any application creates or updates a custom attribute whose `visibility` is `VISIBILITY_READ_ONLY` + # or `VISIBILITY_READ_WRITE_VALUES`. + # + # Custom attributes set to `VISIBILITY_READ_WRITE_VALUES` can be created or updated by any application, but those set to + # `VISIBILITY_READ_ONLY` or `VISIBILITY_HIDDEN` can only be created or updated by the owner. Custom attributes are owned + # by the application that created the corresponding [custom attribute definition](entity:CustomAttributeDefinition). + class LocationCustomAttributeVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_settings_updated_event.rb b/lib/square/types/location_settings_updated_event.rb new file mode 100644 index 000000000..1ec94d606 --- /dev/null +++ b/lib/square/types/location_settings_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when online checkout location settings are updated + class LocationSettingsUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LocationSettingsUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_settings_updated_event_data.rb b/lib/square/types/location_settings_updated_event_data.rb new file mode 100644 index 000000000..a844546cc --- /dev/null +++ b/lib/square/types/location_settings_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class LocationSettingsUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LocationSettingsUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_settings_updated_event_object.rb b/lib/square/types/location_settings_updated_event_object.rb new file mode 100644 index 000000000..b69246987 --- /dev/null +++ b/lib/square/types/location_settings_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LocationSettingsUpdatedEventObject < Internal::Types::Model + field :location_settings, Square::Types::CheckoutLocationSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_status.rb b/lib/square/types/location_status.rb new file mode 100644 index 000000000..4e2a1c3b2 --- /dev/null +++ b/lib/square/types/location_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LocationStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + INACTIVE = "INACTIVE"end + end +end diff --git a/lib/square/types/location_type.rb b/lib/square/types/location_type.rb new file mode 100644 index 000000000..105a52c51 --- /dev/null +++ b/lib/square/types/location_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LocationType + extend Square::Internal::Types::Enum + PHYSICAL = "PHYSICAL" + MOBILE = "MOBILE"end + end +end diff --git a/lib/square/types/location_updated_event.rb b/lib/square/types/location_updated_event.rb new file mode 100644 index 000000000..02e98f0d0 --- /dev/null +++ b/lib/square/types/location_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Location](entity:Location) is updated. + class LocationUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LocationUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/location_updated_event_data.rb b/lib/square/types/location_updated_event_data.rb new file mode 100644 index 000000000..0d9b0aac4 --- /dev/null +++ b/lib/square/types/location_updated_event_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class LocationUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account.rb b/lib/square/types/loyalty_account.rb new file mode 100644 index 000000000..9a4f661d5 --- /dev/null +++ b/lib/square/types/loyalty_account.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a loyalty account in a [loyalty program](entity:LoyaltyProgram). For more information, see + # [Create and Retrieve Loyalty Accounts](https://developer.squareup.com/docs/loyalty-api/loyalty-accounts). + class LoyaltyAccount < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :program_id, String, optional: false, nullable: false + field :balance, Integer, optional: true, nullable: false + field :lifetime_points, Integer, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :enrolled_at, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :mapping, Square::Types::LoyaltyAccountMapping, optional: true, nullable: false + field :expiring_point_deadlines, Internal::Types::Array[Square::Types::LoyaltyAccountExpiringPointDeadline], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_created_event.rb b/lib/square/types/loyalty_account_created_event.rb new file mode 100644 index 000000000..4c5eef74c --- /dev/null +++ b/lib/square/types/loyalty_account_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty account](entity:LoyaltyAccount) is created. + class LoyaltyAccountCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyAccountCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_created_event_data.rb b/lib/square/types/loyalty_account_created_event_data.rb new file mode 100644 index 000000000..98c253b0a --- /dev/null +++ b/lib/square/types/loyalty_account_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.account.created` event. + class LoyaltyAccountCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyAccountCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_created_event_object.rb b/lib/square/types/loyalty_account_created_event_object.rb new file mode 100644 index 000000000..a8948c7bb --- /dev/null +++ b/lib/square/types/loyalty_account_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LoyaltyAccountCreatedEventObject < Internal::Types::Model + field :loyalty_account, Square::Types::LoyaltyAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_deleted_event.rb b/lib/square/types/loyalty_account_deleted_event.rb new file mode 100644 index 000000000..f6cdb19fa --- /dev/null +++ b/lib/square/types/loyalty_account_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty account](entity:LoyaltyAccount) is deleted. + class LoyaltyAccountDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyAccountDeletedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_deleted_event_data.rb b/lib/square/types/loyalty_account_deleted_event_data.rb new file mode 100644 index 000000000..b0c170e56 --- /dev/null +++ b/lib/square/types/loyalty_account_deleted_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.account.deleted` event. + class LoyaltyAccountDeletedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyAccountDeletedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_deleted_event_object.rb b/lib/square/types/loyalty_account_deleted_event_object.rb new file mode 100644 index 000000000..ec2618962 --- /dev/null +++ b/lib/square/types/loyalty_account_deleted_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LoyaltyAccountDeletedEventObject < Internal::Types::Model + field :loyalty_account, Square::Types::LoyaltyAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_expiring_point_deadline.rb b/lib/square/types/loyalty_account_expiring_point_deadline.rb new file mode 100644 index 000000000..66eca2bc1 --- /dev/null +++ b/lib/square/types/loyalty_account_expiring_point_deadline.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a set of points for a loyalty account that are scheduled to expire on a specific date. + class LoyaltyAccountExpiringPointDeadline < Internal::Types::Model + field :points, Integer, optional: false, nullable: false + field :expires_at, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_mapping.rb b/lib/square/types/loyalty_account_mapping.rb new file mode 100644 index 000000000..32ab39e99 --- /dev/null +++ b/lib/square/types/loyalty_account_mapping.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the mapping that associates a loyalty account with a buyer. + # + # Currently, a loyalty account can only be mapped to a buyer by phone number. For more information, see + # [Loyalty Overview](https://developer.squareup.com/docs/loyalty/overview). + class LoyaltyAccountMapping < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_updated_event.rb b/lib/square/types/loyalty_account_updated_event.rb new file mode 100644 index 000000000..c500412cc --- /dev/null +++ b/lib/square/types/loyalty_account_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty account](entity:LoyaltyAccount) is updated. + class LoyaltyAccountUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyAccountUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_updated_event_data.rb b/lib/square/types/loyalty_account_updated_event_data.rb new file mode 100644 index 000000000..c7688b390 --- /dev/null +++ b/lib/square/types/loyalty_account_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.account.updated` event. + class LoyaltyAccountUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyAccountUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_account_updated_event_object.rb b/lib/square/types/loyalty_account_updated_event_object.rb new file mode 100644 index 000000000..7f3a93bb1 --- /dev/null +++ b/lib/square/types/loyalty_account_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LoyaltyAccountUpdatedEventObject < Internal::Types::Model + field :loyalty_account, Square::Types::LoyaltyAccount, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event.rb b/lib/square/types/loyalty_event.rb new file mode 100644 index 000000000..127a949ce --- /dev/null +++ b/lib/square/types/loyalty_event.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides information about a loyalty event. + # For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). + class LoyaltyEvent < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :type, Square::Types::LoyaltyEventType, optional: false, nullable: false + field :created_at, String, optional: true, nullable: false + field :accumulate_points, Square::Types::LoyaltyEventAccumulatePoints, optional: true, nullable: false + field :create_reward, Square::Types::LoyaltyEventCreateReward, optional: true, nullable: false + field :redeem_reward, Square::Types::LoyaltyEventRedeemReward, optional: true, nullable: false + field :delete_reward, Square::Types::LoyaltyEventDeleteReward, optional: true, nullable: false + field :adjust_points, Square::Types::LoyaltyEventAdjustPoints, optional: true, nullable: false + field :loyalty_account_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :source, Square::Types::LoyaltyEventSource, optional: false, nullable: false + field :expire_points, Square::Types::LoyaltyEventExpirePoints, optional: true, nullable: false + field :other_event, Square::Types::LoyaltyEventOther, optional: true, nullable: false + field :accumulate_promotion_points, Square::Types::LoyaltyEventAccumulatePromotionPoints, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_accumulate_points.rb b/lib/square/types/loyalty_event_accumulate_points.rb new file mode 100644 index 000000000..c17988ea7 --- /dev/null +++ b/lib/square/types/loyalty_event_accumulate_points.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `ACCUMULATE_POINTS`. + class LoyaltyEventAccumulatePoints < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :points, Integer, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_accumulate_promotion_points.rb b/lib/square/types/loyalty_event_accumulate_promotion_points.rb new file mode 100644 index 000000000..d6f48f770 --- /dev/null +++ b/lib/square/types/loyalty_event_accumulate_promotion_points.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. + class LoyaltyEventAccumulatePromotionPoints < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :loyalty_promotion_id, String, optional: true, nullable: false + field :points, Integer, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_adjust_points.rb b/lib/square/types/loyalty_event_adjust_points.rb new file mode 100644 index 000000000..823be57ef --- /dev/null +++ b/lib/square/types/loyalty_event_adjust_points.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `ADJUST_POINTS`. + class LoyaltyEventAdjustPoints < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :points, Integer, optional: false, nullable: false + field :reason, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_create_reward.rb b/lib/square/types/loyalty_event_create_reward.rb new file mode 100644 index 000000000..b4df5a036 --- /dev/null +++ b/lib/square/types/loyalty_event_create_reward.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `CREATE_REWARD`. + class LoyaltyEventCreateReward < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :reward_id, String, optional: true, nullable: false + field :points, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_created_event.rb b/lib/square/types/loyalty_event_created_event.rb new file mode 100644 index 000000000..0c8de80b1 --- /dev/null +++ b/lib/square/types/loyalty_event_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty event](entity:LoyaltyEvent) is created. + class LoyaltyEventCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyEventCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_created_event_data.rb b/lib/square/types/loyalty_event_created_event_data.rb new file mode 100644 index 000000000..a95da8fd0 --- /dev/null +++ b/lib/square/types/loyalty_event_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.event.created` event. + class LoyaltyEventCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyEventCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_created_event_object.rb b/lib/square/types/loyalty_event_created_event_object.rb new file mode 100644 index 000000000..25183aa75 --- /dev/null +++ b/lib/square/types/loyalty_event_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class LoyaltyEventCreatedEventObject < Internal::Types::Model + field :loyalty_event, Square::Types::LoyaltyEvent, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_date_time_filter.rb b/lib/square/types/loyalty_event_date_time_filter.rb new file mode 100644 index 000000000..f1ecbd945 --- /dev/null +++ b/lib/square/types/loyalty_event_date_time_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter events by date time range. + class LoyaltyEventDateTimeFilter < Internal::Types::Model + field :created_at, Square::Types::TimeRange, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_delete_reward.rb b/lib/square/types/loyalty_event_delete_reward.rb new file mode 100644 index 000000000..62d0dcf57 --- /dev/null +++ b/lib/square/types/loyalty_event_delete_reward.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `DELETE_REWARD`. + class LoyaltyEventDeleteReward < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :reward_id, String, optional: true, nullable: false + field :points, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_expire_points.rb b/lib/square/types/loyalty_event_expire_points.rb new file mode 100644 index 000000000..8ec713032 --- /dev/null +++ b/lib/square/types/loyalty_event_expire_points.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `EXPIRE_POINTS`. + class LoyaltyEventExpirePoints < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :points, Integer, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_filter.rb b/lib/square/types/loyalty_event_filter.rb new file mode 100644 index 000000000..856745a66 --- /dev/null +++ b/lib/square/types/loyalty_event_filter.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # The filtering criteria. If the request specifies multiple filters, + # the endpoint uses a logical AND to evaluate them. + class LoyaltyEventFilter < Internal::Types::Model + field :loyalty_account_filter, Square::Types::LoyaltyEventLoyaltyAccountFilter, optional: true, nullable: false + field :type_filter, Square::Types::LoyaltyEventTypeFilter, optional: true, nullable: false + field :date_time_filter, Square::Types::LoyaltyEventDateTimeFilter, optional: true, nullable: false + field :location_filter, Square::Types::LoyaltyEventLocationFilter, optional: true, nullable: false + field :order_filter, Square::Types::LoyaltyEventOrderFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_location_filter.rb b/lib/square/types/loyalty_event_location_filter.rb new file mode 100644 index 000000000..68aba4d6a --- /dev/null +++ b/lib/square/types/loyalty_event_location_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter events by location. + class LoyaltyEventLocationFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_loyalty_account_filter.rb b/lib/square/types/loyalty_event_loyalty_account_filter.rb new file mode 100644 index 000000000..9284c9ba8 --- /dev/null +++ b/lib/square/types/loyalty_event_loyalty_account_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter events by loyalty account. + class LoyaltyEventLoyaltyAccountFilter < Internal::Types::Model + field :loyalty_account_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_order_filter.rb b/lib/square/types/loyalty_event_order_filter.rb new file mode 100644 index 000000000..4200bfd66 --- /dev/null +++ b/lib/square/types/loyalty_event_order_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter events by the order associated with the event. + class LoyaltyEventOrderFilter < Internal::Types::Model + field :order_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_other.rb b/lib/square/types/loyalty_event_other.rb new file mode 100644 index 000000000..f4ff31486 --- /dev/null +++ b/lib/square/types/loyalty_event_other.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `OTHER`. + class LoyaltyEventOther < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :points, Integer, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_query.rb b/lib/square/types/loyalty_event_query.rb new file mode 100644 index 000000000..71dabb611 --- /dev/null +++ b/lib/square/types/loyalty_event_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a query used to search for loyalty events. + class LoyaltyEventQuery < Internal::Types::Model + field :filter, Square::Types::LoyaltyEventFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_redeem_reward.rb b/lib/square/types/loyalty_event_redeem_reward.rb new file mode 100644 index 000000000..20c311e9a --- /dev/null +++ b/lib/square/types/loyalty_event_redeem_reward.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides metadata when the event `type` is `REDEEM_REWARD`. + class LoyaltyEventRedeemReward < Internal::Types::Model + field :loyalty_program_id, String, optional: true, nullable: false + field :reward_id, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_event_source.rb b/lib/square/types/loyalty_event_source.rb new file mode 100644 index 000000000..76d253e51 --- /dev/null +++ b/lib/square/types/loyalty_event_source.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyEventSource + extend Square::Internal::Types::Enum + SQUARE = "SQUARE" + LOYALTY_API = "LOYALTY_API"end + end +end diff --git a/lib/square/types/loyalty_event_type.rb b/lib/square/types/loyalty_event_type.rb new file mode 100644 index 000000000..63d6e2466 --- /dev/null +++ b/lib/square/types/loyalty_event_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyEventType + extend Square::Internal::Types::Enum + ACCUMULATE_POINTS = "ACCUMULATE_POINTS" + CREATE_REWARD = "CREATE_REWARD" + REDEEM_REWARD = "REDEEM_REWARD" + DELETE_REWARD = "DELETE_REWARD" + ADJUST_POINTS = "ADJUST_POINTS" + EXPIRE_POINTS = "EXPIRE_POINTS" + OTHER = "OTHER" + ACCUMULATE_PROMOTION_POINTS = "ACCUMULATE_PROMOTION_POINTS"end + end +end diff --git a/lib/square/types/loyalty_event_type_filter.rb b/lib/square/types/loyalty_event_type_filter.rb new file mode 100644 index 000000000..e63e55598 --- /dev/null +++ b/lib/square/types/loyalty_event_type_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter events by event type. + class LoyaltyEventTypeFilter < Internal::Types::Model + field :types, Internal::Types::Array[Square::Types::LoyaltyEventType], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program.rb b/lib/square/types/loyalty_program.rb new file mode 100644 index 000000000..57bfc4638 --- /dev/null +++ b/lib/square/types/loyalty_program.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a Square loyalty program. Loyalty programs define how buyers can earn points and redeem points for rewards. + # Square sellers can have only one loyalty program, which is created and managed from the Seller Dashboard. + # For more information, see [Loyalty Program Overview](https://developer.squareup.com/docs/loyalty/overview). + class LoyaltyProgram < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :status, Square::Types::LoyaltyProgramStatus, optional: true, nullable: false + field :reward_tiers, Internal::Types::Array[Square::Types::LoyaltyProgramRewardTier], optional: true, nullable: false + field :expiration_policy, Square::Types::LoyaltyProgramExpirationPolicy, optional: true, nullable: false + field :terminology, Square::Types::LoyaltyProgramTerminology, optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :accrual_rules, Internal::Types::Array[Square::Types::LoyaltyProgramAccrualRule], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule.rb b/lib/square/types/loyalty_program_accrual_rule.rb new file mode 100644 index 000000000..a9b418034 --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an accrual rule, which defines how buyers can earn points from the base [loyalty program](entity:LoyaltyProgram). + class LoyaltyProgramAccrualRule < Internal::Types::Model + field :accrual_type, Square::Types::LoyaltyProgramAccrualRuleType, optional: false, nullable: false + field :points, Integer, optional: true, nullable: false + field :visit_data, Square::Types::LoyaltyProgramAccrualRuleVisitData, optional: true, nullable: false + field :spend_data, Square::Types::LoyaltyProgramAccrualRuleSpendData, optional: true, nullable: false + field :item_variation_data, Square::Types::LoyaltyProgramAccrualRuleItemVariationData, optional: true, nullable: false + field :category_data, Square::Types::LoyaltyProgramAccrualRuleCategoryData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_category_data.rb b/lib/square/types/loyalty_program_accrual_rule_category_data.rb new file mode 100644 index 000000000..a8ec814a3 --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_category_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents additional data for rules with the `CATEGORY` accrual type. + class LoyaltyProgramAccrualRuleCategoryData < Internal::Types::Model + field :category_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_item_variation_data.rb b/lib/square/types/loyalty_program_accrual_rule_item_variation_data.rb new file mode 100644 index 000000000..ff9b6ab92 --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_item_variation_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents additional data for rules with the `ITEM_VARIATION` accrual type. + class LoyaltyProgramAccrualRuleItemVariationData < Internal::Types::Model + field :item_variation_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_spend_data.rb b/lib/square/types/loyalty_program_accrual_rule_spend_data.rb new file mode 100644 index 000000000..0756c9604 --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_spend_data.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents additional data for rules with the `SPEND` accrual type. + class LoyaltyProgramAccrualRuleSpendData < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :excluded_category_ids, Internal::Types::Array[String], optional: true, nullable: false + field :excluded_item_variation_ids, Internal::Types::Array[String], optional: true, nullable: false + field :tax_mode, Square::Types::LoyaltyProgramAccrualRuleTaxMode, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_tax_mode.rb b/lib/square/types/loyalty_program_accrual_rule_tax_mode.rb new file mode 100644 index 000000000..a4b8592ec --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_tax_mode.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyProgramAccrualRuleTaxMode + extend Square::Internal::Types::Enum + BEFORE_TAX = "BEFORE_TAX" + AFTER_TAX = "AFTER_TAX"end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_type.rb b/lib/square/types/loyalty_program_accrual_rule_type.rb new file mode 100644 index 000000000..0f6f0b76f --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyProgramAccrualRuleType + extend Square::Internal::Types::Enum + VISIT = "VISIT" + SPEND = "SPEND" + ITEM_VARIATION = "ITEM_VARIATION" + CATEGORY = "CATEGORY"end + end +end diff --git a/lib/square/types/loyalty_program_accrual_rule_visit_data.rb b/lib/square/types/loyalty_program_accrual_rule_visit_data.rb new file mode 100644 index 000000000..8c00e8c23 --- /dev/null +++ b/lib/square/types/loyalty_program_accrual_rule_visit_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents additional data for rules with the `VISIT` accrual type. + class LoyaltyProgramAccrualRuleVisitData < Internal::Types::Model + field :minimum_amount_money, Square::Types::Money, optional: true, nullable: false + field :tax_mode, Square::Types::LoyaltyProgramAccrualRuleTaxMode, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_created_event.rb b/lib/square/types/loyalty_program_created_event.rb new file mode 100644 index 000000000..2906190da --- /dev/null +++ b/lib/square/types/loyalty_program_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty program](entity:LoyaltyProgram) is created. + class LoyaltyProgramCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyProgramCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_created_event_data.rb b/lib/square/types/loyalty_program_created_event_data.rb new file mode 100644 index 000000000..eccaf5a3c --- /dev/null +++ b/lib/square/types/loyalty_program_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.program.created` event. + class LoyaltyProgramCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyProgramCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_created_event_object.rb b/lib/square/types/loyalty_program_created_event_object.rb new file mode 100644 index 000000000..f195414c1 --- /dev/null +++ b/lib/square/types/loyalty_program_created_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the loyalty program associated with a `loyalty.program.created` event. + class LoyaltyProgramCreatedEventObject < Internal::Types::Model + field :loyalty_program, Square::Types::LoyaltyProgram, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_expiration_policy.rb b/lib/square/types/loyalty_program_expiration_policy.rb new file mode 100644 index 000000000..0af317123 --- /dev/null +++ b/lib/square/types/loyalty_program_expiration_policy.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes when the loyalty program expires. + class LoyaltyProgramExpirationPolicy < Internal::Types::Model + field :expiration_duration, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_reward_tier.rb b/lib/square/types/loyalty_program_reward_tier.rb new file mode 100644 index 000000000..51e8ea830 --- /dev/null +++ b/lib/square/types/loyalty_program_reward_tier.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a reward tier in a loyalty program. A reward tier defines how buyers can redeem points for a reward, such as the number of points required and the value and scope of the discount. A loyalty program can offer multiple reward tiers. + class LoyaltyProgramRewardTier < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :points, Integer, optional: false, nullable: false + field :name, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :pricing_rule_reference, Square::Types::CatalogObjectReference, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_status.rb b/lib/square/types/loyalty_program_status.rb new file mode 100644 index 000000000..5e8bf6b72 --- /dev/null +++ b/lib/square/types/loyalty_program_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyProgramStatus + extend Square::Internal::Types::Enum + INACTIVE = "INACTIVE" + ACTIVE = "ACTIVE"end + end +end diff --git a/lib/square/types/loyalty_program_terminology.rb b/lib/square/types/loyalty_program_terminology.rb new file mode 100644 index 000000000..1b2d4aa94 --- /dev/null +++ b/lib/square/types/loyalty_program_terminology.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the naming used for loyalty points. + class LoyaltyProgramTerminology < Internal::Types::Model + field :one, String, optional: false, nullable: false + field :other, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_updated_event.rb b/lib/square/types/loyalty_program_updated_event.rb new file mode 100644 index 000000000..121435843 --- /dev/null +++ b/lib/square/types/loyalty_program_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty program](entity:LoyaltyProgram) is updated. + class LoyaltyProgramUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyProgramUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_updated_event_data.rb b/lib/square/types/loyalty_program_updated_event_data.rb new file mode 100644 index 000000000..9ab1e813b --- /dev/null +++ b/lib/square/types/loyalty_program_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.program.updated` event. + class LoyaltyProgramUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyProgramUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_program_updated_event_object.rb b/lib/square/types/loyalty_program_updated_event_object.rb new file mode 100644 index 000000000..427e083fb --- /dev/null +++ b/lib/square/types/loyalty_program_updated_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the loyalty program associated with a `loyalty.program.updated` event. + class LoyaltyProgramUpdatedEventObject < Internal::Types::Model + field :loyalty_program, Square::Types::LoyaltyProgram, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion.rb b/lib/square/types/loyalty_promotion.rb new file mode 100644 index 000000000..26efe2a88 --- /dev/null +++ b/lib/square/types/loyalty_promotion.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a promotion for a [loyalty program](entity:LoyaltyProgram). Loyalty promotions enable buyers + # to earn extra points on top of those earned from the base program. + # + # A loyalty program can have a maximum of 10 loyalty promotions with an `ACTIVE` or `SCHEDULED` status. + class LoyaltyPromotion < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: false, nullable: false + field :incentive, Square::Types::LoyaltyPromotionIncentive, optional: false, nullable: false + field :available_time, Square::Types::LoyaltyPromotionAvailableTimeData, optional: false, nullable: false + field :trigger_limit, Square::Types::LoyaltyPromotionTriggerLimit, optional: true, nullable: false + field :status, Square::Types::LoyaltyPromotionStatus, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :canceled_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :loyalty_program_id, String, optional: true, nullable: false + field :minimum_spend_amount_money, Square::Types::Money, optional: true, nullable: false + field :qualifying_item_variation_ids, Internal::Types::Array[String], optional: true, nullable: false + field :qualifying_category_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_available_time_data.rb b/lib/square/types/loyalty_promotion_available_time_data.rb new file mode 100644 index 000000000..68c88d823 --- /dev/null +++ b/lib/square/types/loyalty_promotion_available_time_data.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents scheduling information that determines when purchases can qualify to earn points + # from a [loyalty promotion](entity:LoyaltyPromotion). + class LoyaltyPromotionAvailableTimeData < Internal::Types::Model + field :start_date, String, optional: true, nullable: false + field :end_date, String, optional: true, nullable: false + field :time_periods, Internal::Types::Array[String], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_created_event.rb b/lib/square/types/loyalty_promotion_created_event.rb new file mode 100644 index 000000000..6e55a1cd9 --- /dev/null +++ b/lib/square/types/loyalty_promotion_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty promotion](entity:LoyaltyPromotion) is created. + class LoyaltyPromotionCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyPromotionCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_created_event_data.rb b/lib/square/types/loyalty_promotion_created_event_data.rb new file mode 100644 index 000000000..c5b1abc52 --- /dev/null +++ b/lib/square/types/loyalty_promotion_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.promotion.created` event. + class LoyaltyPromotionCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyPromotionCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_created_event_object.rb b/lib/square/types/loyalty_promotion_created_event_object.rb new file mode 100644 index 000000000..f46be08fa --- /dev/null +++ b/lib/square/types/loyalty_promotion_created_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the loyalty promotion associated with a `loyalty.promotion.created` event. + class LoyaltyPromotionCreatedEventObject < Internal::Types::Model + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_incentive.rb b/lib/square/types/loyalty_promotion_incentive.rb new file mode 100644 index 000000000..4ef325397 --- /dev/null +++ b/lib/square/types/loyalty_promotion_incentive.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents how points for a [loyalty promotion](entity:LoyaltyPromotion) are calculated, + # either by multiplying the points earned from the base program or by adding a specified number + # of points to the points earned from the base program. + class LoyaltyPromotionIncentive < Internal::Types::Model + field :type, Square::Types::LoyaltyPromotionIncentiveType, optional: false, nullable: false + field :points_multiplier_data, Square::Types::LoyaltyPromotionIncentivePointsMultiplierData, optional: true, nullable: false + field :points_addition_data, Square::Types::LoyaltyPromotionIncentivePointsAdditionData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_incentive_points_addition_data.rb b/lib/square/types/loyalty_promotion_incentive_points_addition_data.rb new file mode 100644 index 000000000..75ad1fd89 --- /dev/null +++ b/lib/square/types/loyalty_promotion_incentive_points_addition_data.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the metadata for a `POINTS_ADDITION` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). + class LoyaltyPromotionIncentivePointsAdditionData < Internal::Types::Model + field :points_addition, Integer, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_incentive_points_multiplier_data.rb b/lib/square/types/loyalty_promotion_incentive_points_multiplier_data.rb new file mode 100644 index 000000000..53d2202e5 --- /dev/null +++ b/lib/square/types/loyalty_promotion_incentive_points_multiplier_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the metadata for a `POINTS_MULTIPLIER` type of [loyalty promotion incentive](entity:LoyaltyPromotionIncentive). + class LoyaltyPromotionIncentivePointsMultiplierData < Internal::Types::Model + field :points_multiplier, Integer, optional: true, nullable: false + field :multiplier, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_incentive_type.rb b/lib/square/types/loyalty_promotion_incentive_type.rb new file mode 100644 index 000000000..664509570 --- /dev/null +++ b/lib/square/types/loyalty_promotion_incentive_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyPromotionIncentiveType + extend Square::Internal::Types::Enum + POINTS_MULTIPLIER = "POINTS_MULTIPLIER" + POINTS_ADDITION = "POINTS_ADDITION"end + end +end diff --git a/lib/square/types/loyalty_promotion_status.rb b/lib/square/types/loyalty_promotion_status.rb new file mode 100644 index 000000000..cbfb4aa68 --- /dev/null +++ b/lib/square/types/loyalty_promotion_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyPromotionStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + ENDED = "ENDED" + CANCELED = "CANCELED" + SCHEDULED = "SCHEDULED"end + end +end diff --git a/lib/square/types/loyalty_promotion_trigger_limit.rb b/lib/square/types/loyalty_promotion_trigger_limit.rb new file mode 100644 index 000000000..985b99054 --- /dev/null +++ b/lib/square/types/loyalty_promotion_trigger_limit.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the number of times a buyer can earn points during a [loyalty promotion](entity:LoyaltyPromotion). + # If this field is not set, buyers can trigger the promotion an unlimited number of times to earn points during + # the time that the promotion is available. + # + # A purchase that is disqualified from earning points because of this limit might qualify for another active promotion. + class LoyaltyPromotionTriggerLimit < Internal::Types::Model + field :times, Integer, optional: false, nullable: false + field :interval, Square::Types::LoyaltyPromotionTriggerLimitInterval, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_trigger_limit_interval.rb b/lib/square/types/loyalty_promotion_trigger_limit_interval.rb new file mode 100644 index 000000000..d9ee2bb13 --- /dev/null +++ b/lib/square/types/loyalty_promotion_trigger_limit_interval.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyPromotionTriggerLimitInterval + extend Square::Internal::Types::Enum + ALL_TIME = "ALL_TIME" + DAY = "DAY"end + end +end diff --git a/lib/square/types/loyalty_promotion_updated_event.rb b/lib/square/types/loyalty_promotion_updated_event.rb new file mode 100644 index 000000000..463d03766 --- /dev/null +++ b/lib/square/types/loyalty_promotion_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [loyalty promotion](entity:LoyaltyPromotion) is updated. This event is + # invoked only when a loyalty promotion is canceled. + class LoyaltyPromotionUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::LoyaltyPromotionUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_updated_event_data.rb b/lib/square/types/loyalty_promotion_updated_event_data.rb new file mode 100644 index 000000000..5c761ef63 --- /dev/null +++ b/lib/square/types/loyalty_promotion_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # The data associated with a `loyalty.promotion.updated` event. + class LoyaltyPromotionUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::LoyaltyPromotionUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_promotion_updated_event_object.rb b/lib/square/types/loyalty_promotion_updated_event_object.rb new file mode 100644 index 000000000..746806b2c --- /dev/null +++ b/lib/square/types/loyalty_promotion_updated_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that contains the loyalty promotion associated with a `loyalty.promotion.updated` event. + class LoyaltyPromotionUpdatedEventObject < Internal::Types::Model + field :loyalty_promotion, Square::Types::LoyaltyPromotion, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_reward.rb b/lib/square/types/loyalty_reward.rb new file mode 100644 index 000000000..8497eb6a5 --- /dev/null +++ b/lib/square/types/loyalty_reward.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a contract to redeem loyalty points for a [reward tier](entity:LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. + # For more information, see [Manage loyalty rewards](https://developer.squareup.com/docs/loyalty-api/loyalty-rewards). + class LoyaltyReward < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :status, Square::Types::LoyaltyRewardStatus, optional: true, nullable: false + field :loyalty_account_id, String, optional: false, nullable: false + field :reward_tier_id, String, optional: false, nullable: false + field :points, Integer, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :redeemed_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/loyalty_reward_status.rb b/lib/square/types/loyalty_reward_status.rb new file mode 100644 index 000000000..c4ec7d208 --- /dev/null +++ b/lib/square/types/loyalty_reward_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module LoyaltyRewardStatus + extend Square::Internal::Types::Enum + ISSUED = "ISSUED" + REDEEMED = "REDEEMED" + DELETED = "DELETED"end + end +end diff --git a/lib/square/types/measurement_unit.rb b/lib/square/types/measurement_unit.rb new file mode 100644 index 000000000..2e46b226f --- /dev/null +++ b/lib/square/types/measurement_unit.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a unit of measurement to use with a quantity, such as ounces + # or inches. Exactly one of the following fields are required: `custom_unit`, + # `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`. + class MeasurementUnit < Internal::Types::Model + field :custom_unit, Square::Types::MeasurementUnitCustom, optional: true, nullable: false + field :area_unit, Square::Types::MeasurementUnitArea, optional: true, nullable: false + field :length_unit, Square::Types::MeasurementUnitLength, optional: true, nullable: false + field :volume_unit, Square::Types::MeasurementUnitVolume, optional: true, nullable: false + field :weight_unit, Square::Types::MeasurementUnitWeight, optional: true, nullable: false + field :generic_unit, String, optional: true, nullable: false + field :time_unit, Square::Types::MeasurementUnitTime, optional: true, nullable: false + field :type, Square::Types::MeasurementUnitUnitType, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/measurement_unit_area.rb b/lib/square/types/measurement_unit_area.rb new file mode 100644 index 000000000..c02c15072 --- /dev/null +++ b/lib/square/types/measurement_unit_area.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitArea + extend Square::Internal::Types::Enum + IMPERIAL_ACRE = "IMPERIAL_ACRE" + IMPERIAL_SQUARE_INCH = "IMPERIAL_SQUARE_INCH" + IMPERIAL_SQUARE_FOOT = "IMPERIAL_SQUARE_FOOT" + IMPERIAL_SQUARE_YARD = "IMPERIAL_SQUARE_YARD" + IMPERIAL_SQUARE_MILE = "IMPERIAL_SQUARE_MILE" + METRIC_SQUARE_CENTIMETER = "METRIC_SQUARE_CENTIMETER" + METRIC_SQUARE_METER = "METRIC_SQUARE_METER" + METRIC_SQUARE_KILOMETER = "METRIC_SQUARE_KILOMETER"end + end +end diff --git a/lib/square/types/measurement_unit_custom.rb b/lib/square/types/measurement_unit_custom.rb new file mode 100644 index 000000000..9dc70bc7f --- /dev/null +++ b/lib/square/types/measurement_unit_custom.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The information needed to define a custom unit, provided by the seller. + class MeasurementUnitCustom < Internal::Types::Model + field :name, String, optional: false, nullable: false + field :abbreviation, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/measurement_unit_length.rb b/lib/square/types/measurement_unit_length.rb new file mode 100644 index 000000000..9bc9cbe78 --- /dev/null +++ b/lib/square/types/measurement_unit_length.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitLength + extend Square::Internal::Types::Enum + IMPERIAL_INCH = "IMPERIAL_INCH" + IMPERIAL_FOOT = "IMPERIAL_FOOT" + IMPERIAL_YARD = "IMPERIAL_YARD" + IMPERIAL_MILE = "IMPERIAL_MILE" + METRIC_MILLIMETER = "METRIC_MILLIMETER" + METRIC_CENTIMETER = "METRIC_CENTIMETER" + METRIC_METER = "METRIC_METER" + METRIC_KILOMETER = "METRIC_KILOMETER"end + end +end diff --git a/lib/square/types/measurement_unit_time.rb b/lib/square/types/measurement_unit_time.rb new file mode 100644 index 000000000..59e22967f --- /dev/null +++ b/lib/square/types/measurement_unit_time.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitTime + extend Square::Internal::Types::Enum + GENERIC_MILLISECOND = "GENERIC_MILLISECOND" + GENERIC_SECOND = "GENERIC_SECOND" + GENERIC_MINUTE = "GENERIC_MINUTE" + GENERIC_HOUR = "GENERIC_HOUR" + GENERIC_DAY = "GENERIC_DAY"end + end +end diff --git a/lib/square/types/measurement_unit_unit_type.rb b/lib/square/types/measurement_unit_unit_type.rb new file mode 100644 index 000000000..18705c63a --- /dev/null +++ b/lib/square/types/measurement_unit_unit_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitUnitType + extend Square::Internal::Types::Enum + TYPE_CUSTOM = "TYPE_CUSTOM" + TYPE_AREA = "TYPE_AREA" + TYPE_LENGTH = "TYPE_LENGTH" + TYPE_VOLUME = "TYPE_VOLUME" + TYPE_WEIGHT = "TYPE_WEIGHT" + TYPE_GENERIC = "TYPE_GENERIC"end + end +end diff --git a/lib/square/types/measurement_unit_volume.rb b/lib/square/types/measurement_unit_volume.rb new file mode 100644 index 000000000..f4ea8c0b9 --- /dev/null +++ b/lib/square/types/measurement_unit_volume.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitVolume + extend Square::Internal::Types::Enum + GENERIC_FLUID_OUNCE = "GENERIC_FLUID_OUNCE" + GENERIC_SHOT = "GENERIC_SHOT" + GENERIC_CUP = "GENERIC_CUP" + GENERIC_PINT = "GENERIC_PINT" + GENERIC_QUART = "GENERIC_QUART" + GENERIC_GALLON = "GENERIC_GALLON" + IMPERIAL_CUBIC_INCH = "IMPERIAL_CUBIC_INCH" + IMPERIAL_CUBIC_FOOT = "IMPERIAL_CUBIC_FOOT" + IMPERIAL_CUBIC_YARD = "IMPERIAL_CUBIC_YARD" + METRIC_MILLILITER = "METRIC_MILLILITER" + METRIC_LITER = "METRIC_LITER"end + end +end diff --git a/lib/square/types/measurement_unit_weight.rb b/lib/square/types/measurement_unit_weight.rb new file mode 100644 index 000000000..076cb572a --- /dev/null +++ b/lib/square/types/measurement_unit_weight.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module MeasurementUnitWeight + extend Square::Internal::Types::Enum + IMPERIAL_WEIGHT_OUNCE = "IMPERIAL_WEIGHT_OUNCE" + IMPERIAL_POUND = "IMPERIAL_POUND" + IMPERIAL_STONE = "IMPERIAL_STONE" + METRIC_MILLIGRAM = "METRIC_MILLIGRAM" + METRIC_GRAM = "METRIC_GRAM" + METRIC_KILOGRAM = "METRIC_KILOGRAM"end + end +end diff --git a/lib/square/types/merchant.rb b/lib/square/types/merchant.rb new file mode 100644 index 000000000..fc0a259c7 --- /dev/null +++ b/lib/square/types/merchant.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a business that sells with Square. + class Merchant < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :business_name, String, optional: true, nullable: false + field :country, Square::Types::Country, optional: false, nullable: false + field :language_code, String, optional: true, nullable: false + field :currency, Square::Types::Currency, optional: true, nullable: false + field :status, Square::Types::MerchantStatus, optional: true, nullable: false + field :main_location_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_owned_created_event.rb b/lib/square/types/merchant_custom_attribute_definition_owned_created_event.rb new file mode 100644 index 000000000..9f2782529 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_owned_created_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # is created by the subscribing application. Subscribe to this event to be notified + # when your application creates a merchant custom attribute definition. + class MerchantCustomAttributeDefinitionOwnedCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_owned_deleted_event.rb b/lib/square/types/merchant_custom_attribute_definition_owned_deleted_event.rb new file mode 100644 index 000000000..9d9460cc3 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_owned_deleted_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # is deleted by the subscribing application. Subscribe to this event to be notified + # when your application deletes a merchant custom attribute definition. + class MerchantCustomAttributeDefinitionOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_owned_updated_event.rb b/lib/square/types/merchant_custom_attribute_definition_owned_updated_event.rb new file mode 100644 index 000000000..69e82d1f1 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_owned_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # is updated by the subscribing application. Subscribe to this event to be notified + # when your application updates a merchant custom attribute definition. + class MerchantCustomAttributeDefinitionOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_visible_created_event.rb b/lib/square/types/merchant_custom_attribute_definition_visible_created_event.rb new file mode 100644 index 000000000..77c6a5fe2 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_visible_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is created. A notification is sent when your application + # creates a custom attribute definition or another application creates a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class MerchantCustomAttributeDefinitionVisibleCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_visible_deleted_event.rb b/lib/square/types/merchant_custom_attribute_definition_visible_deleted_event.rb new file mode 100644 index 000000000..887fa1049 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_visible_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is deleted. A notification is sent when your application + # deletes a custom attribute definition or another application deletes a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class MerchantCustomAttributeDefinitionVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_definition_visible_updated_event.rb b/lib/square/types/merchant_custom_attribute_definition_visible_updated_event.rb new file mode 100644 index 000000000..509959565 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_definition_visible_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute definition](entity:CustomAttributeDefinition) + # that is visible to the subscribing application is updated. A notification is sent when your application + # updates a custom attribute definition or another application updates a custom attribute definition whose + # `visibility` is `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES`. + class MerchantCustomAttributeDefinitionVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_owned_deleted_event.rb b/lib/square/types/merchant_custom_attribute_owned_deleted_event.rb new file mode 100644 index 000000000..145358e9d --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_owned_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute](entity:CustomAttribute) + # associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is + # owned by the subscribing application is deleted. Subscribe to this event to be notified + # when your application deletes a merchant custom attribute. + class MerchantCustomAttributeOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_owned_updated_event.rb b/lib/square/types/merchant_custom_attribute_owned_updated_event.rb new file mode 100644 index 000000000..611d15d45 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_owned_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute](entity:CustomAttribute) + # associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is + # owned by the subscribing application is updated. Subscribe to this event to be notified + # when your application updates a merchant custom attribute. + class MerchantCustomAttributeOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_visible_deleted_event.rb b/lib/square/types/merchant_custom_attribute_visible_deleted_event.rb new file mode 100644 index 000000000..e4d3665d6 --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_visible_deleted_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute](entity:CustomAttribute) with + # the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is deleted. + # An application that subscribes to this event is notified when a merchant custom attribute is deleted + # by any application for which the subscribing application has read access to the merchant custom attribute. + class MerchantCustomAttributeVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_custom_attribute_visible_updated_event.rb b/lib/square/types/merchant_custom_attribute_visible_updated_event.rb new file mode 100644 index 000000000..49d67211c --- /dev/null +++ b/lib/square/types/merchant_custom_attribute_visible_updated_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant [custom attribute](entity:CustomAttribute) with + # the `visibility` field set to `VISIBILITY_READ_ONLY` or `VISIBILITY_READ_WRITE_VALUES` is updated. + # An application that subscribes to this event is notified when a merchant custom attribute is updated + # by any application for which the subscribing application has read access to the merchant custom attribute. + class MerchantCustomAttributeVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_settings_updated_event.rb b/lib/square/types/merchant_settings_updated_event.rb new file mode 100644 index 000000000..63c3dc91d --- /dev/null +++ b/lib/square/types/merchant_settings_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when online checkout merchant settings are updated + class MerchantSettingsUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::MerchantSettingsUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_settings_updated_event_data.rb b/lib/square/types/merchant_settings_updated_event_data.rb new file mode 100644 index 000000000..53ba8d907 --- /dev/null +++ b/lib/square/types/merchant_settings_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class MerchantSettingsUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::MerchantSettingsUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_settings_updated_event_object.rb b/lib/square/types/merchant_settings_updated_event_object.rb new file mode 100644 index 000000000..6305573a5 --- /dev/null +++ b/lib/square/types/merchant_settings_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class MerchantSettingsUpdatedEventObject < Internal::Types::Model + field :merchant_settings, Square::Types::CheckoutMerchantSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/merchant_status.rb b/lib/square/types/merchant_status.rb new file mode 100644 index 000000000..9aee39b5c --- /dev/null +++ b/lib/square/types/merchant_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module MerchantStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + INACTIVE = "INACTIVE"end + end +end diff --git a/lib/square/types/modifier_location_overrides.rb b/lib/square/types/modifier_location_overrides.rb new file mode 100644 index 000000000..ed9a1cc96 --- /dev/null +++ b/lib/square/types/modifier_location_overrides.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Location-specific overrides for specified properties of a `CatalogModifier` object. + class ModifierLocationOverrides < Internal::Types::Model + field :location_id, String, optional: true, nullable: false + field :price_money, Square::Types::Money, optional: true, nullable: false + field :sold_out, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/money.rb b/lib/square/types/money.rb new file mode 100644 index 000000000..63ac286f2 --- /dev/null +++ b/lib/square/types/money.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an amount of money. `Money` fields can be signed or unsigned. + # Fields that do not explicitly define whether they are signed or unsigned are + # considered unsigned and can only hold positive amounts. For signed fields, the + # sign of the value indicates the purpose of the money transfer. See + # [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts) + # for more information. + class Money < Internal::Types::Model + field :amount, Integer, optional: true, nullable: false + field :currency, Square::Types::Currency, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/oauth_authorization_revoked_event.rb b/lib/square/types/oauth_authorization_revoked_event.rb new file mode 100644 index 000000000..aefce4ae2 --- /dev/null +++ b/lib/square/types/oauth_authorization_revoked_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a merchant/application revokes all access tokens and refresh tokens granted to an application. + class OauthAuthorizationRevokedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::OauthAuthorizationRevokedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/oauth_authorization_revoked_event_data.rb b/lib/square/types/oauth_authorization_revoked_event_data.rb new file mode 100644 index 000000000..3d5d21652 --- /dev/null +++ b/lib/square/types/oauth_authorization_revoked_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class OauthAuthorizationRevokedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::OauthAuthorizationRevokedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/oauth_authorization_revoked_event_object.rb b/lib/square/types/oauth_authorization_revoked_event_object.rb new file mode 100644 index 000000000..800eb407e --- /dev/null +++ b/lib/square/types/oauth_authorization_revoked_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class OauthAuthorizationRevokedEventObject < Internal::Types::Model + field :revocation, Square::Types::OauthAuthorizationRevokedEventRevocationObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/oauth_authorization_revoked_event_revocation_object.rb b/lib/square/types/oauth_authorization_revoked_event_revocation_object.rb new file mode 100644 index 000000000..ca35e0881 --- /dev/null +++ b/lib/square/types/oauth_authorization_revoked_event_revocation_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class OauthAuthorizationRevokedEventRevocationObject < Internal::Types::Model + field :revoked_at, String, optional: true, nullable: false + field :revoker_type, Square::Types::OauthAuthorizationRevokedEventRevokerType, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/oauth_authorization_revoked_event_revoker_type.rb b/lib/square/types/oauth_authorization_revoked_event_revoker_type.rb new file mode 100644 index 000000000..37b5050e8 --- /dev/null +++ b/lib/square/types/oauth_authorization_revoked_event_revoker_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OauthAuthorizationRevokedEventRevokerType + extend Square::Internal::Types::Enum + APPLICATION = "APPLICATION" + MERCHANT = "MERCHANT" + SQUARE = "SQUARE"end + end +end diff --git a/lib/square/types/obtain_token_response.rb b/lib/square/types/obtain_token_response.rb new file mode 100644 index 000000000..3df6631ae --- /dev/null +++ b/lib/square/types/obtain_token_response.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [ObtainToken](api-endpoint:OAuth-ObtainToken) response. + class ObtainTokenResponse < Internal::Types::Model + field :access_token, String, optional: true, nullable: false + field :token_type, String, optional: true, nullable: false + field :expires_at, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :subscription_id, String, optional: true, nullable: false + field :plan_id, String, optional: true, nullable: false + field :id_token, String, optional: true, nullable: false + field :refresh_token, String, optional: true, nullable: false + field :short_lived, Internal::Types::Boolean, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refresh_token_expires_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/offline_payment_details.rb b/lib/square/types/offline_payment_details.rb new file mode 100644 index 000000000..6128a8fe0 --- /dev/null +++ b/lib/square/types/offline_payment_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Details specific to offline payments. + class OfflinePaymentDetails < Internal::Types::Model + field :client_created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order.rb b/lib/square/types/order.rb new file mode 100644 index 000000000..d3270bf8f --- /dev/null +++ b/lib/square/types/order.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains all information related to a single order to process with Square, + # including line items that specify the products to purchase. `Order` objects also + # include information about any associated tenders, refunds, and returns. + # + # All Connect V2 Transactions have all been converted to Orders including all associated + # itemization data. + class Order < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :reference_id, String, optional: true, nullable: false + field :source, Square::Types::OrderSource, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :line_items, Internal::Types::Array[Square::Types::OrderLineItem], optional: true, nullable: false + field :taxes, Internal::Types::Array[Square::Types::OrderLineItemTax], optional: true, nullable: false + field :discounts, Internal::Types::Array[Square::Types::OrderLineItemDiscount], optional: true, nullable: false + field :service_charges, Internal::Types::Array[Square::Types::OrderServiceCharge], optional: true, nullable: false + field :fulfillments, Internal::Types::Array[Square::Types::Fulfillment], optional: true, nullable: false + field :returns, Internal::Types::Array[Square::Types::OrderReturn], optional: true, nullable: false + field :return_amounts, Square::Types::OrderMoneyAmounts, optional: true, nullable: false + field :net_amounts, Square::Types::OrderMoneyAmounts, optional: true, nullable: false + field :rounding_adjustment, Square::Types::OrderRoundingAdjustment, optional: true, nullable: false + field :tenders, Internal::Types::Array[Square::Types::Tender], optional: true, nullable: false + field :refunds, Internal::Types::Array[Square::Types::Refund], optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :closed_at, String, optional: true, nullable: false + field :state, Square::Types::OrderState, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :total_tax_money, Square::Types::Money, optional: true, nullable: false + field :total_discount_money, Square::Types::Money, optional: true, nullable: false + field :total_tip_money, Square::Types::Money, optional: true, nullable: false + field :total_service_charge_money, Square::Types::Money, optional: true, nullable: false + field :ticket_name, String, optional: true, nullable: false + field :pricing_options, Square::Types::OrderPricingOptions, optional: true, nullable: false + field :rewards, Internal::Types::Array[Square::Types::OrderReward], optional: true, nullable: false + field :net_amount_due_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_created.rb b/lib/square/types/order_created.rb new file mode 100644 index 000000000..1cfb2267c --- /dev/null +++ b/lib/square/types/order_created.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderCreated < Internal::Types::Model + field :order_id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :state, Square::Types::OrderState, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_created_event.rb b/lib/square/types/order_created_event.rb new file mode 100644 index 000000000..60e2cbfc7 --- /dev/null +++ b/lib/square/types/order_created_event.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Order](entity:Order) is created. This event is + # triggered only by the [CreateOrder](api-endpoint:Orders-CreateOrder) endpoint call. + # + # Creating an order in the Point of Sale app will **not** publish this event. + class OrderCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::OrderCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_created_event_data.rb b/lib/square/types/order_created_event_data.rb new file mode 100644 index 000000000..70fc79fe5 --- /dev/null +++ b/lib/square/types/order_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::OrderCreatedObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_created_object.rb b/lib/square/types/order_created_object.rb new file mode 100644 index 000000000..6b3525643 --- /dev/null +++ b/lib/square/types/order_created_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderCreatedObject < Internal::Types::Model + field :order_created, Square::Types::OrderCreated, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_owned_created_event.rb b/lib/square/types/order_custom_attribute_definition_owned_created_event.rb new file mode 100644 index 000000000..1f07859d4 --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_owned_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is created. + class OrderCustomAttributeDefinitionOwnedCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_owned_deleted_event.rb b/lib/square/types/order_custom_attribute_definition_owned_deleted_event.rb new file mode 100644 index 000000000..996524287 --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_owned_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. + class OrderCustomAttributeDefinitionOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_owned_updated_event.rb b/lib/square/types/order_custom_attribute_definition_owned_updated_event.rb new file mode 100644 index 000000000..9f3c8faaf --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_owned_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. + class OrderCustomAttributeDefinitionOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_visible_created_event.rb b/lib/square/types/order_custom_attribute_definition_visible_created_event.rb new file mode 100644 index 000000000..fbf3964e6 --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_visible_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is created. + class OrderCustomAttributeDefinitionVisibleCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_visible_deleted_event.rb b/lib/square/types/order_custom_attribute_definition_visible_deleted_event.rb new file mode 100644 index 000000000..1d9cdbe0d --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_visible_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is deleted. + class OrderCustomAttributeDefinitionVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_definition_visible_updated_event.rb b/lib/square/types/order_custom_attribute_definition_visible_updated_event.rb new file mode 100644 index 000000000..1f1cb1fca --- /dev/null +++ b/lib/square/types/order_custom_attribute_definition_visible_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute definition](entity:CustomAttributeDefinition) that is visible to the subscribing app is updated. + class OrderCustomAttributeDefinitionVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeDefinitionEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_owned_deleted_event.rb b/lib/square/types/order_custom_attribute_owned_deleted_event.rb new file mode 100644 index 000000000..584644db3 --- /dev/null +++ b/lib/square/types/order_custom_attribute_owned_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is deleted. + class OrderCustomAttributeOwnedDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_owned_updated_event.rb b/lib/square/types/order_custom_attribute_owned_updated_event.rb new file mode 100644 index 000000000..9304cd738 --- /dev/null +++ b/lib/square/types/order_custom_attribute_owned_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute](entity:CustomAttribute) associated with a [custom attribute definition](entity:CustomAttributeDefinition) that is owned by the subscribing app is updated. + class OrderCustomAttributeOwnedUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_visible_deleted_event.rb b/lib/square/types/order_custom_attribute_visible_deleted_event.rb new file mode 100644 index 000000000..d65f70409 --- /dev/null +++ b/lib/square/types/order_custom_attribute_visible_deleted_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is deleted. + class OrderCustomAttributeVisibleDeletedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_custom_attribute_visible_updated_event.rb b/lib/square/types/order_custom_attribute_visible_updated_event.rb new file mode 100644 index 000000000..673fc67ce --- /dev/null +++ b/lib/square/types/order_custom_attribute_visible_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an order [custom attribute](entity:CustomAttribute) that is visible to the subscribing app is updated. + class OrderCustomAttributeVisibleUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::CustomAttributeEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_entry.rb b/lib/square/types/order_entry.rb new file mode 100644 index 000000000..e47a24091 --- /dev/null +++ b/lib/square/types/order_entry.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A lightweight description of an [order](entity:Order) that is returned when + # `returned_entries` is `true` on a [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). + class OrderEntry < Internal::Types::Model + field :order_id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_fulfillment_delivery_details_schedule_type.rb b/lib/square/types/order_fulfillment_delivery_details_schedule_type.rb new file mode 100644 index 000000000..86edd92fc --- /dev/null +++ b/lib/square/types/order_fulfillment_delivery_details_schedule_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderFulfillmentDeliveryDetailsScheduleType + extend Square::Internal::Types::Enum + SCHEDULED = "SCHEDULED" + ASAP = "ASAP"end + end +end diff --git a/lib/square/types/order_fulfillment_fulfillment_line_item_application.rb b/lib/square/types/order_fulfillment_fulfillment_line_item_application.rb new file mode 100644 index 000000000..64d27e406 --- /dev/null +++ b/lib/square/types/order_fulfillment_fulfillment_line_item_application.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderFulfillmentFulfillmentLineItemApplication + extend Square::Internal::Types::Enum + ALL = "ALL" + ENTRY_LIST = "ENTRY_LIST"end + end +end diff --git a/lib/square/types/order_fulfillment_pickup_details_schedule_type.rb b/lib/square/types/order_fulfillment_pickup_details_schedule_type.rb new file mode 100644 index 000000000..d253ec74b --- /dev/null +++ b/lib/square/types/order_fulfillment_pickup_details_schedule_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderFulfillmentPickupDetailsScheduleType + extend Square::Internal::Types::Enum + SCHEDULED = "SCHEDULED" + ASAP = "ASAP"end + end +end diff --git a/lib/square/types/order_fulfillment_state.rb b/lib/square/types/order_fulfillment_state.rb new file mode 100644 index 000000000..7fa4a7d7c --- /dev/null +++ b/lib/square/types/order_fulfillment_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderFulfillmentState + extend Square::Internal::Types::Enum + PROPOSED = "PROPOSED" + RESERVED = "RESERVED" + PREPARED = "PREPARED" + COMPLETED = "COMPLETED" + CANCELED = "CANCELED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/order_fulfillment_type.rb b/lib/square/types/order_fulfillment_type.rb new file mode 100644 index 000000000..17f98f297 --- /dev/null +++ b/lib/square/types/order_fulfillment_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderFulfillmentType + extend Square::Internal::Types::Enum + PICKUP = "PICKUP" + SHIPMENT = "SHIPMENT" + DELIVERY = "DELIVERY"end + end +end diff --git a/lib/square/types/order_fulfillment_updated.rb b/lib/square/types/order_fulfillment_updated.rb new file mode 100644 index 000000000..838bc6c04 --- /dev/null +++ b/lib/square/types/order_fulfillment_updated.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderFulfillmentUpdated < Internal::Types::Model + field :order_id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :state, Square::Types::OrderState, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :fulfillment_update, Internal::Types::Array[Square::Types::OrderFulfillmentUpdatedUpdate], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_fulfillment_updated_event.rb b/lib/square/types/order_fulfillment_updated_event.rb new file mode 100644 index 000000000..8722a1117 --- /dev/null +++ b/lib/square/types/order_fulfillment_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [OrderFulfillment](entity:OrderFulfillment) + # is created or updated. This event is triggered only by the + # [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint call. + class OrderFulfillmentUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::OrderFulfillmentUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_fulfillment_updated_event_data.rb b/lib/square/types/order_fulfillment_updated_event_data.rb new file mode 100644 index 000000000..9991d3c16 --- /dev/null +++ b/lib/square/types/order_fulfillment_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderFulfillmentUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::OrderFulfillmentUpdatedObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_fulfillment_updated_object.rb b/lib/square/types/order_fulfillment_updated_object.rb new file mode 100644 index 000000000..a4b039434 --- /dev/null +++ b/lib/square/types/order_fulfillment_updated_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderFulfillmentUpdatedObject < Internal::Types::Model + field :order_fulfillment_updated, Square::Types::OrderFulfillmentUpdated, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_fulfillment_updated_update.rb b/lib/square/types/order_fulfillment_updated_update.rb new file mode 100644 index 000000000..57f85cb59 --- /dev/null +++ b/lib/square/types/order_fulfillment_updated_update.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Information about fulfillment updates. + class OrderFulfillmentUpdatedUpdate < Internal::Types::Model + field :fulfillment_uid, String, optional: true, nullable: false + field :old_state, Square::Types::FulfillmentState, optional: true, nullable: false + field :new_state, Square::Types::FulfillmentState, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item.rb b/lib/square/types/order_line_item.rb new file mode 100644 index 000000000..ce3e51da6 --- /dev/null +++ b/lib/square/types/order_line_item.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a line item in an order. Each line item describes a different + # product to purchase, with its own quantity and price details. + class OrderLineItem < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :quantity, String, optional: false, nullable: false + field :quantity_unit, Square::Types::OrderQuantityUnit, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :variation_name, String, optional: true, nullable: false + field :item_type, Square::Types::OrderLineItemItemType, optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :modifiers, Internal::Types::Array[Square::Types::OrderLineItemModifier], optional: true, nullable: false + field :applied_taxes, Internal::Types::Array[Square::Types::OrderLineItemAppliedTax], optional: true, nullable: false + field :applied_discounts, Internal::Types::Array[Square::Types::OrderLineItemAppliedDiscount], optional: true, nullable: false + field :applied_service_charges, Internal::Types::Array[Square::Types::OrderLineItemAppliedServiceCharge], optional: true, nullable: false + field :base_price_money, Square::Types::Money, optional: true, nullable: false + field :variation_total_price_money, Square::Types::Money, optional: true, nullable: false + field :gross_sales_money, Square::Types::Money, optional: true, nullable: false + field :total_tax_money, Square::Types::Money, optional: true, nullable: false + field :total_discount_money, Square::Types::Money, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :pricing_blocklists, Square::Types::OrderLineItemPricingBlocklists, optional: true, nullable: false + field :total_service_charge_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_applied_discount.rb b/lib/square/types/order_line_item_applied_discount.rb new file mode 100644 index 000000000..f0623496d --- /dev/null +++ b/lib/square/types/order_line_item_applied_discount.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an applied portion of a discount to a line item in an order. + # + # Order scoped discounts have automatically applied discounts present for each line item. + # Line-item scoped discounts must have applied discounts added manually for any applicable line + # items. The corresponding applied money is automatically computed based on participating + # line items. + class OrderLineItemAppliedDiscount < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :discount_uid, String, optional: false, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_applied_service_charge.rb b/lib/square/types/order_line_item_applied_service_charge.rb new file mode 100644 index 000000000..098535d03 --- /dev/null +++ b/lib/square/types/order_line_item_applied_service_charge.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderLineItemAppliedServiceCharge < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :service_charge_uid, String, optional: false, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_applied_tax.rb b/lib/square/types/order_line_item_applied_tax.rb new file mode 100644 index 000000000..c2bd7c257 --- /dev/null +++ b/lib/square/types/order_line_item_applied_tax.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an applied portion of a tax to a line item in an order. + # + # Order-scoped taxes automatically include the applied taxes in each line item. + # Line item taxes must be referenced from any applicable line items. + # The corresponding applied money is automatically computed, based on the + # set of participating line items. + class OrderLineItemAppliedTax < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :tax_uid, String, optional: false, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_discount.rb b/lib/square/types/order_line_item_discount.rb new file mode 100644 index 000000000..d6c5c79c5 --- /dev/null +++ b/lib/square/types/order_line_item_discount.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a discount that applies to one or more line items in an + # order. + # + # Fixed-amount, order-scoped discounts are distributed across all non-zero line item totals. + # The amount distributed to each line item is relative to the + # amount contributed by the item to the order subtotal. + class OrderLineItemDiscount < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :type, Square::Types::OrderLineItemDiscountType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :scope, Square::Types::OrderLineItemDiscountScope, optional: true, nullable: false + field :reward_ids, Internal::Types::Array[String], optional: true, nullable: false + field :pricing_rule_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_discount_scope.rb b/lib/square/types/order_line_item_discount_scope.rb new file mode 100644 index 000000000..c0c31bb6b --- /dev/null +++ b/lib/square/types/order_line_item_discount_scope.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderLineItemDiscountScope + extend Square::Internal::Types::Enum + OTHER_DISCOUNT_SCOPE = "OTHER_DISCOUNT_SCOPE" + LINE_ITEM = "LINE_ITEM" + ORDER = "ORDER"end + end +end diff --git a/lib/square/types/order_line_item_discount_type.rb b/lib/square/types/order_line_item_discount_type.rb new file mode 100644 index 000000000..17b4c846a --- /dev/null +++ b/lib/square/types/order_line_item_discount_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderLineItemDiscountType + extend Square::Internal::Types::Enum + UNKNOWN_DISCOUNT = "UNKNOWN_DISCOUNT" + FIXED_PERCENTAGE = "FIXED_PERCENTAGE" + FIXED_AMOUNT = "FIXED_AMOUNT" + VARIABLE_PERCENTAGE = "VARIABLE_PERCENTAGE" + VARIABLE_AMOUNT = "VARIABLE_AMOUNT"end + end +end diff --git a/lib/square/types/order_line_item_item_type.rb b/lib/square/types/order_line_item_item_type.rb new file mode 100644 index 000000000..57866021b --- /dev/null +++ b/lib/square/types/order_line_item_item_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderLineItemItemType + extend Square::Internal::Types::Enum + ITEM = "ITEM" + CUSTOM_AMOUNT = "CUSTOM_AMOUNT" + GIFT_CARD = "GIFT_CARD"end + end +end diff --git a/lib/square/types/order_line_item_modifier.rb b/lib/square/types/order_line_item_modifier.rb new file mode 100644 index 000000000..7774ce028 --- /dev/null +++ b/lib/square/types/order_line_item_modifier.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A [CatalogModifier](entity:CatalogModifier). + class OrderLineItemModifier < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + field :base_price_money, Square::Types::Money, optional: true, nullable: false + field :total_price_money, Square::Types::Money, optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_pricing_blocklists.rb b/lib/square/types/order_line_item_pricing_blocklists.rb new file mode 100644 index 000000000..8c6c4073d --- /dev/null +++ b/lib/square/types/order_line_item_pricing_blocklists.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes pricing adjustments that are blocked from automatic + # application to a line item. For more information, see + # [Apply Taxes and Discounts](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts). + class OrderLineItemPricingBlocklists < Internal::Types::Model + field :blocked_discounts, Internal::Types::Array[Square::Types::OrderLineItemPricingBlocklistsBlockedDiscount], optional: true, nullable: false + field :blocked_taxes, Internal::Types::Array[Square::Types::OrderLineItemPricingBlocklistsBlockedTax], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_pricing_blocklists_blocked_discount.rb b/lib/square/types/order_line_item_pricing_blocklists_blocked_discount.rb new file mode 100644 index 000000000..6e4b4a2eb --- /dev/null +++ b/lib/square/types/order_line_item_pricing_blocklists_blocked_discount.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A discount to block from applying to a line item. The discount must be + # identified by either `discount_uid` or `discount_catalog_object_id`, but not both. + class OrderLineItemPricingBlocklistsBlockedDiscount < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :discount_uid, String, optional: true, nullable: false + field :discount_catalog_object_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_pricing_blocklists_blocked_tax.rb b/lib/square/types/order_line_item_pricing_blocklists_blocked_tax.rb new file mode 100644 index 000000000..1190f52f5 --- /dev/null +++ b/lib/square/types/order_line_item_pricing_blocklists_blocked_tax.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A tax to block from applying to a line item. The tax must be + # identified by either `tax_uid` or `tax_catalog_object_id`, but not both. + class OrderLineItemPricingBlocklistsBlockedTax < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :tax_uid, String, optional: true, nullable: false + field :tax_catalog_object_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_tax.rb b/lib/square/types/order_line_item_tax.rb new file mode 100644 index 000000000..da5c83865 --- /dev/null +++ b/lib/square/types/order_line_item_tax.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a tax that applies to one or more line item in the order. + # + # Fixed-amount, order-scoped taxes are distributed across all non-zero line item totals. + # The amount distributed to each line item is relative to the amount the item + # contributes to the order subtotal. + class OrderLineItemTax < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :type, Square::Types::OrderLineItemTaxType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :scope, Square::Types::OrderLineItemTaxScope, optional: true, nullable: false + field :auto_applied, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_line_item_tax_scope.rb b/lib/square/types/order_line_item_tax_scope.rb new file mode 100644 index 000000000..61284a8e2 --- /dev/null +++ b/lib/square/types/order_line_item_tax_scope.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderLineItemTaxScope + extend Square::Internal::Types::Enum + OTHER_TAX_SCOPE = "OTHER_TAX_SCOPE" + LINE_ITEM = "LINE_ITEM" + ORDER = "ORDER"end + end +end diff --git a/lib/square/types/order_line_item_tax_type.rb b/lib/square/types/order_line_item_tax_type.rb new file mode 100644 index 000000000..5c79164e5 --- /dev/null +++ b/lib/square/types/order_line_item_tax_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderLineItemTaxType + extend Square::Internal::Types::Enum + UNKNOWN_TAX = "UNKNOWN_TAX" + ADDITIVE = "ADDITIVE" + INCLUSIVE = "INCLUSIVE"end + end +end diff --git a/lib/square/types/order_money_amounts.rb b/lib/square/types/order_money_amounts.rb new file mode 100644 index 000000000..b9d33edd7 --- /dev/null +++ b/lib/square/types/order_money_amounts.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # A collection of various money amounts. + class OrderMoneyAmounts < Internal::Types::Model + field :total_money, Square::Types::Money, optional: true, nullable: false + field :tax_money, Square::Types::Money, optional: true, nullable: false + field :discount_money, Square::Types::Money, optional: true, nullable: false + field :tip_money, Square::Types::Money, optional: true, nullable: false + field :service_charge_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_pricing_options.rb b/lib/square/types/order_pricing_options.rb new file mode 100644 index 000000000..96c81bff4 --- /dev/null +++ b/lib/square/types/order_pricing_options.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Pricing options for an order. The options affect how the order's price is calculated. + # They can be used, for example, to apply automatic price adjustments that are based on preconfigured + # [pricing rules](entity:CatalogPricingRule). + class OrderPricingOptions < Internal::Types::Model + field :auto_apply_discounts, Internal::Types::Boolean, optional: true, nullable: false + field :auto_apply_taxes, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_quantity_unit.rb b/lib/square/types/order_quantity_unit.rb new file mode 100644 index 000000000..6c96efb8f --- /dev/null +++ b/lib/square/types/order_quantity_unit.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains the measurement unit for a quantity and a precision that + # specifies the number of digits after the decimal point for decimal quantities. + class OrderQuantityUnit < Internal::Types::Model + field :measurement_unit, Square::Types::MeasurementUnit, optional: true, nullable: false + field :precision, Integer, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return.rb b/lib/square/types/order_return.rb new file mode 100644 index 000000000..cd31dd22d --- /dev/null +++ b/lib/square/types/order_return.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # The set of line items, service charges, taxes, discounts, tips, and other items being returned in an order. + class OrderReturn < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_order_id, String, optional: true, nullable: false + field :return_line_items, Internal::Types::Array[Square::Types::OrderReturnLineItem], optional: true, nullable: false + field :return_service_charges, Internal::Types::Array[Square::Types::OrderReturnServiceCharge], optional: true, nullable: false + field :return_taxes, Internal::Types::Array[Square::Types::OrderReturnTax], optional: true, nullable: false + field :return_discounts, Internal::Types::Array[Square::Types::OrderReturnDiscount], optional: true, nullable: false + field :return_tips, Internal::Types::Array[Square::Types::OrderReturnTip], optional: true, nullable: false + field :rounding_adjustment, Square::Types::OrderRoundingAdjustment, optional: true, nullable: false + field :return_amounts, Square::Types::OrderMoneyAmounts, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_discount.rb b/lib/square/types/order_return_discount.rb new file mode 100644 index 000000000..891d6ff91 --- /dev/null +++ b/lib/square/types/order_return_discount.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a discount being returned that applies to one or more return line items in an + # order. + # + # Fixed-amount, order-scoped discounts are distributed across all non-zero return line item totals. + # The amount distributed to each return line item is relative to that item’s contribution to the + # order subtotal. + class OrderReturnDiscount < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_discount_uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :type, Square::Types::OrderLineItemDiscountType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :scope, Square::Types::OrderLineItemDiscountScope, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_line_item.rb b/lib/square/types/order_return_line_item.rb new file mode 100644 index 000000000..0f8efe0e5 --- /dev/null +++ b/lib/square/types/order_return_line_item.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Square + module Types + # The line item being returned in an order. + class OrderReturnLineItem < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_line_item_uid, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :quantity, String, optional: false, nullable: false + field :quantity_unit, Square::Types::OrderQuantityUnit, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :variation_name, String, optional: true, nullable: false + field :item_type, Square::Types::OrderLineItemItemType, optional: true, nullable: false + field :return_modifiers, Internal::Types::Array[Square::Types::OrderReturnLineItemModifier], optional: true, nullable: false + field :applied_taxes, Internal::Types::Array[Square::Types::OrderLineItemAppliedTax], optional: true, nullable: false + field :applied_discounts, Internal::Types::Array[Square::Types::OrderLineItemAppliedDiscount], optional: true, nullable: false + field :base_price_money, Square::Types::Money, optional: true, nullable: false + field :variation_total_price_money, Square::Types::Money, optional: true, nullable: false + field :gross_return_money, Square::Types::Money, optional: true, nullable: false + field :total_tax_money, Square::Types::Money, optional: true, nullable: false + field :total_discount_money, Square::Types::Money, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :applied_service_charges, Internal::Types::Array[Square::Types::OrderLineItemAppliedServiceCharge], optional: true, nullable: false + field :total_service_charge_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_line_item_modifier.rb b/lib/square/types/order_return_line_item_modifier.rb new file mode 100644 index 000000000..09717d034 --- /dev/null +++ b/lib/square/types/order_return_line_item_modifier.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # A line item modifier being returned. + class OrderReturnLineItemModifier < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_modifier_uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :base_price_money, Square::Types::Money, optional: true, nullable: false + field :total_price_money, Square::Types::Money, optional: true, nullable: false + field :quantity, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_service_charge.rb b/lib/square/types/order_return_service_charge.rb new file mode 100644 index 000000000..111ba8859 --- /dev/null +++ b/lib/square/types/order_return_service_charge.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the service charge applied to the original order. + class OrderReturnServiceCharge < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_service_charge_uid, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :total_tax_money, Square::Types::Money, optional: true, nullable: false + field :calculation_phase, Square::Types::OrderServiceChargeCalculationPhase, optional: true, nullable: false + field :taxable, Internal::Types::Boolean, optional: true, nullable: false + field :applied_taxes, Internal::Types::Array[Square::Types::OrderLineItemAppliedTax], optional: true, nullable: false + field :treatment_type, Square::Types::OrderServiceChargeTreatmentType, optional: true, nullable: false + field :scope, Square::Types::OrderServiceChargeScope, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_tax.rb b/lib/square/types/order_return_tax.rb new file mode 100644 index 000000000..d6504da65 --- /dev/null +++ b/lib/square/types/order_return_tax.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a tax being returned that applies to one or more return line items in an order. + # + # Fixed-amount, order-scoped taxes are distributed across all non-zero return line item totals. + # The amount distributed to each return line item is relative to that item’s contribution to the + # order subtotal. + class OrderReturnTax < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :source_tax_uid, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :type, Square::Types::OrderLineItemTaxType, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :scope, Square::Types::OrderLineItemTaxScope, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_return_tip.rb b/lib/square/types/order_return_tip.rb new file mode 100644 index 000000000..8ae66ebac --- /dev/null +++ b/lib/square/types/order_return_tip.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A tip being returned. + class OrderReturnTip < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :source_tender_uid, String, optional: true, nullable: false + field :source_tender_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_reward.rb b/lib/square/types/order_reward.rb new file mode 100644 index 000000000..a0537da73 --- /dev/null +++ b/lib/square/types/order_reward.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a reward that can be applied to an order if the necessary + # reward tier criteria are met. Rewards are created through the Loyalty API. + class OrderReward < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :reward_tier_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/order_rounding_adjustment.rb b/lib/square/types/order_rounding_adjustment.rb new file mode 100644 index 000000000..3a0874fc0 --- /dev/null +++ b/lib/square/types/order_rounding_adjustment.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A rounding adjustment of the money being returned. Commonly used to apply cash rounding + # when the minimum unit of the account is smaller than the lowest physical denomination of the currency. + class OrderRoundingAdjustment < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_service_charge.rb b/lib/square/types/order_service_charge.rb new file mode 100644 index 000000000..ba5ca226f --- /dev/null +++ b/lib/square/types/order_service_charge.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a service charge applied to an order. + class OrderServiceCharge < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :catalog_object_id, String, optional: true, nullable: false + field :catalog_version, Integer, optional: true, nullable: false + field :percentage, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :applied_money, Square::Types::Money, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :total_tax_money, Square::Types::Money, optional: true, nullable: false + field :calculation_phase, Square::Types::OrderServiceChargeCalculationPhase, optional: true, nullable: false + field :taxable, Internal::Types::Boolean, optional: true, nullable: false + field :applied_taxes, Internal::Types::Array[Square::Types::OrderLineItemAppliedTax], optional: true, nullable: false + field :metadata, Internal::Types::Hash[String, String], optional: true, nullable: false + field :type, Square::Types::OrderServiceChargeType, optional: true, nullable: false + field :treatment_type, Square::Types::OrderServiceChargeTreatmentType, optional: true, nullable: false + field :scope, Square::Types::OrderServiceChargeScope, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_service_charge_calculation_phase.rb b/lib/square/types/order_service_charge_calculation_phase.rb new file mode 100644 index 000000000..fba711e7a --- /dev/null +++ b/lib/square/types/order_service_charge_calculation_phase.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderServiceChargeCalculationPhase + extend Square::Internal::Types::Enum + SUBTOTAL_PHASE = "SUBTOTAL_PHASE" + TOTAL_PHASE = "TOTAL_PHASE" + APPORTIONED_PERCENTAGE_PHASE = "APPORTIONED_PERCENTAGE_PHASE" + APPORTIONED_AMOUNT_PHASE = "APPORTIONED_AMOUNT_PHASE"end + end +end diff --git a/lib/square/types/order_service_charge_scope.rb b/lib/square/types/order_service_charge_scope.rb new file mode 100644 index 000000000..e48c83205 --- /dev/null +++ b/lib/square/types/order_service_charge_scope.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderServiceChargeScope + extend Square::Internal::Types::Enum + OTHER_SERVICE_CHARGE_SCOPE = "OTHER_SERVICE_CHARGE_SCOPE" + LINE_ITEM = "LINE_ITEM" + ORDER = "ORDER"end + end +end diff --git a/lib/square/types/order_service_charge_treatment_type.rb b/lib/square/types/order_service_charge_treatment_type.rb new file mode 100644 index 000000000..2a815fca7 --- /dev/null +++ b/lib/square/types/order_service_charge_treatment_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderServiceChargeTreatmentType + extend Square::Internal::Types::Enum + LINE_ITEM_TREATMENT = "LINE_ITEM_TREATMENT" + APPORTIONED_TREATMENT = "APPORTIONED_TREATMENT"end + end +end diff --git a/lib/square/types/order_service_charge_type.rb b/lib/square/types/order_service_charge_type.rb new file mode 100644 index 000000000..e8b3d7aef --- /dev/null +++ b/lib/square/types/order_service_charge_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderServiceChargeType + extend Square::Internal::Types::Enum + AUTO_GRATUITY = "AUTO_GRATUITY" + CUSTOM = "CUSTOM"end + end +end diff --git a/lib/square/types/order_source.rb b/lib/square/types/order_source.rb new file mode 100644 index 000000000..f4a56f768 --- /dev/null +++ b/lib/square/types/order_source.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the origination details of an order. + class OrderSource < Internal::Types::Model + field :name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_state.rb b/lib/square/types/order_state.rb new file mode 100644 index 000000000..8253bd936 --- /dev/null +++ b/lib/square/types/order_state.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module OrderState + extend Square::Internal::Types::Enum + OPEN = "OPEN" + COMPLETED = "COMPLETED" + CANCELED = "CANCELED" + DRAFT = "DRAFT"end + end +end diff --git a/lib/square/types/order_updated.rb b/lib/square/types/order_updated.rb new file mode 100644 index 000000000..abe5b1672 --- /dev/null +++ b/lib/square/types/order_updated.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderUpdated < Internal::Types::Model + field :order_id, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :state, Square::Types::OrderState, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_updated_event.rb b/lib/square/types/order_updated_event.rb new file mode 100644 index 000000000..25c380208 --- /dev/null +++ b/lib/square/types/order_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when an [Order](entity:Order) is updated. This + # event is triggered by the [UpdateOrder](api-endpoint:Orders-UpdateOrder) + # endpoint call, Order Manager, or the Square Dashboard. + class OrderUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::OrderUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_updated_event_data.rb b/lib/square/types/order_updated_event_data.rb new file mode 100644 index 000000000..2c0876e36 --- /dev/null +++ b/lib/square/types/order_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::OrderUpdatedObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/order_updated_object.rb b/lib/square/types/order_updated_object.rb new file mode 100644 index 000000000..b93ff3e20 --- /dev/null +++ b/lib/square/types/order_updated_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class OrderUpdatedObject < Internal::Types::Model + field :order_updated, Square::Types::OrderUpdated, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/pause_subscription_response.rb b/lib/square/types/pause_subscription_response.rb new file mode 100644 index 000000000..cc8228cf2 --- /dev/null +++ b/lib/square/types/pause_subscription_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [PauseSubscription](api-endpoint:Subscriptions-PauseSubscription) endpoint. + class PauseSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/pay_order_response.rb b/lib/square/types/pay_order_response.rb new file mode 100644 index 000000000..247867fcb --- /dev/null +++ b/lib/square/types/pay_order_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of a request to the + # [PayOrder](api-endpoint:Orders-PayOrder) endpoint. + class PayOrderResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :order, Square::Types::Order, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment.rb b/lib/square/types/payment.rb new file mode 100644 index 000000000..086e66636 --- /dev/null +++ b/lib/square/types/payment.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a payment processed by the Square API. + class Payment < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :tip_money, Square::Types::Money, optional: true, nullable: false + field :total_money, Square::Types::Money, optional: true, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :approved_money, Square::Types::Money, optional: true, nullable: false + field :processing_fee, Internal::Types::Array[Square::Types::ProcessingFee], optional: true, nullable: false + field :refunded_money, Square::Types::Money, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :delay_duration, String, optional: true, nullable: false + field :delay_action, String, optional: true, nullable: false + field :delayed_until, String, optional: true, nullable: false + field :source_type, String, optional: true, nullable: false + field :card_details, Square::Types::CardPaymentDetails, optional: true, nullable: false + field :cash_details, Square::Types::CashPaymentDetails, optional: true, nullable: false + field :bank_account_details, Square::Types::BankAccountPaymentDetails, optional: true, nullable: false + field :external_details, Square::Types::ExternalPaymentDetails, optional: true, nullable: false + field :wallet_details, Square::Types::DigitalWalletDetails, optional: true, nullable: false + field :buy_now_pay_later_details, Square::Types::BuyNowPayLaterDetails, optional: true, nullable: false + field :square_account_details, Square::Types::SquareAccountDetails, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :refund_ids, Internal::Types::Array[String], optional: true, nullable: false + field :risk_evaluation, Square::Types::RiskEvaluation, optional: true, nullable: false + field :terminal_checkout_id, String, optional: true, nullable: false + field :buyer_email_address, String, optional: true, nullable: false + field :billing_address, Square::Types::Address, optional: true, nullable: false + field :shipping_address, Square::Types::Address, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :statement_description_identifier, String, optional: true, nullable: false + field :capabilities, Internal::Types::Array[String], optional: true, nullable: false + field :receipt_number, String, optional: true, nullable: false + field :receipt_url, String, optional: true, nullable: false + field :device_details, Square::Types::DeviceDetails, optional: true, nullable: false + field :application_details, Square::Types::ApplicationDetails, optional: true, nullable: false + field :is_offline_payment, Internal::Types::Boolean, optional: true, nullable: false + field :offline_payment_details, Square::Types::OfflinePaymentDetails, optional: true, nullable: false + field :version_token, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_app_fee_refund_detail.rb b/lib/square/types/payment_balance_activity_app_fee_refund_detail.rb new file mode 100644 index 000000000..e16125aef --- /dev/null +++ b/lib/square/types/payment_balance_activity_app_fee_refund_detail.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityAppFeeRefundDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :refund_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_app_fee_revenue_detail.rb b/lib/square/types/payment_balance_activity_app_fee_revenue_detail.rb new file mode 100644 index 000000000..2437e5e39 --- /dev/null +++ b/lib/square/types/payment_balance_activity_app_fee_revenue_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityAppFeeRevenueDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_automatic_savings_detail.rb b/lib/square/types/payment_balance_activity_automatic_savings_detail.rb new file mode 100644 index 000000000..1d8a80cae --- /dev/null +++ b/lib/square/types/payment_balance_activity_automatic_savings_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityAutomaticSavingsDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :payout_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_automatic_savings_reversed_detail.rb b/lib/square/types/payment_balance_activity_automatic_savings_reversed_detail.rb new file mode 100644 index 000000000..1481f7a30 --- /dev/null +++ b/lib/square/types/payment_balance_activity_automatic_savings_reversed_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityAutomaticSavingsReversedDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :payout_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_charge_detail.rb b/lib/square/types/payment_balance_activity_charge_detail.rb new file mode 100644 index 000000000..380af0fdb --- /dev/null +++ b/lib/square/types/payment_balance_activity_charge_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityChargeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_deposit_fee_detail.rb b/lib/square/types/payment_balance_activity_deposit_fee_detail.rb new file mode 100644 index 000000000..d343ee840 --- /dev/null +++ b/lib/square/types/payment_balance_activity_deposit_fee_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityDepositFeeDetail < Internal::Types::Model + field :payout_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_deposit_fee_reversed_detail.rb b/lib/square/types/payment_balance_activity_deposit_fee_reversed_detail.rb new file mode 100644 index 000000000..460c76246 --- /dev/null +++ b/lib/square/types/payment_balance_activity_deposit_fee_reversed_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityDepositFeeReversedDetail < Internal::Types::Model + field :payout_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_dispute_detail.rb b/lib/square/types/payment_balance_activity_dispute_detail.rb new file mode 100644 index 000000000..cb0e9d02d --- /dev/null +++ b/lib/square/types/payment_balance_activity_dispute_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityDisputeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :dispute_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_fee_detail.rb b/lib/square/types/payment_balance_activity_fee_detail.rb new file mode 100644 index 000000000..bea0b12c2 --- /dev/null +++ b/lib/square/types/payment_balance_activity_fee_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityFeeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_free_processing_detail.rb b/lib/square/types/payment_balance_activity_free_processing_detail.rb new file mode 100644 index 000000000..17f117c32 --- /dev/null +++ b/lib/square/types/payment_balance_activity_free_processing_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityFreeProcessingDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_hold_adjustment_detail.rb b/lib/square/types/payment_balance_activity_hold_adjustment_detail.rb new file mode 100644 index 000000000..f3c0f3b8e --- /dev/null +++ b/lib/square/types/payment_balance_activity_hold_adjustment_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityHoldAdjustmentDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_open_dispute_detail.rb b/lib/square/types/payment_balance_activity_open_dispute_detail.rb new file mode 100644 index 000000000..1b6bef85c --- /dev/null +++ b/lib/square/types/payment_balance_activity_open_dispute_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityOpenDisputeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :dispute_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_other_adjustment_detail.rb b/lib/square/types/payment_balance_activity_other_adjustment_detail.rb new file mode 100644 index 000000000..f685d9621 --- /dev/null +++ b/lib/square/types/payment_balance_activity_other_adjustment_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityOtherAdjustmentDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_other_detail.rb b/lib/square/types/payment_balance_activity_other_detail.rb new file mode 100644 index 000000000..48755e44a --- /dev/null +++ b/lib/square/types/payment_balance_activity_other_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityOtherDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_refund_detail.rb b/lib/square/types/payment_balance_activity_refund_detail.rb new file mode 100644 index 000000000..d34f5e988 --- /dev/null +++ b/lib/square/types/payment_balance_activity_refund_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityRefundDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :refund_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_release_adjustment_detail.rb b/lib/square/types/payment_balance_activity_release_adjustment_detail.rb new file mode 100644 index 000000000..2b9aa48ff --- /dev/null +++ b/lib/square/types/payment_balance_activity_release_adjustment_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityReleaseAdjustmentDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_reserve_hold_detail.rb b/lib/square/types/payment_balance_activity_reserve_hold_detail.rb new file mode 100644 index 000000000..91b09b0f5 --- /dev/null +++ b/lib/square/types/payment_balance_activity_reserve_hold_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityReserveHoldDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_reserve_release_detail.rb b/lib/square/types/payment_balance_activity_reserve_release_detail.rb new file mode 100644 index 000000000..17fe9f976 --- /dev/null +++ b/lib/square/types/payment_balance_activity_reserve_release_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityReserveReleaseDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_square_capital_payment_detail.rb b/lib/square/types/payment_balance_activity_square_capital_payment_detail.rb new file mode 100644 index 000000000..bea87c205 --- /dev/null +++ b/lib/square/types/payment_balance_activity_square_capital_payment_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivitySquareCapitalPaymentDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_square_capital_reversed_payment_detail.rb b/lib/square/types/payment_balance_activity_square_capital_reversed_payment_detail.rb new file mode 100644 index 000000000..261e89f81 --- /dev/null +++ b/lib/square/types/payment_balance_activity_square_capital_reversed_payment_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivitySquareCapitalReversedPaymentDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_square_payroll_transfer_detail.rb b/lib/square/types/payment_balance_activity_square_payroll_transfer_detail.rb new file mode 100644 index 000000000..ff1328c1d --- /dev/null +++ b/lib/square/types/payment_balance_activity_square_payroll_transfer_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivitySquarePayrollTransferDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.rb b/lib/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.rb new file mode 100644 index 000000000..796ae9bf4 --- /dev/null +++ b/lib/square/types/payment_balance_activity_square_payroll_transfer_reversed_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivitySquarePayrollTransferReversedDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_tax_on_fee_detail.rb b/lib/square/types/payment_balance_activity_tax_on_fee_detail.rb new file mode 100644 index 000000000..f85d587cb --- /dev/null +++ b/lib/square/types/payment_balance_activity_tax_on_fee_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityTaxOnFeeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :tax_rate_description, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_third_party_fee_detail.rb b/lib/square/types/payment_balance_activity_third_party_fee_detail.rb new file mode 100644 index 000000000..c087203d6 --- /dev/null +++ b/lib/square/types/payment_balance_activity_third_party_fee_detail.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityThirdPartyFeeDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_balance_activity_third_party_fee_refund_detail.rb b/lib/square/types/payment_balance_activity_third_party_fee_refund_detail.rb new file mode 100644 index 000000000..2c394d6a0 --- /dev/null +++ b/lib/square/types/payment_balance_activity_third_party_fee_refund_detail.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentBalanceActivityThirdPartyFeeRefundDetail < Internal::Types::Model + field :payment_id, String, optional: true, nullable: false + field :refund_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_created_event.rb b/lib/square/types/payment_created_event.rb new file mode 100644 index 000000000..793352479 --- /dev/null +++ b/lib/square/types/payment_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Payment](entity:Payment) is created. + class PaymentCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::PaymentCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_created_event_data.rb b/lib/square/types/payment_created_event_data.rb new file mode 100644 index 000000000..8785b2149 --- /dev/null +++ b/lib/square/types/payment_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::PaymentCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_created_event_object.rb b/lib/square/types/payment_created_event_object.rb new file mode 100644 index 000000000..bdaaa3931 --- /dev/null +++ b/lib/square/types/payment_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentCreatedEventObject < Internal::Types::Model + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_link.rb b/lib/square/types/payment_link.rb new file mode 100644 index 000000000..3da35e980 --- /dev/null +++ b/lib/square/types/payment_link.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentLink < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :version, Integer, optional: false, nullable: false + field :description, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :checkout_options, Square::Types::CheckoutOptions, optional: true, nullable: false + field :pre_populated_data, Square::Types::PrePopulatedData, optional: true, nullable: false + field :url, String, optional: true, nullable: false + field :long_url, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :payment_note, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_link_related_resources.rb b/lib/square/types/payment_link_related_resources.rb new file mode 100644 index 000000000..037f7eea1 --- /dev/null +++ b/lib/square/types/payment_link_related_resources.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentLinkRelatedResources < Internal::Types::Model + field :orders, Internal::Types::Array[Square::Types::Order], optional: true, nullable: false + field :subscription_plans, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_options.rb b/lib/square/types/payment_options.rb new file mode 100644 index 000000000..c073acd90 --- /dev/null +++ b/lib/square/types/payment_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentOptions < Internal::Types::Model + field :autocomplete, Internal::Types::Boolean, optional: true, nullable: false + field :delay_duration, String, optional: true, nullable: false + field :accept_partial_authorization, Internal::Types::Boolean, optional: true, nullable: false + field :delay_action, Square::Types::PaymentOptionsDelayAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_options_delay_action.rb b/lib/square/types/payment_options_delay_action.rb new file mode 100644 index 000000000..6c949d85c --- /dev/null +++ b/lib/square/types/payment_options_delay_action.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module PaymentOptionsDelayAction + extend Square::Internal::Types::Enum + CANCEL = "CANCEL" + COMPLETE = "COMPLETE"end + end +end diff --git a/lib/square/types/payment_refund.rb b/lib/square/types/payment_refund.rb new file mode 100644 index 000000000..1d6da42b5 --- /dev/null +++ b/lib/square/types/payment_refund.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a refund of a payment made using Square. Contains information about + # the original payment and the amount of money refunded. + class PaymentRefund < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :status, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :unlinked, Internal::Types::Boolean, optional: true, nullable: false + field :destination_type, String, optional: true, nullable: false + field :destination_details, Square::Types::DestinationDetails, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :processing_fee, Internal::Types::Array[Square::Types::ProcessingFee], optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :reason, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :terminal_refund_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_updated_event.rb b/lib/square/types/payment_updated_event.rb new file mode 100644 index 000000000..e9a4cfb22 --- /dev/null +++ b/lib/square/types/payment_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Payment](entity:Payment) is updated. + # Typically the `payment.status`, or `card_details.status` fields are updated + # as a payment is canceled, authorized, or completed. + class PaymentUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::PaymentUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_updated_event_data.rb b/lib/square/types/payment_updated_event_data.rb new file mode 100644 index 000000000..62f759f24 --- /dev/null +++ b/lib/square/types/payment_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::PaymentUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payment_updated_event_object.rb b/lib/square/types/payment_updated_event_object.rb new file mode 100644 index 000000000..6167d7eb5 --- /dev/null +++ b/lib/square/types/payment_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PaymentUpdatedEventObject < Internal::Types::Model + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout.rb b/lib/square/types/payout.rb new file mode 100644 index 000000000..2126b9d4b --- /dev/null +++ b/lib/square/types/payout.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Square + module Types + # An accounting of the amount owed the seller and record of the actual transfer to their + # external bank account or to the Square balance. + class Payout < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :status, Square::Types::PayoutStatus, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :destination, Square::Types::Destination, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :type, Square::Types::PayoutType, optional: true, nullable: false + field :payout_fee, Internal::Types::Array[Square::Types::PayoutFee], optional: true, nullable: false + field :arrival_date, String, optional: true, nullable: false + field :end_to_end_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_entry.rb b/lib/square/types/payout_entry.rb new file mode 100644 index 000000000..b3b922df1 --- /dev/null +++ b/lib/square/types/payout_entry.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module Square + module Types + # One or more PayoutEntries that make up a Payout. Each one has a date, amount, and type of activity. + # The total amount of the payout will equal the sum of the payout entries for a batch payout + class PayoutEntry < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :payout_id, String, optional: false, nullable: false + field :effective_at, String, optional: true, nullable: false + field :type, Square::Types::ActivityType, optional: true, nullable: false + field :gross_amount_money, Square::Types::Money, optional: true, nullable: false + field :fee_amount_money, Square::Types::Money, optional: true, nullable: false + field :net_amount_money, Square::Types::Money, optional: true, nullable: false + field :type_app_fee_revenue_details, Square::Types::PaymentBalanceActivityAppFeeRevenueDetail, optional: true, nullable: false + field :type_app_fee_refund_details, Square::Types::PaymentBalanceActivityAppFeeRefundDetail, optional: true, nullable: false + field :type_automatic_savings_details, Square::Types::PaymentBalanceActivityAutomaticSavingsDetail, optional: true, nullable: false + field :type_automatic_savings_reversed_details, Square::Types::PaymentBalanceActivityAutomaticSavingsReversedDetail, optional: true, nullable: false + field :type_charge_details, Square::Types::PaymentBalanceActivityChargeDetail, optional: true, nullable: false + field :type_deposit_fee_details, Square::Types::PaymentBalanceActivityDepositFeeDetail, optional: true, nullable: false + field :type_deposit_fee_reversed_details, Square::Types::PaymentBalanceActivityDepositFeeReversedDetail, optional: true, nullable: false + field :type_dispute_details, Square::Types::PaymentBalanceActivityDisputeDetail, optional: true, nullable: false + field :type_fee_details, Square::Types::PaymentBalanceActivityFeeDetail, optional: true, nullable: false + field :type_free_processing_details, Square::Types::PaymentBalanceActivityFreeProcessingDetail, optional: true, nullable: false + field :type_hold_adjustment_details, Square::Types::PaymentBalanceActivityHoldAdjustmentDetail, optional: true, nullable: false + field :type_open_dispute_details, Square::Types::PaymentBalanceActivityOpenDisputeDetail, optional: true, nullable: false + field :type_other_details, Square::Types::PaymentBalanceActivityOtherDetail, optional: true, nullable: false + field :type_other_adjustment_details, Square::Types::PaymentBalanceActivityOtherAdjustmentDetail, optional: true, nullable: false + field :type_refund_details, Square::Types::PaymentBalanceActivityRefundDetail, optional: true, nullable: false + field :type_release_adjustment_details, Square::Types::PaymentBalanceActivityReleaseAdjustmentDetail, optional: true, nullable: false + field :type_reserve_hold_details, Square::Types::PaymentBalanceActivityReserveHoldDetail, optional: true, nullable: false + field :type_reserve_release_details, Square::Types::PaymentBalanceActivityReserveReleaseDetail, optional: true, nullable: false + field :type_square_capital_payment_details, Square::Types::PaymentBalanceActivitySquareCapitalPaymentDetail, optional: true, nullable: false + field :type_square_capital_reversed_payment_details, Square::Types::PaymentBalanceActivitySquareCapitalReversedPaymentDetail, optional: true, nullable: false + field :type_tax_on_fee_details, Square::Types::PaymentBalanceActivityTaxOnFeeDetail, optional: true, nullable: false + field :type_third_party_fee_details, Square::Types::PaymentBalanceActivityThirdPartyFeeDetail, optional: true, nullable: false + field :type_third_party_fee_refund_details, Square::Types::PaymentBalanceActivityThirdPartyFeeRefundDetail, optional: true, nullable: false + field :type_square_payroll_transfer_details, Square::Types::PaymentBalanceActivitySquarePayrollTransferDetail, optional: true, nullable: false + field :type_square_payroll_transfer_reversed_details, Square::Types::PaymentBalanceActivitySquarePayrollTransferReversedDetail, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_failed_event.rb b/lib/square/types/payout_failed_event.rb new file mode 100644 index 000000000..b20fec69d --- /dev/null +++ b/lib/square/types/payout_failed_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Payout](entity:Payout) has failed. + class PayoutFailedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::PayoutFailedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_failed_event_data.rb b/lib/square/types/payout_failed_event_data.rb new file mode 100644 index 000000000..388c9afe5 --- /dev/null +++ b/lib/square/types/payout_failed_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutFailedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::PayoutFailedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_failed_event_object.rb b/lib/square/types/payout_failed_event_object.rb new file mode 100644 index 000000000..4659fd1e2 --- /dev/null +++ b/lib/square/types/payout_failed_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutFailedEventObject < Internal::Types::Model + field :payout, Square::Types::Payout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_fee.rb b/lib/square/types/payout_fee.rb new file mode 100644 index 000000000..7b5a94c50 --- /dev/null +++ b/lib/square/types/payout_fee.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a payout fee that can incur as part of a payout. + class PayoutFee < Internal::Types::Model + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :effective_at, String, optional: true, nullable: false + field :type, Square::Types::PayoutFeeType, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_fee_type.rb b/lib/square/types/payout_fee_type.rb new file mode 100644 index 000000000..60222f4dd --- /dev/null +++ b/lib/square/types/payout_fee_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module PayoutFeeType + extend Square::Internal::Types::Enum + TRANSFER_FEE = "TRANSFER_FEE" + TAX_ON_TRANSFER_FEE = "TAX_ON_TRANSFER_FEE"end + end +end diff --git a/lib/square/types/payout_paid_event.rb b/lib/square/types/payout_paid_event.rb new file mode 100644 index 000000000..0f4cdc919 --- /dev/null +++ b/lib/square/types/payout_paid_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Payout](entity:Payout) is complete. + class PayoutPaidEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::PayoutPaidEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_paid_event_data.rb b/lib/square/types/payout_paid_event_data.rb new file mode 100644 index 000000000..acaeffa46 --- /dev/null +++ b/lib/square/types/payout_paid_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutPaidEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::PayoutPaidEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_paid_event_object.rb b/lib/square/types/payout_paid_event_object.rb new file mode 100644 index 000000000..5142db2b6 --- /dev/null +++ b/lib/square/types/payout_paid_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutPaidEventObject < Internal::Types::Model + field :payout, Square::Types::Payout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_sent_event.rb b/lib/square/types/payout_sent_event.rb new file mode 100644 index 000000000..8e213f77c --- /dev/null +++ b/lib/square/types/payout_sent_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Payout](entity:Payout) is sent. + class PayoutSentEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::PayoutSentEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_sent_event_data.rb b/lib/square/types/payout_sent_event_data.rb new file mode 100644 index 000000000..b6858c663 --- /dev/null +++ b/lib/square/types/payout_sent_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutSentEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::PayoutSentEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_sent_event_object.rb b/lib/square/types/payout_sent_event_object.rb new file mode 100644 index 000000000..a59f29b3f --- /dev/null +++ b/lib/square/types/payout_sent_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class PayoutSentEventObject < Internal::Types::Model + field :payout, Square::Types::Payout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/payout_status.rb b/lib/square/types/payout_status.rb new file mode 100644 index 000000000..a2c9e93bb --- /dev/null +++ b/lib/square/types/payout_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module PayoutStatus + extend Square::Internal::Types::Enum + SENT = "SENT" + FAILED = "FAILED" + PAID = "PAID"end + end +end diff --git a/lib/square/types/payout_type.rb b/lib/square/types/payout_type.rb new file mode 100644 index 000000000..74d779482 --- /dev/null +++ b/lib/square/types/payout_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module PayoutType + extend Square::Internal::Types::Enum + BATCH = "BATCH" + SIMPLE = "SIMPLE"end + end +end diff --git a/lib/square/types/phase.rb b/lib/square/types/phase.rb new file mode 100644 index 000000000..8028b6014 --- /dev/null +++ b/lib/square/types/phase.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a phase, which can override subscription phases as defined by plan_id + class Phase < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :order_template_id, String, optional: true, nullable: false + field :plan_phase_uid, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/phase_input.rb b/lib/square/types/phase_input.rb new file mode 100644 index 000000000..89bc72ce1 --- /dev/null +++ b/lib/square/types/phase_input.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the arguments used to construct a new phase. + class PhaseInput < Internal::Types::Model + field :ordinal, Integer, optional: false, nullable: false + field :order_template_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/pre_populated_data.rb b/lib/square/types/pre_populated_data.rb new file mode 100644 index 000000000..6f66a5134 --- /dev/null +++ b/lib/square/types/pre_populated_data.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes buyer data to prepopulate in the payment form. + # For more information, + # see [Optional Checkout Configurations](https://developer.squareup.com/docs/checkout-api/optional-checkout-configurations). + class PrePopulatedData < Internal::Types::Model + field :buyer_email, String, optional: true, nullable: false + field :buyer_phone_number, String, optional: true, nullable: false + field :buyer_address, Square::Types::Address, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/processing_fee.rb b/lib/square/types/processing_fee.rb new file mode 100644 index 000000000..c3d76eeee --- /dev/null +++ b/lib/square/types/processing_fee.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the Square processing fee. + class ProcessingFee < Internal::Types::Model + field :effective_at, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/product.rb b/lib/square/types/product.rb new file mode 100644 index 000000000..842030cfc --- /dev/null +++ b/lib/square/types/product.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + module Product + extend Square::Internal::Types::Enum + SQUARE_POS = "SQUARE_POS" + EXTERNAL_API = "EXTERNAL_API" + BILLING = "BILLING" + APPOINTMENTS = "APPOINTMENTS" + INVOICES = "INVOICES" + ONLINE_STORE = "ONLINE_STORE" + PAYROLL = "PAYROLL" + DASHBOARD = "DASHBOARD" + ITEM_LIBRARY_IMPORT = "ITEM_LIBRARY_IMPORT" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/publish_invoice_response.rb b/lib/square/types/publish_invoice_response.rb new file mode 100644 index 000000000..7b3e9e9b5 --- /dev/null +++ b/lib/square/types/publish_invoice_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `PublishInvoice` response. + class PublishInvoiceResponse < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/publish_scheduled_shift_response.rb b/lib/square/types/publish_scheduled_shift_response.rb new file mode 100644 index 000000000..4e7b2fce9 --- /dev/null +++ b/lib/square/types/publish_scheduled_shift_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [PublishScheduledShift](api-endpoint:Labor-PublishScheduledShift) response. + # Either `scheduled_shift` or `errors` is present in the response. + class PublishScheduledShiftResponse < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/qr_code_options.rb b/lib/square/types/qr_code_options.rb new file mode 100644 index 000000000..e700e58c4 --- /dev/null +++ b/lib/square/types/qr_code_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Fields to describe the action that displays QR-Codes. + class QrCodeOptions < Internal::Types::Model + field :title, String, optional: false, nullable: false + field :body, String, optional: false, nullable: false + field :barcode_contents, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/quick_pay.rb b/lib/square/types/quick_pay.rb new file mode 100644 index 000000000..06994c6d1 --- /dev/null +++ b/lib/square/types/quick_pay.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes an ad hoc item and price to generate a quick pay checkout link. + # For more information, + # see [Quick Pay Checkout](https://developer.squareup.com/docs/checkout-api/quick-pay-checkout). + class QuickPay < Internal::Types::Model + field :name, String, optional: false, nullable: false + field :price_money, Square::Types::Money, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/range.rb b/lib/square/types/range.rb new file mode 100644 index 000000000..8eb3c5c2f --- /dev/null +++ b/lib/square/types/range.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The range of a number value between the specified lower and upper bounds. + class Range < Internal::Types::Model + field :min, String, optional: true, nullable: false + field :max, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/receipt_options.rb b/lib/square/types/receipt_options.rb new file mode 100644 index 000000000..bc2bfbae5 --- /dev/null +++ b/lib/square/types/receipt_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes receipt action fields. + class ReceiptOptions < Internal::Types::Model + field :payment_id, String, optional: false, nullable: false + field :print_only, Internal::Types::Boolean, optional: true, nullable: false + field :is_duplicate, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/redeem_loyalty_reward_response.rb b/lib/square/types/redeem_loyalty_reward_response.rb new file mode 100644 index 000000000..d133c5304 --- /dev/null +++ b/lib/square/types/redeem_loyalty_reward_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes the `LoyaltyEvent` published for redeeming the reward. + class RedeemLoyaltyRewardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :event, Square::Types::LoyaltyEvent, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund.rb b/lib/square/types/refund.rb new file mode 100644 index 000000000..65dbfdbc4 --- /dev/null +++ b/lib/square/types/refund.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a refund processed for a Square transaction. + class Refund < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :location_id, String, optional: false, nullable: false + field :transaction_id, String, optional: true, nullable: false + field :tender_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :reason, String, optional: false, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :status, Square::Types::RefundStatus, optional: false, nullable: false + field :processing_fee_money, Square::Types::Money, optional: true, nullable: false + field :additional_recipients, Internal::Types::Array[Square::Types::AdditionalRecipient], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_created_event.rb b/lib/square/types/refund_created_event.rb new file mode 100644 index 000000000..074935994 --- /dev/null +++ b/lib/square/types/refund_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Refund](entity:PaymentRefund) is created. + class RefundCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::RefundCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_created_event_data.rb b/lib/square/types/refund_created_event_data.rb new file mode 100644 index 000000000..dc51a0272 --- /dev/null +++ b/lib/square/types/refund_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class RefundCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::RefundCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_created_event_object.rb b/lib/square/types/refund_created_event_object.rb new file mode 100644 index 000000000..f5f1d33f5 --- /dev/null +++ b/lib/square/types/refund_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class RefundCreatedEventObject < Internal::Types::Model + field :refund, Square::Types::PaymentRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_payment_response.rb b/lib/square/types/refund_payment_response.rb new file mode 100644 index 000000000..44bdf49c0 --- /dev/null +++ b/lib/square/types/refund_payment_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by + # [RefundPayment](api-endpoint:Refunds-RefundPayment). + # + # If there are errors processing the request, the `refund` field might not be + # present, or it might be present with a status of `FAILED`. + class RefundPaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refund, Square::Types::PaymentRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_status.rb b/lib/square/types/refund_status.rb new file mode 100644 index 000000000..e8c7c6c3e --- /dev/null +++ b/lib/square/types/refund_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module RefundStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + APPROVED = "APPROVED" + REJECTED = "REJECTED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/refund_updated_event.rb b/lib/square/types/refund_updated_event.rb new file mode 100644 index 000000000..1942a90a1 --- /dev/null +++ b/lib/square/types/refund_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Refund](entity:PaymentRefund) is updated. + # Typically the `refund.status` changes when a refund is completed. + class RefundUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::RefundUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_updated_event_data.rb b/lib/square/types/refund_updated_event_data.rb new file mode 100644 index 000000000..3b0cc6de7 --- /dev/null +++ b/lib/square/types/refund_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class RefundUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::RefundUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/refund_updated_event_object.rb b/lib/square/types/refund_updated_event_object.rb new file mode 100644 index 000000000..c2d005626 --- /dev/null +++ b/lib/square/types/refund_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class RefundUpdatedEventObject < Internal::Types::Model + field :refund, Square::Types::PaymentRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/register_domain_response.rb b/lib/square/types/register_domain_response.rb new file mode 100644 index 000000000..dc2ed3c20 --- /dev/null +++ b/lib/square/types/register_domain_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RegisterDomain](api-endpoint:ApplePay-RegisterDomain) endpoint. + # + # Either `errors` or `status` are present in a given response (never both). + class RegisterDomainResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :status, Square::Types::RegisterDomainResponseStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/register_domain_response_status.rb b/lib/square/types/register_domain_response_status.rb new file mode 100644 index 000000000..e0bb4fd5d --- /dev/null +++ b/lib/square/types/register_domain_response_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module RegisterDomainResponseStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + VERIFIED = "VERIFIED"end + end +end diff --git a/lib/square/types/remove_group_from_customer_response.rb b/lib/square/types/remove_group_from_customer_response.rb new file mode 100644 index 000000000..ac28a5203 --- /dev/null +++ b/lib/square/types/remove_group_from_customer_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [RemoveGroupFromCustomer](api-endpoint:Customers-RemoveGroupFromCustomer) + # endpoint. + class RemoveGroupFromCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/resume_subscription_response.rb b/lib/square/types/resume_subscription_response.rb new file mode 100644 index 000000000..b9e2434c0 --- /dev/null +++ b/lib/square/types/resume_subscription_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [ResumeSubscription](api-endpoint:Subscriptions-ResumeSubscription) endpoint. + class ResumeSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_booking_custom_attribute_definition_response.rb b/lib/square/types/retrieve_booking_custom_attribute_definition_response.rb new file mode 100644 index 000000000..96b15e8a0 --- /dev/null +++ b/lib/square/types/retrieve_booking_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveBookingCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_booking_custom_attribute_response.rb b/lib/square/types/retrieve_booking_custom_attribute_response.rb new file mode 100644 index 000000000..d66748fe2 --- /dev/null +++ b/lib/square/types/retrieve_booking_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveBookingCustomAttribute](api-endpoint:BookingCustomAttributes-RetrieveBookingCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveBookingCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_job_response.rb b/lib/square/types/retrieve_job_response.rb new file mode 100644 index 000000000..df26ad3a7 --- /dev/null +++ b/lib/square/types/retrieve_job_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveJob](api-endpoint:Team-RetrieveJob) response. Either `job` or `errors` + # is present in the response. + class RetrieveJobResponse < Internal::Types::Model + field :job, Square::Types::Job, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_location_booking_profile_response.rb b/lib/square/types/retrieve_location_booking_profile_response.rb new file mode 100644 index 000000000..9716f455f --- /dev/null +++ b/lib/square/types/retrieve_location_booking_profile_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class RetrieveLocationBookingProfileResponse < Internal::Types::Model + field :location_booking_profile, Square::Types::LocationBookingProfile, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_location_custom_attribute_definition_response.rb b/lib/square/types/retrieve_location_custom_attribute_definition_response.rb new file mode 100644 index 000000000..b4af0d30c --- /dev/null +++ b/lib/square/types/retrieve_location_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveLocationCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_location_custom_attribute_response.rb b/lib/square/types/retrieve_location_custom_attribute_response.rb new file mode 100644 index 000000000..33e851877 --- /dev/null +++ b/lib/square/types/retrieve_location_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveLocationCustomAttribute](api-endpoint:LocationCustomAttributes-RetrieveLocationCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveLocationCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_location_settings_response.rb b/lib/square/types/retrieve_location_settings_response.rb new file mode 100644 index 000000000..22e03b1e0 --- /dev/null +++ b/lib/square/types/retrieve_location_settings_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class RetrieveLocationSettingsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :location_settings, Square::Types::CheckoutLocationSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_merchant_custom_attribute_definition_response.rb b/lib/square/types/retrieve_merchant_custom_attribute_definition_response.rb new file mode 100644 index 000000000..a033d477a --- /dev/null +++ b/lib/square/types/retrieve_merchant_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveMerchantCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_merchant_custom_attribute_response.rb b/lib/square/types/retrieve_merchant_custom_attribute_response.rb new file mode 100644 index 000000000..8d86dba58 --- /dev/null +++ b/lib/square/types/retrieve_merchant_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-RetrieveMerchantCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class RetrieveMerchantCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_merchant_settings_response.rb b/lib/square/types/retrieve_merchant_settings_response.rb new file mode 100644 index 000000000..2799ec6db --- /dev/null +++ b/lib/square/types/retrieve_merchant_settings_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class RetrieveMerchantSettingsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :merchant_settings, Square::Types::CheckoutMerchantSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_order_custom_attribute_definition_response.rb b/lib/square/types/retrieve_order_custom_attribute_definition_response.rb new file mode 100644 index 000000000..68487dabd --- /dev/null +++ b/lib/square/types/retrieve_order_custom_attribute_definition_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from getting an order custom attribute definition. + class RetrieveOrderCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_order_custom_attribute_response.rb b/lib/square/types/retrieve_order_custom_attribute_response.rb new file mode 100644 index 000000000..479bf7ad6 --- /dev/null +++ b/lib/square/types/retrieve_order_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from getting an order custom attribute. + class RetrieveOrderCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_scheduled_shift_response.rb b/lib/square/types/retrieve_scheduled_shift_response.rb new file mode 100644 index 000000000..2db771855 --- /dev/null +++ b/lib/square/types/retrieve_scheduled_shift_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [RetrieveScheduledShift](api-endpoint:Labor-RetrieveScheduledShift) response. + # Either `scheduled_shift` or `errors` is present in the response. + class RetrieveScheduledShiftResponse < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_timecard_response.rb b/lib/square/types/retrieve_timecard_response.rb new file mode 100644 index 000000000..c6d3fc021 --- /dev/null +++ b/lib/square/types/retrieve_timecard_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response to a request to get a `Timecard`. The response contains + # the requested `Timecard` object and might contain a set of `Error` objects if + # the request resulted in errors. + class RetrieveTimecardResponse < Internal::Types::Model + field :timecard, Square::Types::Timecard, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/retrieve_token_status_response.rb b/lib/square/types/retrieve_token_status_response.rb new file mode 100644 index 000000000..70ddca58a --- /dev/null +++ b/lib/square/types/retrieve_token_status_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `RetrieveTokenStatus` endpoint. + class RetrieveTokenStatusResponse < Internal::Types::Model + field :scopes, Internal::Types::Array[String], optional: true, nullable: false + field :expires_at, String, optional: true, nullable: false + field :client_id, String, optional: true, nullable: false + field :merchant_id, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/revoke_token_response.rb b/lib/square/types/revoke_token_response.rb new file mode 100644 index 000000000..88d18fcd7 --- /dev/null +++ b/lib/square/types/revoke_token_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class RevokeTokenResponse < Internal::Types::Model + field :success, Internal::Types::Boolean, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/risk_evaluation.rb b/lib/square/types/risk_evaluation.rb new file mode 100644 index 000000000..9572de783 --- /dev/null +++ b/lib/square/types/risk_evaluation.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents fraud risk information for the associated payment. + # + # When you take a payment through Square's Payments API (using the `CreatePayment` + # endpoint), Square evaluates it and assigns a risk level to the payment. Sellers + # can use this information to determine the course of action (for example, + # provide the goods/services or refund the payment). + class RiskEvaluation < Internal::Types::Model + field :created_at, String, optional: true, nullable: false + field :risk_level, Square::Types::RiskEvaluationRiskLevel, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/risk_evaluation_risk_level.rb b/lib/square/types/risk_evaluation_risk_level.rb new file mode 100644 index 000000000..7838c45af --- /dev/null +++ b/lib/square/types/risk_evaluation_risk_level.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module RiskEvaluationRiskLevel + extend Square::Internal::Types::Enum + PENDING = "PENDING" + NORMAL = "NORMAL" + MODERATE = "MODERATE" + HIGH = "HIGH"end + end +end diff --git a/lib/square/types/save_card_options.rb b/lib/square/types/save_card_options.rb new file mode 100644 index 000000000..d6271f713 --- /dev/null +++ b/lib/square/types/save_card_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes save-card action fields. + class SaveCardOptions < Internal::Types::Model + field :customer_id, String, optional: false, nullable: false + field :card_id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift.rb b/lib/square/types/scheduled_shift.rb new file mode 100644 index 000000000..3a8546ab6 --- /dev/null +++ b/lib/square/types/scheduled_shift.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a specific time slot in a work schedule. This object is used to manage the + # lifecycle of a scheduled shift from the draft to published state. A scheduled shift contains + # the latest draft shift details and current published shift details. + class ScheduledShift < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :draft_shift_details, Square::Types::ScheduledShiftDetails, optional: true, nullable: false + field :published_shift_details, Square::Types::ScheduledShiftDetails, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_details.rb b/lib/square/types/scheduled_shift_details.rb new file mode 100644 index 000000000..6ca5fd129 --- /dev/null +++ b/lib/square/types/scheduled_shift_details.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents shift details for draft and published versions of a [scheduled shift](entity:ScheduledShift), + # such as job ID, team member assignment, and start and end times. + class ScheduledShiftDetails < Internal::Types::Model + field :team_member_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :job_id, String, optional: true, nullable: false + field :start_at, String, optional: true, nullable: false + field :end_at, String, optional: true, nullable: false + field :notes, String, optional: true, nullable: false + field :is_deleted, Internal::Types::Boolean, optional: true, nullable: false + field :timezone, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_filter.rb b/lib/square/types/scheduled_shift_filter.rb new file mode 100644 index 000000000..67cc89ff5 --- /dev/null +++ b/lib/square/types/scheduled_shift_filter.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines filter criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) + # request. Multiple filters in a query are combined as an `AND` operation. + class ScheduledShiftFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :start, Square::Types::TimeRange, optional: true, nullable: false + field :end_, Square::Types::TimeRange, optional: true, nullable: false + field :workday, Square::Types::ScheduledShiftWorkday, optional: true, nullable: false + field :team_member_ids, Internal::Types::Array[String], optional: true, nullable: false + field :assignment_status, Square::Types::ScheduledShiftFilterAssignmentStatus, optional: true, nullable: false + field :scheduled_shift_statuses, Internal::Types::Array[Square::Types::ScheduledShiftFilterScheduledShiftStatus], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_filter_assignment_status.rb b/lib/square/types/scheduled_shift_filter_assignment_status.rb new file mode 100644 index 000000000..c4e8b46f9 --- /dev/null +++ b/lib/square/types/scheduled_shift_filter_assignment_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ScheduledShiftFilterAssignmentStatus + extend Square::Internal::Types::Enum + ASSIGNED = "ASSIGNED" + UNASSIGNED = "UNASSIGNED"end + end +end diff --git a/lib/square/types/scheduled_shift_filter_scheduled_shift_status.rb b/lib/square/types/scheduled_shift_filter_scheduled_shift_status.rb new file mode 100644 index 000000000..463602260 --- /dev/null +++ b/lib/square/types/scheduled_shift_filter_scheduled_shift_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ScheduledShiftFilterScheduledShiftStatus + extend Square::Internal::Types::Enum + DRAFT = "DRAFT" + PUBLISHED = "PUBLISHED"end + end +end diff --git a/lib/square/types/scheduled_shift_notification_audience.rb b/lib/square/types/scheduled_shift_notification_audience.rb new file mode 100644 index 000000000..7402e805a --- /dev/null +++ b/lib/square/types/scheduled_shift_notification_audience.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ScheduledShiftNotificationAudience + extend Square::Internal::Types::Enum + ALL = "ALL" + AFFECTED = "AFFECTED" + NONE = "NONE"end + end +end diff --git a/lib/square/types/scheduled_shift_query.rb b/lib/square/types/scheduled_shift_query.rb new file mode 100644 index 000000000..df5f18643 --- /dev/null +++ b/lib/square/types/scheduled_shift_query.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents filter and sort criteria for the `query` field in a + # [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) request. + class ScheduledShiftQuery < Internal::Types::Model + field :filter, Square::Types::ScheduledShiftFilter, optional: true, nullable: false + field :sort, Square::Types::ScheduledShiftSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_sort.rb b/lib/square/types/scheduled_shift_sort.rb new file mode 100644 index 000000000..0e676c3db --- /dev/null +++ b/lib/square/types/scheduled_shift_sort.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines sort criteria for a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) + # request. + class ScheduledShiftSort < Internal::Types::Model + field :field, Square::Types::ScheduledShiftSortField, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_sort_field.rb b/lib/square/types/scheduled_shift_sort_field.rb new file mode 100644 index 000000000..0f19d6f05 --- /dev/null +++ b/lib/square/types/scheduled_shift_sort_field.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module ScheduledShiftSortField + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + CREATED_AT = "CREATED_AT" + UPDATED_AT = "UPDATED_AT"end + end +end diff --git a/lib/square/types/scheduled_shift_workday.rb b/lib/square/types/scheduled_shift_workday.rb new file mode 100644 index 000000000..07d6490d6 --- /dev/null +++ b/lib/square/types/scheduled_shift_workday.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A `ScheduledShift` search query filter parameter that sets a range of days that + # a `Shift` must start or end in before passing the filter condition. + class ScheduledShiftWorkday < Internal::Types::Model + field :date_range, Square::Types::DateRange, optional: true, nullable: false + field :match_scheduled_shifts_by, Square::Types::ScheduledShiftWorkdayMatcher, optional: true, nullable: false + field :default_timezone, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/scheduled_shift_workday_matcher.rb b/lib/square/types/scheduled_shift_workday_matcher.rb new file mode 100644 index 000000000..93687995f --- /dev/null +++ b/lib/square/types/scheduled_shift_workday_matcher.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ScheduledShiftWorkdayMatcher + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + INTERSECTION = "INTERSECTION"end + end +end diff --git a/lib/square/types/search_availability_filter.rb b/lib/square/types/search_availability_filter.rb new file mode 100644 index 000000000..0b84b4716 --- /dev/null +++ b/lib/square/types/search_availability_filter.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A query filter to search for buyer-accessible availabilities by. + class SearchAvailabilityFilter < Internal::Types::Model + field :start_at_range, Square::Types::TimeRange, optional: false, nullable: false + field :location_id, String, optional: true, nullable: false + field :segment_filters, Internal::Types::Array[Square::Types::SegmentFilter], optional: true, nullable: false + field :booking_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_availability_query.rb b/lib/square/types/search_availability_query.rb new file mode 100644 index 000000000..b3527d444 --- /dev/null +++ b/lib/square/types/search_availability_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The query used to search for buyer-accessible availabilities of bookings. + class SearchAvailabilityQuery < Internal::Types::Model + field :filter, Square::Types::SearchAvailabilityFilter, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/search_availability_response.rb b/lib/square/types/search_availability_response.rb new file mode 100644 index 000000000..d92f6c64e --- /dev/null +++ b/lib/square/types/search_availability_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class SearchAvailabilityResponse < Internal::Types::Model + field :availabilities, Internal::Types::Array[Square::Types::Availability], optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_catalog_items_request_stock_level.rb b/lib/square/types/search_catalog_items_request_stock_level.rb new file mode 100644 index 000000000..1c2c82ef5 --- /dev/null +++ b/lib/square/types/search_catalog_items_request_stock_level.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module SearchCatalogItemsRequestStockLevel + extend Square::Internal::Types::Enum + OUT = "OUT" + LOW = "LOW"end + end +end diff --git a/lib/square/types/search_catalog_items_response.rb b/lib/square/types/search_catalog_items_response.rb new file mode 100644 index 000000000..eb44d5eb7 --- /dev/null +++ b/lib/square/types/search_catalog_items_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response body returned from the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItems) endpoint. + class SearchCatalogItemsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :items, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :matched_variation_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_catalog_objects_response.rb b/lib/square/types/search_catalog_objects_response.rb new file mode 100644 index 000000000..8e026b643 --- /dev/null +++ b/lib/square/types/search_catalog_objects_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class SearchCatalogObjectsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :related_objects, Internal::Types::Array[Square::Types::CatalogObject], optional: true, nullable: false + field :latest_time, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_customers_response.rb b/lib/square/types/search_customers_response.rb new file mode 100644 index 000000000..48fba18ee --- /dev/null +++ b/lib/square/types/search_customers_response.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the `SearchCustomers` endpoint. + # + # Either `errors` or `customers` is present in a given response (never both). + class SearchCustomersResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :customers, Internal::Types::Array[Square::Types::Customer], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :count, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_events_filter.rb b/lib/square/types/search_events_filter.rb new file mode 100644 index 000000000..bf9f3d078 --- /dev/null +++ b/lib/square/types/search_events_filter.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Criteria to filter events by. + class SearchEventsFilter < Internal::Types::Model + field :event_types, Internal::Types::Array[String], optional: true, nullable: false + field :merchant_ids, Internal::Types::Array[String], optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_events_query.rb b/lib/square/types/search_events_query.rb new file mode 100644 index 000000000..517df0b2b --- /dev/null +++ b/lib/square/types/search_events_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains query criteria for the search. + class SearchEventsQuery < Internal::Types::Model + field :filter, Square::Types::SearchEventsFilter, optional: true, nullable: false + field :sort, Square::Types::SearchEventsSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_events_response.rb b/lib/square/types/search_events_response.rb new file mode 100644 index 000000000..be6ced3d3 --- /dev/null +++ b/lib/square/types/search_events_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [SearchEvents](api-endpoint:Events-SearchEvents) endpoint. + # + # Note: if there are errors processing the request, the events field will not be + # present. + class SearchEventsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :events, Internal::Types::Array[Square::Types::Event], optional: true, nullable: false + field :metadata, Internal::Types::Array[Square::Types::EventMetadata], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_events_sort.rb b/lib/square/types/search_events_sort.rb new file mode 100644 index 000000000..e284c781f --- /dev/null +++ b/lib/square/types/search_events_sort.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Criteria to sort events by. + class SearchEventsSort < Internal::Types::Model + field :field, String, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_invoices_response.rb b/lib/square/types/search_invoices_response.rb new file mode 100644 index 000000000..a750da416 --- /dev/null +++ b/lib/square/types/search_invoices_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `SearchInvoices` response. + class SearchInvoicesResponse < Internal::Types::Model + field :invoices, Internal::Types::Array[Square::Types::Invoice], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_loyalty_accounts_request_loyalty_account_query.rb b/lib/square/types/search_loyalty_accounts_request_loyalty_account_query.rb new file mode 100644 index 000000000..52bbb6073 --- /dev/null +++ b/lib/square/types/search_loyalty_accounts_request_loyalty_account_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The search criteria for the loyalty accounts. + class SearchLoyaltyAccountsRequestLoyaltyAccountQuery < Internal::Types::Model + field :mappings, Internal::Types::Array[Square::Types::LoyaltyAccountMapping], optional: true, nullable: false + field :customer_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_loyalty_accounts_response.rb b/lib/square/types/search_loyalty_accounts_response.rb new file mode 100644 index 000000000..da834201a --- /dev/null +++ b/lib/square/types/search_loyalty_accounts_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes loyalty accounts that satisfy the search criteria. + class SearchLoyaltyAccountsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :loyalty_accounts, Internal::Types::Array[Square::Types::LoyaltyAccount], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_loyalty_events_response.rb b/lib/square/types/search_loyalty_events_response.rb new file mode 100644 index 000000000..46d57677a --- /dev/null +++ b/lib/square/types/search_loyalty_events_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains loyalty events that satisfy the search + # criteria, in order by the `created_at` date. + class SearchLoyaltyEventsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :events, Internal::Types::Array[Square::Types::LoyaltyEvent], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_loyalty_rewards_request_loyalty_reward_query.rb b/lib/square/types/search_loyalty_rewards_request_loyalty_reward_query.rb new file mode 100644 index 000000000..68c377457 --- /dev/null +++ b/lib/square/types/search_loyalty_rewards_request_loyalty_reward_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The set of search requirements. + class SearchLoyaltyRewardsRequestLoyaltyRewardQuery < Internal::Types::Model + field :loyalty_account_id, String, optional: false, nullable: false + field :status, Square::Types::LoyaltyRewardStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_loyalty_rewards_response.rb b/lib/square/types/search_loyalty_rewards_response.rb new file mode 100644 index 000000000..400dba1c6 --- /dev/null +++ b/lib/square/types/search_loyalty_rewards_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that includes the loyalty rewards satisfying the search criteria. + class SearchLoyaltyRewardsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :rewards, Internal::Types::Array[Square::Types::LoyaltyReward], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_customer_filter.rb b/lib/square/types/search_orders_customer_filter.rb new file mode 100644 index 000000000..94e3bbca3 --- /dev/null +++ b/lib/square/types/search_orders_customer_filter.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A filter based on the order `customer_id` and any tender `customer_id` + # associated with the order. It does not filter based on the + # [FulfillmentRecipient](entity:FulfillmentRecipient) `customer_id`. + class SearchOrdersCustomerFilter < Internal::Types::Model + field :customer_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_date_time_filter.rb b/lib/square/types/search_orders_date_time_filter.rb new file mode 100644 index 000000000..56cf81305 --- /dev/null +++ b/lib/square/types/search_orders_date_time_filter.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter for `Order` objects based on whether their `CREATED_AT`, + # `CLOSED_AT`, or `UPDATED_AT` timestamps fall within a specified time range. + # You can specify the time range and which timestamp to filter for. You can filter + # for only one time range at a time. + # + # For each time range, the start time and end time are inclusive. If the end time + # is absent, it defaults to the time of the first request for the cursor. + # + # __Important:__ If you use the `DateTimeFilter` in a `SearchOrders` query, + # you must set the `sort_field` in [OrdersSort](entity:SearchOrdersSort) + # to the same field you filter for. For example, if you set the `CLOSED_AT` field + # in `DateTimeFilter`, you must set the `sort_field` in `SearchOrdersSort` to + # `CLOSED_AT`. Otherwise, `SearchOrders` throws an error. + # [Learn more about filtering orders by time range.](https://developer.squareup.com/docs/orders-api/manage-orders/search-orders#important-note-about-filtering-orders-by-time-range) + class SearchOrdersDateTimeFilter < Internal::Types::Model + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + field :updated_at, Square::Types::TimeRange, optional: true, nullable: false + field :closed_at, Square::Types::TimeRange, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_filter.rb b/lib/square/types/search_orders_filter.rb new file mode 100644 index 000000000..9b2d9ece3 --- /dev/null +++ b/lib/square/types/search_orders_filter.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Filtering criteria to use for a `SearchOrders` request. Multiple filters + # are ANDed together. + class SearchOrdersFilter < Internal::Types::Model + field :state_filter, Square::Types::SearchOrdersStateFilter, optional: true, nullable: false + field :date_time_filter, Square::Types::SearchOrdersDateTimeFilter, optional: true, nullable: false + field :fulfillment_filter, Square::Types::SearchOrdersFulfillmentFilter, optional: true, nullable: false + field :source_filter, Square::Types::SearchOrdersSourceFilter, optional: true, nullable: false + field :customer_filter, Square::Types::SearchOrdersCustomerFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_fulfillment_filter.rb b/lib/square/types/search_orders_fulfillment_filter.rb new file mode 100644 index 000000000..0d73c24e7 --- /dev/null +++ b/lib/square/types/search_orders_fulfillment_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter based on [order fulfillment](entity:Fulfillment) information. + class SearchOrdersFulfillmentFilter < Internal::Types::Model + field :fulfillment_types, Internal::Types::Array[Square::Types::FulfillmentType], optional: true, nullable: false + field :fulfillment_states, Internal::Types::Array[Square::Types::FulfillmentState], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_query.rb b/lib/square/types/search_orders_query.rb new file mode 100644 index 000000000..87e9fa5c6 --- /dev/null +++ b/lib/square/types/search_orders_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains query criteria for the search. + class SearchOrdersQuery < Internal::Types::Model + field :filter, Square::Types::SearchOrdersFilter, optional: true, nullable: false + field :sort, Square::Types::SearchOrdersSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_response.rb b/lib/square/types/search_orders_response.rb new file mode 100644 index 000000000..4032981dc --- /dev/null +++ b/lib/square/types/search_orders_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Either the `order_entries` or `orders` field is set, depending on whether + # `return_entries` is set on the [SearchOrdersRequest](api-endpoint:Orders-SearchOrders). + class SearchOrdersResponse < Internal::Types::Model + field :order_entries, Internal::Types::Array[Square::Types::OrderEntry], optional: true, nullable: false + field :orders, Internal::Types::Array[Square::Types::Order], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_sort.rb b/lib/square/types/search_orders_sort.rb new file mode 100644 index 000000000..7ee13f492 --- /dev/null +++ b/lib/square/types/search_orders_sort.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Sorting criteria for a `SearchOrders` request. Results can only be sorted + # by a timestamp field. + class SearchOrdersSort < Internal::Types::Model + field :sort_field, Square::Types::SearchOrdersSortField, optional: false, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_sort_field.rb b/lib/square/types/search_orders_sort_field.rb new file mode 100644 index 000000000..91a16ca92 --- /dev/null +++ b/lib/square/types/search_orders_sort_field.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module SearchOrdersSortField + extend Square::Internal::Types::Enum + CREATED_AT = "CREATED_AT" + UPDATED_AT = "UPDATED_AT" + CLOSED_AT = "CLOSED_AT"end + end +end diff --git a/lib/square/types/search_orders_source_filter.rb b/lib/square/types/search_orders_source_filter.rb new file mode 100644 index 000000000..4099d7be3 --- /dev/null +++ b/lib/square/types/search_orders_source_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # A filter based on order `source` information. + class SearchOrdersSourceFilter < Internal::Types::Model + field :source_names, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_orders_state_filter.rb b/lib/square/types/search_orders_state_filter.rb new file mode 100644 index 000000000..743325a35 --- /dev/null +++ b/lib/square/types/search_orders_state_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Filter by the current order `state`. + class SearchOrdersStateFilter < Internal::Types::Model + field :states, Internal::Types::Array[Square::Types::OrderState], optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/search_scheduled_shifts_response.rb b/lib/square/types/search_scheduled_shifts_response.rb new file mode 100644 index 000000000..79ec325f7 --- /dev/null +++ b/lib/square/types/search_scheduled_shifts_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a [SearchScheduledShifts](api-endpoint:Labor-SearchScheduledShifts) response. + # Either `scheduled_shifts` or `errors` is present in the response. + class SearchScheduledShiftsResponse < Internal::Types::Model + field :scheduled_shifts, Internal::Types::Array[Square::Types::ScheduledShift], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_shifts_response.rb b/lib/square/types/search_shifts_response.rb new file mode 100644 index 000000000..a98fec168 --- /dev/null +++ b/lib/square/types/search_shifts_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for `Shift` objects. The response contains + # the requested `Shift` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class SearchShiftsResponse < Internal::Types::Model + field :shifts, Internal::Types::Array[Square::Types::Shift], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_subscriptions_filter.rb b/lib/square/types/search_subscriptions_filter.rb new file mode 100644 index 000000000..6d4f81be9 --- /dev/null +++ b/lib/square/types/search_subscriptions_filter.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a set of query expressions (filters) to narrow the scope of targeted subscriptions returned by + # the [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. + class SearchSubscriptionsFilter < Internal::Types::Model + field :customer_ids, Internal::Types::Array[String], optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :source_names, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_subscriptions_query.rb b/lib/square/types/search_subscriptions_query.rb new file mode 100644 index 000000000..940a594da --- /dev/null +++ b/lib/square/types/search_subscriptions_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a query, consisting of specified query expressions, used to search for subscriptions. + class SearchSubscriptionsQuery < Internal::Types::Model + field :filter, Square::Types::SearchSubscriptionsFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_subscriptions_response.rb b/lib/square/types/search_subscriptions_response.rb new file mode 100644 index 000000000..2eab29c57 --- /dev/null +++ b/lib/square/types/search_subscriptions_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [SearchSubscriptions](api-endpoint:Subscriptions-SearchSubscriptions) endpoint. + class SearchSubscriptionsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscriptions, Internal::Types::Array[Square::Types::Subscription], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_team_members_filter.rb b/lib/square/types/search_team_members_filter.rb new file mode 100644 index 000000000..8ea6d2f99 --- /dev/null +++ b/lib/square/types/search_team_members_filter.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a filter used in a search for `TeamMember` objects. `AND` logic is applied + # between the individual fields, and `OR` logic is applied within list-based fields. + # For example, setting this filter value: + # ``` + # filter = (locations_ids = ["A", "B"], status = ACTIVE) + # ``` + # returns only active team members assigned to either location "A" or "B". + class SearchTeamMembersFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :status, Square::Types::TeamMemberStatus, optional: true, nullable: false + field :is_owner, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_team_members_query.rb b/lib/square/types/search_team_members_query.rb new file mode 100644 index 000000000..2adde9634 --- /dev/null +++ b/lib/square/types/search_team_members_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the parameters in a search for `TeamMember` objects. + class SearchTeamMembersQuery < Internal::Types::Model + field :filter, Square::Types::SearchTeamMembersFilter, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_team_members_response.rb b/lib/square/types/search_team_members_response.rb new file mode 100644 index 000000000..ed602e390 --- /dev/null +++ b/lib/square/types/search_team_members_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from a search request containing a filtered list of `TeamMember` objects. + class SearchTeamMembersResponse < Internal::Types::Model + field :team_members, Internal::Types::Array[Square::Types::TeamMember], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_terminal_actions_response.rb b/lib/square/types/search_terminal_actions_response.rb new file mode 100644 index 000000000..c0118d69a --- /dev/null +++ b/lib/square/types/search_terminal_actions_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SearchTerminalActionsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :action, Internal::Types::Array[Square::Types::TerminalAction], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_terminal_checkouts_response.rb b/lib/square/types/search_terminal_checkouts_response.rb new file mode 100644 index 000000000..8cd8e3ae1 --- /dev/null +++ b/lib/square/types/search_terminal_checkouts_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SearchTerminalCheckoutsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :checkouts, Internal::Types::Array[Square::Types::TerminalCheckout], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_terminal_refunds_response.rb b/lib/square/types/search_terminal_refunds_response.rb new file mode 100644 index 000000000..0a626fddc --- /dev/null +++ b/lib/square/types/search_terminal_refunds_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SearchTerminalRefundsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :refunds, Internal::Types::Array[Square::Types::TerminalRefund], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_timecards_response.rb b/lib/square/types/search_timecards_response.rb new file mode 100644 index 000000000..1e0614279 --- /dev/null +++ b/lib/square/types/search_timecards_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request for `Timecard` objects. The response contains + # the requested `Timecard` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class SearchTimecardsResponse < Internal::Types::Model + field :timecards, Internal::Types::Array[Square::Types::Timecard], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_vendors_request_filter.rb b/lib/square/types/search_vendors_request_filter.rb new file mode 100644 index 000000000..0a605b365 --- /dev/null +++ b/lib/square/types/search_vendors_request_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines supported query expressions to search for vendors by. + class SearchVendorsRequestFilter < Internal::Types::Model + field :name, Internal::Types::Array[String], optional: true, nullable: false + field :status, Internal::Types::Array[Square::Types::VendorStatus], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_vendors_request_sort.rb b/lib/square/types/search_vendors_request_sort.rb new file mode 100644 index 000000000..1f46e743a --- /dev/null +++ b/lib/square/types/search_vendors_request_sort.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines a sorter used to sort results from [SearchVendors](api-endpoint:Vendors-SearchVendors). + class SearchVendorsRequestSort < Internal::Types::Model + field :field, Square::Types::SearchVendorsRequestSortField, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/search_vendors_request_sort_field.rb b/lib/square/types/search_vendors_request_sort_field.rb new file mode 100644 index 000000000..a26877a3e --- /dev/null +++ b/lib/square/types/search_vendors_request_sort_field.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module SearchVendorsRequestSortField + extend Square::Internal::Types::Enum + NAME = "NAME" + CREATED_AT = "CREATED_AT"end + end +end diff --git a/lib/square/types/search_vendors_response.rb b/lib/square/types/search_vendors_response.rb new file mode 100644 index 000000000..fde065dbf --- /dev/null +++ b/lib/square/types/search_vendors_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [SearchVendors](api-endpoint:Vendors-SearchVendors). + class SearchVendorsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :vendors, Internal::Types::Array[Square::Types::Vendor], optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/segment_filter.rb b/lib/square/types/segment_filter.rb new file mode 100644 index 000000000..6426c2e07 --- /dev/null +++ b/lib/square/types/segment_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # A query filter to search for buyer-accessible appointment segments by. + class SegmentFilter < Internal::Types::Model + field :service_variation_id, String, optional: false, nullable: false + field :team_member_id_filter, Square::Types::FilterValue, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/select_option.rb b/lib/square/types/select_option.rb new file mode 100644 index 000000000..0d895a837 --- /dev/null +++ b/lib/square/types/select_option.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class SelectOption < Internal::Types::Model + field :reference_id, String, optional: false, nullable: false + field :title, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/select_options.rb b/lib/square/types/select_options.rb new file mode 100644 index 000000000..f72c7f7f5 --- /dev/null +++ b/lib/square/types/select_options.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class SelectOptions < Internal::Types::Model + field :title, String, optional: false, nullable: false + field :body, String, optional: false, nullable: false + field :options, Internal::Types::Array[Square::Types::SelectOption], optional: false, nullable: false + field :selected_option, Square::Types::SelectOption, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift.rb b/lib/square/types/shift.rb new file mode 100644 index 000000000..ed111db26 --- /dev/null +++ b/lib/square/types/shift.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Square + module Types + # A record of the hourly rate, start, and end times for a single work shift + # for an employee. This might include a record of the start and end times for breaks + # taken during the shift. + # + # Deprecated at Square API version 2025-05-21. Replaced by [Timecard](entity:Timecard). + # See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class Shift < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :timezone, String, optional: true, nullable: false + field :start_at, String, optional: false, nullable: false + field :end_at, String, optional: true, nullable: false + field :wage, Square::Types::ShiftWage, optional: true, nullable: false + field :breaks, Internal::Types::Array[Square::Types::Break], optional: true, nullable: false + field :status, Square::Types::ShiftStatus, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :declared_cash_tip_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_filter.rb b/lib/square/types/shift_filter.rb new file mode 100644 index 000000000..fe9edc4b5 --- /dev/null +++ b/lib/square/types/shift_filter.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines a filter used in a search for `Shift` records. `AND` logic is + # used by Square's servers to apply each filter property specified. + # + # Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class ShiftFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :employee_ids, Internal::Types::Array[String], optional: true, nullable: false + field :status, Square::Types::ShiftFilterStatus, optional: true, nullable: false + field :start, Square::Types::TimeRange, optional: true, nullable: false + field :end_, Square::Types::TimeRange, optional: true, nullable: false + field :workday, Square::Types::ShiftWorkday, optional: true, nullable: false + field :team_member_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_filter_status.rb b/lib/square/types/shift_filter_status.rb new file mode 100644 index 000000000..a02b8f642 --- /dev/null +++ b/lib/square/types/shift_filter_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ShiftFilterStatus + extend Square::Internal::Types::Enum + OPEN = "OPEN" + CLOSED = "CLOSED"end + end +end diff --git a/lib/square/types/shift_query.rb b/lib/square/types/shift_query.rb new file mode 100644 index 000000000..e018440b1 --- /dev/null +++ b/lib/square/types/shift_query.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The parameters of a `Shift` search query, which includes filter and sort options. + # + # Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class ShiftQuery < Internal::Types::Model + field :filter, Square::Types::ShiftFilter, optional: true, nullable: false + field :sort, Square::Types::ShiftSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_sort.rb b/lib/square/types/shift_sort.rb new file mode 100644 index 000000000..b563cf659 --- /dev/null +++ b/lib/square/types/shift_sort.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Sets the sort order of search results. + # + # Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class ShiftSort < Internal::Types::Model + field :field, Square::Types::ShiftSortField, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_sort_field.rb b/lib/square/types/shift_sort_field.rb new file mode 100644 index 000000000..f4fec195f --- /dev/null +++ b/lib/square/types/shift_sort_field.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module ShiftSortField + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + CREATED_AT = "CREATED_AT" + UPDATED_AT = "UPDATED_AT"end + end +end diff --git a/lib/square/types/shift_status.rb b/lib/square/types/shift_status.rb new file mode 100644 index 000000000..d8d7d78e5 --- /dev/null +++ b/lib/square/types/shift_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module ShiftStatus + extend Square::Internal::Types::Enum + OPEN = "OPEN" + CLOSED = "CLOSED"end + end +end diff --git a/lib/square/types/shift_wage.rb b/lib/square/types/shift_wage.rb new file mode 100644 index 000000000..976a86618 --- /dev/null +++ b/lib/square/types/shift_wage.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # The hourly wage rate used to compensate an employee for this shift. + # + # Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class ShiftWage < Internal::Types::Model + field :title, String, optional: true, nullable: false + field :hourly_rate, Square::Types::Money, optional: true, nullable: false + field :job_id, String, optional: true, nullable: false + field :tip_eligible, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_workday.rb b/lib/square/types/shift_workday.rb new file mode 100644 index 000000000..6aba7e060 --- /dev/null +++ b/lib/square/types/shift_workday.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # A `Shift` search query filter parameter that sets a range of days that + # a `Shift` must start or end in before passing the filter condition. + # + # Deprecated at Square API version 2025-05-21. See the [migration notes](https://developer.squareup.com/docs/labor-api/what-it-does#migration-notes). + class ShiftWorkday < Internal::Types::Model + field :date_range, Square::Types::DateRange, optional: true, nullable: false + field :match_shifts_by, Square::Types::ShiftWorkdayMatcher, optional: true, nullable: false + field :default_timezone, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/shift_workday_matcher.rb b/lib/square/types/shift_workday_matcher.rb new file mode 100644 index 000000000..d059f991b --- /dev/null +++ b/lib/square/types/shift_workday_matcher.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module ShiftWorkdayMatcher + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + INTERSECTION = "INTERSECTION"end + end +end diff --git a/lib/square/types/shipping_fee.rb b/lib/square/types/shipping_fee.rb new file mode 100644 index 000000000..60c422ac1 --- /dev/null +++ b/lib/square/types/shipping_fee.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class ShippingFee < Internal::Types::Model + field :name, String, optional: true, nullable: false + field :charge, Square::Types::Money, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/signature_image.rb b/lib/square/types/signature_image.rb new file mode 100644 index 000000000..97f27a2aa --- /dev/null +++ b/lib/square/types/signature_image.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class SignatureImage < Internal::Types::Model + field :image_type, String, optional: true, nullable: false + field :data, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/signature_options.rb b/lib/square/types/signature_options.rb new file mode 100644 index 000000000..40f960de3 --- /dev/null +++ b/lib/square/types/signature_options.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SignatureOptions < Internal::Types::Model + field :title, String, optional: false, nullable: false + field :body, String, optional: false, nullable: false + field :signature, Internal::Types::Array[Square::Types::SignatureImage], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/site.rb b/lib/square/types/site.rb new file mode 100644 index 000000000..4245bbd81 --- /dev/null +++ b/lib/square/types/site.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a Square Online site, which is an online store for a Square seller. + class Site < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :site_title, String, optional: true, nullable: false + field :domain, String, optional: true, nullable: false + field :is_published, Internal::Types::Boolean, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/snippet.rb b/lib/square/types/snippet.rb new file mode 100644 index 000000000..d43db7e34 --- /dev/null +++ b/lib/square/types/snippet.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the snippet that is added to a Square Online site. The snippet code is injected into the `head` element of all pages on the site, except for checkout pages. + class Snippet < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :site_id, String, optional: true, nullable: false + field :content, String, optional: false, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/sort_order.rb b/lib/square/types/sort_order.rb new file mode 100644 index 000000000..52eefcc7c --- /dev/null +++ b/lib/square/types/sort_order.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module SortOrder + extend Square::Internal::Types::Enum + DESC = "DESC" + ASC = "ASC"end + end +end diff --git a/lib/square/types/source_application.rb b/lib/square/types/source_application.rb new file mode 100644 index 000000000..f93da1f23 --- /dev/null +++ b/lib/square/types/source_application.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents information about the application used to generate a change. + class SourceApplication < Internal::Types::Model + field :product, Square::Types::Product, optional: true, nullable: false + field :application_id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/square_account_details.rb b/lib/square/types/square_account_details.rb new file mode 100644 index 000000000..7c04294b7 --- /dev/null +++ b/lib/square/types/square_account_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Additional details about Square Account payments. + class SquareAccountDetails < Internal::Types::Model + field :payment_source_token, String, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/standard_unit_description.rb b/lib/square/types/standard_unit_description.rb new file mode 100644 index 000000000..692d59fb7 --- /dev/null +++ b/lib/square/types/standard_unit_description.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Contains the name and abbreviation for standard measurement unit. + class StandardUnitDescription < Internal::Types::Model + field :unit, Square::Types::MeasurementUnit, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :abbreviation, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/standard_unit_description_group.rb b/lib/square/types/standard_unit_description_group.rb new file mode 100644 index 000000000..625c7aa8d --- /dev/null +++ b/lib/square/types/standard_unit_description_group.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Group of standard measurement units. + class StandardUnitDescriptionGroup < Internal::Types::Model + field :standard_unit_descriptions, Internal::Types::Array[Square::Types::StandardUnitDescription], optional: true, nullable: false + field :language_code, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/submit_evidence_response.rb b/lib/square/types/submit_evidence_response.rb new file mode 100644 index 000000000..504821556 --- /dev/null +++ b/lib/square/types/submit_evidence_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields in a `SubmitEvidence` response. + class SubmitEvidenceResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :dispute, Square::Types::Dispute, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription.rb b/lib/square/types/subscription.rb new file mode 100644 index 000000000..53995928f --- /dev/null +++ b/lib/square/types/subscription.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a subscription purchased by a customer. + # + # For more information, see + # [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). + class Subscription < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :plan_variation_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :start_date, String, optional: true, nullable: false + field :canceled_date, String, optional: true, nullable: false + field :charged_through_date, String, optional: true, nullable: false + field :status, Square::Types::SubscriptionStatus, optional: true, nullable: false + field :tax_percentage, String, optional: true, nullable: false + field :invoice_ids, Internal::Types::Array[String], optional: true, nullable: false + field :price_override_money, Square::Types::Money, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :card_id, String, optional: true, nullable: false + field :timezone, String, optional: true, nullable: false + field :source, Square::Types::SubscriptionSource, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :phases, Internal::Types::Array[Square::Types::Phase], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_action.rb b/lib/square/types/subscription_action.rb new file mode 100644 index 000000000..9bb14b987 --- /dev/null +++ b/lib/square/types/subscription_action.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an action as a pending change to a subscription. + class SubscriptionAction < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :type, Square::Types::SubscriptionActionType, optional: true, nullable: false + field :effective_date, String, optional: true, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :phases, Internal::Types::Array[Square::Types::Phase], optional: true, nullable: false + field :new_plan_variation_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_action_type.rb b/lib/square/types/subscription_action_type.rb new file mode 100644 index 000000000..3dd1083dd --- /dev/null +++ b/lib/square/types/subscription_action_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionActionType + extend Square::Internal::Types::Enum + CANCEL = "CANCEL" + PAUSE = "PAUSE" + RESUME = "RESUME" + SWAP_PLAN = "SWAP_PLAN" + CHANGE_BILLING_ANCHOR_DATE = "CHANGE_BILLING_ANCHOR_DATE"end + end +end diff --git a/lib/square/types/subscription_cadence.rb b/lib/square/types/subscription_cadence.rb new file mode 100644 index 000000000..786960b70 --- /dev/null +++ b/lib/square/types/subscription_cadence.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionCadence + extend Square::Internal::Types::Enum + DAILY = "DAILY" + WEEKLY = "WEEKLY" + EVERY_TWO_WEEKS = "EVERY_TWO_WEEKS" + THIRTY_DAYS = "THIRTY_DAYS" + SIXTY_DAYS = "SIXTY_DAYS" + NINETY_DAYS = "NINETY_DAYS" + MONTHLY = "MONTHLY" + EVERY_TWO_MONTHS = "EVERY_TWO_MONTHS" + QUARTERLY = "QUARTERLY" + EVERY_FOUR_MONTHS = "EVERY_FOUR_MONTHS" + EVERY_SIX_MONTHS = "EVERY_SIX_MONTHS" + ANNUAL = "ANNUAL" + EVERY_TWO_YEARS = "EVERY_TWO_YEARS"end + end +end diff --git a/lib/square/types/subscription_created_event.rb b/lib/square/types/subscription_created_event.rb new file mode 100644 index 000000000..f2b75d0a0 --- /dev/null +++ b/lib/square/types/subscription_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Subscription](entity:Subscription) is created. + class SubscriptionCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::SubscriptionCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_created_event_data.rb b/lib/square/types/subscription_created_event_data.rb new file mode 100644 index 000000000..0bfa6944e --- /dev/null +++ b/lib/square/types/subscription_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SubscriptionCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::SubscriptionCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_created_event_object.rb b/lib/square/types/subscription_created_event_object.rb new file mode 100644 index 000000000..cccfe363c --- /dev/null +++ b/lib/square/types/subscription_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class SubscriptionCreatedEventObject < Internal::Types::Model + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_event.rb b/lib/square/types/subscription_event.rb new file mode 100644 index 000000000..873a808f0 --- /dev/null +++ b/lib/square/types/subscription_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes changes to a subscription and the subscription status. + class SubscriptionEvent < Internal::Types::Model + field :id, String, optional: false, nullable: false + field :subscription_event_type, Square::Types::SubscriptionEventSubscriptionEventType, optional: false, nullable: false + field :effective_date, String, optional: false, nullable: false + field :monthly_billing_anchor_date, Integer, optional: true, nullable: false + field :info, Square::Types::SubscriptionEventInfo, optional: true, nullable: false + field :phases, Internal::Types::Array[Square::Types::Phase], optional: true, nullable: false + field :plan_variation_id, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_event_info.rb b/lib/square/types/subscription_event_info.rb new file mode 100644 index 000000000..c1ba244bc --- /dev/null +++ b/lib/square/types/subscription_event_info.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Provides information about the subscription event. + class SubscriptionEventInfo < Internal::Types::Model + field :detail, String, optional: true, nullable: false + field :code, Square::Types::SubscriptionEventInfoCode, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_event_info_code.rb b/lib/square/types/subscription_event_info_code.rb new file mode 100644 index 000000000..30bdd9fc1 --- /dev/null +++ b/lib/square/types/subscription_event_info_code.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionEventInfoCode + extend Square::Internal::Types::Enum + LOCATION_NOT_ACTIVE = "LOCATION_NOT_ACTIVE" + LOCATION_CANNOT_ACCEPT_PAYMENT = "LOCATION_CANNOT_ACCEPT_PAYMENT" + CUSTOMER_DELETED = "CUSTOMER_DELETED" + CUSTOMER_NO_EMAIL = "CUSTOMER_NO_EMAIL" + CUSTOMER_NO_NAME = "CUSTOMER_NO_NAME" + USER_PROVIDED = "USER_PROVIDED"end + end +end diff --git a/lib/square/types/subscription_event_subscription_event_type.rb b/lib/square/types/subscription_event_subscription_event_type.rb new file mode 100644 index 000000000..a8cd3763a --- /dev/null +++ b/lib/square/types/subscription_event_subscription_event_type.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionEventSubscriptionEventType + extend Square::Internal::Types::Enum + START_SUBSCRIPTION = "START_SUBSCRIPTION" + PLAN_CHANGE = "PLAN_CHANGE" + STOP_SUBSCRIPTION = "STOP_SUBSCRIPTION" + DEACTIVATE_SUBSCRIPTION = "DEACTIVATE_SUBSCRIPTION" + RESUME_SUBSCRIPTION = "RESUME_SUBSCRIPTION" + PAUSE_SUBSCRIPTION = "PAUSE_SUBSCRIPTION" + BILLING_ANCHOR_DATE_CHANGED = "BILLING_ANCHOR_DATE_CHANGED"end + end +end diff --git a/lib/square/types/subscription_phase.rb b/lib/square/types/subscription_phase.rb new file mode 100644 index 000000000..1a2796da7 --- /dev/null +++ b/lib/square/types/subscription_phase.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + class SubscriptionPhase < Internal::Types::Model + field :uid, String, optional: true, nullable: false + field :cadence, Square::Types::SubscriptionCadence, optional: false, nullable: false + field :periods, Integer, optional: true, nullable: false + field :recurring_price_money, Square::Types::Money, optional: true, nullable: false + field :ordinal, Integer, optional: true, nullable: false + field :pricing, Square::Types::SubscriptionPricing, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_pricing.rb b/lib/square/types/subscription_pricing.rb new file mode 100644 index 000000000..f3f76ef9f --- /dev/null +++ b/lib/square/types/subscription_pricing.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes the pricing for the subscription. + class SubscriptionPricing < Internal::Types::Model + field :type, Square::Types::SubscriptionPricingType, optional: true, nullable: false + field :discount_ids, Internal::Types::Array[String], optional: true, nullable: false + field :price_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_pricing_type.rb b/lib/square/types/subscription_pricing_type.rb new file mode 100644 index 000000000..cde4b7a95 --- /dev/null +++ b/lib/square/types/subscription_pricing_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionPricingType + extend Square::Internal::Types::Enum + STATIC = "STATIC" + RELATIVE = "RELATIVE"end + end +end diff --git a/lib/square/types/subscription_source.rb b/lib/square/types/subscription_source.rb new file mode 100644 index 000000000..9206888fa --- /dev/null +++ b/lib/square/types/subscription_source.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # The origination details of the subscription. + class SubscriptionSource < Internal::Types::Model + field :name, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_status.rb b/lib/square/types/subscription_status.rb new file mode 100644 index 000000000..1539cdc5e --- /dev/null +++ b/lib/square/types/subscription_status.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module SubscriptionStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + ACTIVE = "ACTIVE" + CANCELED = "CANCELED" + DEACTIVATED = "DEACTIVATED" + PAUSED = "PAUSED"end + end +end diff --git a/lib/square/types/subscription_test_result.rb b/lib/square/types/subscription_test_result.rb new file mode 100644 index 000000000..7455142a1 --- /dev/null +++ b/lib/square/types/subscription_test_result.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a webhook subscription, including notification URL, + # event types, and signature key. + class SubscriptionTestResult < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :status_code, Integer, optional: true, nullable: false + field :payload, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_updated_event.rb b/lib/square/types/subscription_updated_event.rb new file mode 100644 index 000000000..c44528cd0 --- /dev/null +++ b/lib/square/types/subscription_updated_event.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Subscription](entity:Subscription) is updated. + # Typically the `subscription.status` is updated as subscriptions become active + # or cancelled. + class SubscriptionUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::SubscriptionUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_updated_event_data.rb b/lib/square/types/subscription_updated_event_data.rb new file mode 100644 index 000000000..868821fd8 --- /dev/null +++ b/lib/square/types/subscription_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class SubscriptionUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::SubscriptionUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/subscription_updated_event_object.rb b/lib/square/types/subscription_updated_event_object.rb new file mode 100644 index 000000000..7ff19f6e2 --- /dev/null +++ b/lib/square/types/subscription_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class SubscriptionUpdatedEventObject < Internal::Types::Model + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/swap_plan_response.rb b/lib/square/types/swap_plan_response.rb new file mode 100644 index 000000000..17da9fa27 --- /dev/null +++ b/lib/square/types/swap_plan_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response of the + # [SwapPlan](api-endpoint:Subscriptions-SwapPlan) endpoint. + class SwapPlanResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + field :actions, Internal::Types::Array[Square::Types::SubscriptionAction], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tax_calculation_phase.rb b/lib/square/types/tax_calculation_phase.rb new file mode 100644 index 000000000..41df60b09 --- /dev/null +++ b/lib/square/types/tax_calculation_phase.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TaxCalculationPhase + extend Square::Internal::Types::Enum + TAX_SUBTOTAL_PHASE = "TAX_SUBTOTAL_PHASE" + TAX_TOTAL_PHASE = "TAX_TOTAL_PHASE"end + end +end diff --git a/lib/square/types/tax_ids.rb b/lib/square/types/tax_ids.rb new file mode 100644 index 000000000..11a533964 --- /dev/null +++ b/lib/square/types/tax_ids.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Identifiers for the location used by various governments for tax purposes. + class TaxIds < Internal::Types::Model + field :eu_vat, String, optional: true, nullable: false + field :fr_siret, String, optional: true, nullable: false + field :fr_naf, String, optional: true, nullable: false + field :es_nif, String, optional: true, nullable: false + field :jp_qii, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tax_inclusion_type.rb b/lib/square/types/tax_inclusion_type.rb new file mode 100644 index 000000000..7358bdd19 --- /dev/null +++ b/lib/square/types/tax_inclusion_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TaxInclusionType + extend Square::Internal::Types::Enum + ADDITIVE = "ADDITIVE" + INCLUSIVE = "INCLUSIVE"end + end +end diff --git a/lib/square/types/team_member.rb b/lib/square/types/team_member.rb new file mode 100644 index 000000000..9b7bde4a3 --- /dev/null +++ b/lib/square/types/team_member.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Square + module Types + # A record representing an individual team member for a business. + class TeamMember < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :is_owner, Internal::Types::Boolean, optional: true, nullable: false + field :status, Square::Types::TeamMemberStatus, optional: true, nullable: false + field :given_name, String, optional: true, nullable: false + field :family_name, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :assigned_locations, Square::Types::TeamMemberAssignedLocations, optional: true, nullable: false + field :wage_setting, Square::Types::WageSetting, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_assigned_locations.rb b/lib/square/types/team_member_assigned_locations.rb new file mode 100644 index 000000000..37b774008 --- /dev/null +++ b/lib/square/types/team_member_assigned_locations.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # An object that represents a team member's assignment to locations. + class TeamMemberAssignedLocations < Internal::Types::Model + field :assignment_type, Square::Types::TeamMemberAssignedLocationsAssignmentType, optional: true, nullable: false + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_assigned_locations_assignment_type.rb b/lib/square/types/team_member_assigned_locations_assignment_type.rb new file mode 100644 index 000000000..de748b0ad --- /dev/null +++ b/lib/square/types/team_member_assigned_locations_assignment_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TeamMemberAssignedLocationsAssignmentType + extend Square::Internal::Types::Enum + ALL_CURRENT_AND_FUTURE_LOCATIONS = "ALL_CURRENT_AND_FUTURE_LOCATIONS" + EXPLICIT_LOCATIONS = "EXPLICIT_LOCATIONS"end + end +end diff --git a/lib/square/types/team_member_booking_profile.rb b/lib/square/types/team_member_booking_profile.rb new file mode 100644 index 000000000..cbff3f48f --- /dev/null +++ b/lib/square/types/team_member_booking_profile.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # The booking profile of a seller's team member, including the team member's ID, display name, description and whether the team member can be booked as a service provider. + class TeamMemberBookingProfile < Internal::Types::Model + field :team_member_id, String, optional: true, nullable: false + field :description, String, optional: true, nullable: false + field :display_name, String, optional: true, nullable: false + field :is_bookable, Internal::Types::Boolean, optional: true, nullable: false + field :profile_image_url, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_created_event.rb b/lib/square/types/team_member_created_event.rb new file mode 100644 index 000000000..5d4435bdd --- /dev/null +++ b/lib/square/types/team_member_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Team Member is created. + class TeamMemberCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TeamMemberCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_created_event_data.rb b/lib/square/types/team_member_created_event_data.rb new file mode 100644 index 000000000..ef0df7866 --- /dev/null +++ b/lib/square/types/team_member_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TeamMemberCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_created_event_object.rb b/lib/square/types/team_member_created_event_object.rb new file mode 100644 index 000000000..a2e3c9662 --- /dev/null +++ b/lib/square/types/team_member_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberCreatedEventObject < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_invitation_status.rb b/lib/square/types/team_member_invitation_status.rb new file mode 100644 index 000000000..ea9941002 --- /dev/null +++ b/lib/square/types/team_member_invitation_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module TeamMemberInvitationStatus + extend Square::Internal::Types::Enum + UNINVITED = "UNINVITED" + PENDING = "PENDING" + ACCEPTED = "ACCEPTED"end + end +end diff --git a/lib/square/types/team_member_status.rb b/lib/square/types/team_member_status.rb new file mode 100644 index 000000000..9d555d2b3 --- /dev/null +++ b/lib/square/types/team_member_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TeamMemberStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + INACTIVE = "INACTIVE"end + end +end diff --git a/lib/square/types/team_member_updated_event.rb b/lib/square/types/team_member_updated_event.rb new file mode 100644 index 000000000..413ea6999 --- /dev/null +++ b/lib/square/types/team_member_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Team Member is updated. + class TeamMemberUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TeamMemberUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_updated_event_data.rb b/lib/square/types/team_member_updated_event_data.rb new file mode 100644 index 000000000..a6575973e --- /dev/null +++ b/lib/square/types/team_member_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TeamMemberUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_updated_event_object.rb b/lib/square/types/team_member_updated_event_object.rb new file mode 100644 index 000000000..9c9480716 --- /dev/null +++ b/lib/square/types/team_member_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberUpdatedEventObject < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_wage.rb b/lib/square/types/team_member_wage.rb new file mode 100644 index 000000000..07cbda647 --- /dev/null +++ b/lib/square/types/team_member_wage.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + # Job and wage information for a [team member](entity:TeamMember). + # This convenience object provides details needed to specify the `wage` + # field for a [timecard](entity:Timecard). + class TeamMemberWage < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :title, String, optional: true, nullable: false + field :hourly_rate, Square::Types::Money, optional: true, nullable: false + field :job_id, String, optional: true, nullable: false + field :tip_eligible, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_wage_setting_updated_event.rb b/lib/square/types/team_member_wage_setting_updated_event.rb new file mode 100644 index 000000000..e69550ee7 --- /dev/null +++ b/lib/square/types/team_member_wage_setting_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Wage Setting is updated. + class TeamMemberWageSettingUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TeamMemberWageSettingUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_wage_setting_updated_event_data.rb b/lib/square/types/team_member_wage_setting_updated_event_data.rb new file mode 100644 index 000000000..b56d2e4f1 --- /dev/null +++ b/lib/square/types/team_member_wage_setting_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberWageSettingUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TeamMemberWageSettingUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/team_member_wage_setting_updated_event_object.rb b/lib/square/types/team_member_wage_setting_updated_event_object.rb new file mode 100644 index 000000000..33d701282 --- /dev/null +++ b/lib/square/types/team_member_wage_setting_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TeamMemberWageSettingUpdatedEventObject < Internal::Types::Model + field :wage_setting, Square::Types::WageSetting, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender.rb b/lib/square/types/tender.rb new file mode 100644 index 000000000..181896e05 --- /dev/null +++ b/lib/square/types/tender.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a tender (i.e., a method of payment) used in a Square transaction. + class Tender < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :transaction_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: true, nullable: false + field :tip_money, Square::Types::Money, optional: true, nullable: false + field :processing_fee_money, Square::Types::Money, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :type, Square::Types::TenderType, optional: false, nullable: false + field :card_details, Square::Types::TenderCardDetails, optional: true, nullable: false + field :cash_details, Square::Types::TenderCashDetails, optional: true, nullable: false + field :bank_account_details, Square::Types::TenderBankAccountDetails, optional: true, nullable: false + field :buy_now_pay_later_details, Square::Types::TenderBuyNowPayLaterDetails, optional: true, nullable: false + field :square_account_details, Square::Types::TenderSquareAccountDetails, optional: true, nullable: false + field :additional_recipients, Internal::Types::Array[Square::Types::AdditionalRecipient], optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_bank_account_details.rb b/lib/square/types/tender_bank_account_details.rb new file mode 100644 index 000000000..bc0809f5f --- /dev/null +++ b/lib/square/types/tender_bank_account_details.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a tender with `type` `BANK_ACCOUNT`. + # + # See [BankAccountPaymentDetails](entity:BankAccountPaymentDetails) + # for more exposed details of a bank account payment. + class TenderBankAccountDetails < Internal::Types::Model + field :status, Square::Types::TenderBankAccountDetailsStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_bank_account_details_status.rb b/lib/square/types/tender_bank_account_details_status.rb new file mode 100644 index 000000000..089f1dc30 --- /dev/null +++ b/lib/square/types/tender_bank_account_details_status.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderBankAccountDetailsStatus + extend Square::Internal::Types::Enum + PENDING = "PENDING" + COMPLETED = "COMPLETED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/tender_buy_now_pay_later_details.rb b/lib/square/types/tender_buy_now_pay_later_details.rb new file mode 100644 index 000000000..eca92c616 --- /dev/null +++ b/lib/square/types/tender_buy_now_pay_later_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a tender with `type` `BUY_NOW_PAY_LATER`. + class TenderBuyNowPayLaterDetails < Internal::Types::Model + field :buy_now_pay_later_brand, Square::Types::TenderBuyNowPayLaterDetailsBrand, optional: true, nullable: false + field :status, Square::Types::TenderBuyNowPayLaterDetailsStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_buy_now_pay_later_details_brand.rb b/lib/square/types/tender_buy_now_pay_later_details_brand.rb new file mode 100644 index 000000000..849ccc6f2 --- /dev/null +++ b/lib/square/types/tender_buy_now_pay_later_details_brand.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderBuyNowPayLaterDetailsBrand + extend Square::Internal::Types::Enum + OTHER_BRAND = "OTHER_BRAND" + AFTERPAY = "AFTERPAY"end + end +end diff --git a/lib/square/types/tender_buy_now_pay_later_details_status.rb b/lib/square/types/tender_buy_now_pay_later_details_status.rb new file mode 100644 index 000000000..2a132ac7d --- /dev/null +++ b/lib/square/types/tender_buy_now_pay_later_details_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderBuyNowPayLaterDetailsStatus + extend Square::Internal::Types::Enum + AUTHORIZED = "AUTHORIZED" + CAPTURED = "CAPTURED" + VOIDED = "VOIDED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/tender_card_details.rb b/lib/square/types/tender_card_details.rb new file mode 100644 index 000000000..69f077962 --- /dev/null +++ b/lib/square/types/tender_card_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents additional details of a tender with `type` `CARD` or `SQUARE_GIFT_CARD` + class TenderCardDetails < Internal::Types::Model + field :status, Square::Types::TenderCardDetailsStatus, optional: true, nullable: false + field :card, Square::Types::Card, optional: true, nullable: false + field :entry_method, Square::Types::TenderCardDetailsEntryMethod, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_card_details_entry_method.rb b/lib/square/types/tender_card_details_entry_method.rb new file mode 100644 index 000000000..8118a502d --- /dev/null +++ b/lib/square/types/tender_card_details_entry_method.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderCardDetailsEntryMethod + extend Square::Internal::Types::Enum + SWIPED = "SWIPED" + KEYED = "KEYED" + EMV = "EMV" + ON_FILE = "ON_FILE" + CONTACTLESS = "CONTACTLESS"end + end +end diff --git a/lib/square/types/tender_card_details_status.rb b/lib/square/types/tender_card_details_status.rb new file mode 100644 index 000000000..75f266141 --- /dev/null +++ b/lib/square/types/tender_card_details_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderCardDetailsStatus + extend Square::Internal::Types::Enum + AUTHORIZED = "AUTHORIZED" + CAPTURED = "CAPTURED" + VOIDED = "VOIDED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/tender_cash_details.rb b/lib/square/types/tender_cash_details.rb new file mode 100644 index 000000000..f3a8265ce --- /dev/null +++ b/lib/square/types/tender_cash_details.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a tender with `type` `CASH`. + class TenderCashDetails < Internal::Types::Model + field :buyer_tendered_money, Square::Types::Money, optional: true, nullable: false + field :change_back_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_square_account_details.rb b/lib/square/types/tender_square_account_details.rb new file mode 100644 index 000000000..8585a62bf --- /dev/null +++ b/lib/square/types/tender_square_account_details.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a tender with `type` `SQUARE_ACCOUNT`. + class TenderSquareAccountDetails < Internal::Types::Model + field :status, Square::Types::TenderSquareAccountDetailsStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/tender_square_account_details_status.rb b/lib/square/types/tender_square_account_details_status.rb new file mode 100644 index 000000000..e33175dbe --- /dev/null +++ b/lib/square/types/tender_square_account_details_status.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderSquareAccountDetailsStatus + extend Square::Internal::Types::Enum + AUTHORIZED = "AUTHORIZED" + CAPTURED = "CAPTURED" + VOIDED = "VOIDED" + FAILED = "FAILED"end + end +end diff --git a/lib/square/types/tender_type.rb b/lib/square/types/tender_type.rb new file mode 100644 index 000000000..84f68dc65 --- /dev/null +++ b/lib/square/types/tender_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Square + module Types + module TenderType + extend Square::Internal::Types::Enum + CARD = "CARD" + CASH = "CASH" + THIRD_PARTY_CARD = "THIRD_PARTY_CARD" + SQUARE_GIFT_CARD = "SQUARE_GIFT_CARD" + NO_SALE = "NO_SALE" + BANK_ACCOUNT = "BANK_ACCOUNT" + WALLET = "WALLET" + BUY_NOW_PAY_LATER = "BUY_NOW_PAY_LATER" + SQUARE_ACCOUNT = "SQUARE_ACCOUNT" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/terminal_action.rb b/lib/square/types/terminal_action.rb new file mode 100644 index 000000000..a50eab4a3 --- /dev/null +++ b/lib/square/types/terminal_action.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an action processed by the Square Terminal. + class TerminalAction < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :device_id, String, optional: true, nullable: false + field :deadline_duration, String, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :cancel_reason, Square::Types::ActionCancelReason, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :app_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, Square::Types::TerminalActionActionType, optional: true, nullable: false + field :qr_code_options, Square::Types::QrCodeOptions, optional: true, nullable: false + field :save_card_options, Square::Types::SaveCardOptions, optional: true, nullable: false + field :signature_options, Square::Types::SignatureOptions, optional: true, nullable: false + field :confirmation_options, Square::Types::ConfirmationOptions, optional: true, nullable: false + field :receipt_options, Square::Types::ReceiptOptions, optional: true, nullable: false + field :data_collection_options, Square::Types::DataCollectionOptions, optional: true, nullable: false + field :select_options, Square::Types::SelectOptions, optional: true, nullable: false + field :device_metadata, Square::Types::DeviceMetadata, optional: true, nullable: false + field :await_next_action, Internal::Types::Boolean, optional: true, nullable: false + field :await_next_action_duration, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_action_type.rb b/lib/square/types/terminal_action_action_type.rb new file mode 100644 index 000000000..46642130b --- /dev/null +++ b/lib/square/types/terminal_action_action_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module TerminalActionActionType + extend Square::Internal::Types::Enum + QR_CODE = "QR_CODE" + PING = "PING" + SAVE_CARD = "SAVE_CARD" + SIGNATURE = "SIGNATURE" + CONFIRMATION = "CONFIRMATION" + RECEIPT = "RECEIPT" + DATA_COLLECTION = "DATA_COLLECTION" + SELECT = "SELECT"end + end +end diff --git a/lib/square/types/terminal_action_created_event.rb b/lib/square/types/terminal_action_created_event.rb new file mode 100644 index 000000000..2376b4ef2 --- /dev/null +++ b/lib/square/types/terminal_action_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a TerminalAction is created. + class TerminalActionCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalActionCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_created_event_data.rb b/lib/square/types/terminal_action_created_event_data.rb new file mode 100644 index 000000000..3b0a9992d --- /dev/null +++ b/lib/square/types/terminal_action_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalActionCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_created_event_object.rb b/lib/square/types/terminal_action_created_event_object.rb new file mode 100644 index 000000000..3744cfe2d --- /dev/null +++ b/lib/square/types/terminal_action_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionCreatedEventObject < Internal::Types::Model + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_query.rb b/lib/square/types/terminal_action_query.rb new file mode 100644 index 000000000..b6e4c5c0e --- /dev/null +++ b/lib/square/types/terminal_action_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionQuery < Internal::Types::Model + field :filter, Square::Types::TerminalActionQueryFilter, optional: true, nullable: false + field :sort, Square::Types::TerminalActionQuerySort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_query_filter.rb b/lib/square/types/terminal_action_query_filter.rb new file mode 100644 index 000000000..8fa2e33d4 --- /dev/null +++ b/lib/square/types/terminal_action_query_filter.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionQueryFilter < Internal::Types::Model + field :device_id, String, optional: true, nullable: false + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :type, Square::Types::TerminalActionActionType, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_query_sort.rb b/lib/square/types/terminal_action_query_sort.rb new file mode 100644 index 000000000..7011c49bc --- /dev/null +++ b/lib/square/types/terminal_action_query_sort.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionQuerySort < Internal::Types::Model + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_updated_event.rb b/lib/square/types/terminal_action_updated_event.rb new file mode 100644 index 000000000..2bbfdf2b5 --- /dev/null +++ b/lib/square/types/terminal_action_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a TerminalAction is updated. + class TerminalActionUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalActionUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_updated_event_data.rb b/lib/square/types/terminal_action_updated_event_data.rb new file mode 100644 index 000000000..76b277154 --- /dev/null +++ b/lib/square/types/terminal_action_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalActionUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_action_updated_event_object.rb b/lib/square/types/terminal_action_updated_event_object.rb new file mode 100644 index 000000000..fe747a395 --- /dev/null +++ b/lib/square/types/terminal_action_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalActionUpdatedEventObject < Internal::Types::Model + field :action, Square::Types::TerminalAction, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout.rb b/lib/square/types/terminal_checkout.rb new file mode 100644 index 000000000..7070c1ae9 --- /dev/null +++ b/lib/square/types/terminal_checkout.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a checkout processed by the Square Terminal. + class TerminalCheckout < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :reference_id, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + field :payment_options, Square::Types::PaymentOptions, optional: true, nullable: false + field :device_options, Square::Types::DeviceCheckoutOptions, optional: false, nullable: false + field :deadline_duration, String, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :cancel_reason, Square::Types::ActionCancelReason, optional: true, nullable: false + field :payment_ids, Internal::Types::Array[String], optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :app_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :payment_type, Square::Types::CheckoutOptionsPaymentType, optional: true, nullable: false + field :team_member_id, String, optional: true, nullable: false + field :customer_id, String, optional: true, nullable: false + field :app_fee_money, Square::Types::Money, optional: true, nullable: false + field :statement_description_identifier, String, optional: true, nullable: false + field :tip_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_created_event.rb b/lib/square/types/terminal_checkout_created_event.rb new file mode 100644 index 000000000..d7ce61caf --- /dev/null +++ b/lib/square/types/terminal_checkout_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [TerminalCheckout](entity:TerminalCheckout) is created. + class TerminalCheckoutCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalCheckoutCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_created_event_data.rb b/lib/square/types/terminal_checkout_created_event_data.rb new file mode 100644 index 000000000..776394d81 --- /dev/null +++ b/lib/square/types/terminal_checkout_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalCheckoutCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_created_event_object.rb b/lib/square/types/terminal_checkout_created_event_object.rb new file mode 100644 index 000000000..fdf25f335 --- /dev/null +++ b/lib/square/types/terminal_checkout_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutCreatedEventObject < Internal::Types::Model + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_query.rb b/lib/square/types/terminal_checkout_query.rb new file mode 100644 index 000000000..1ea90fe6c --- /dev/null +++ b/lib/square/types/terminal_checkout_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutQuery < Internal::Types::Model + field :filter, Square::Types::TerminalCheckoutQueryFilter, optional: true, nullable: false + field :sort, Square::Types::TerminalCheckoutQuerySort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_query_filter.rb b/lib/square/types/terminal_checkout_query_filter.rb new file mode 100644 index 000000000..ded8e66c7 --- /dev/null +++ b/lib/square/types/terminal_checkout_query_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutQueryFilter < Internal::Types::Model + field :device_id, String, optional: true, nullable: false + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + field :status, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_query_sort.rb b/lib/square/types/terminal_checkout_query_sort.rb new file mode 100644 index 000000000..34afa2569 --- /dev/null +++ b/lib/square/types/terminal_checkout_query_sort.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutQuerySort < Internal::Types::Model + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_updated_event.rb b/lib/square/types/terminal_checkout_updated_event.rb new file mode 100644 index 000000000..92f162453 --- /dev/null +++ b/lib/square/types/terminal_checkout_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [TerminalCheckout](entity:TerminalCheckout) is updated. + class TerminalCheckoutUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalCheckoutUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_updated_event_data.rb b/lib/square/types/terminal_checkout_updated_event_data.rb new file mode 100644 index 000000000..9d37f57b7 --- /dev/null +++ b/lib/square/types/terminal_checkout_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalCheckoutUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_checkout_updated_event_object.rb b/lib/square/types/terminal_checkout_updated_event_object.rb new file mode 100644 index 000000000..4b3fe1afd --- /dev/null +++ b/lib/square/types/terminal_checkout_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalCheckoutUpdatedEventObject < Internal::Types::Model + field :checkout, Square::Types::TerminalCheckout, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund.rb b/lib/square/types/terminal_refund.rb new file mode 100644 index 000000000..32c6750ad --- /dev/null +++ b/lib/square/types/terminal_refund.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a payment refund processed by the Square Terminal. Only supports Interac (Canadian debit network) payment refunds. + class TerminalRefund < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :refund_id, String, optional: true, nullable: false + field :payment_id, String, optional: false, nullable: false + field :order_id, String, optional: true, nullable: false + field :amount_money, Square::Types::Money, optional: false, nullable: false + field :reason, String, optional: false, nullable: false + field :device_id, String, optional: false, nullable: false + field :deadline_duration, String, optional: true, nullable: false + field :status, String, optional: true, nullable: false + field :cancel_reason, Square::Types::ActionCancelReason, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :app_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_created_event.rb b/lib/square/types/terminal_refund_created_event.rb new file mode 100644 index 000000000..f7e333981 --- /dev/null +++ b/lib/square/types/terminal_refund_created_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Terminal API refund is created. + class TerminalRefundCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalRefundCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_created_event_data.rb b/lib/square/types/terminal_refund_created_event_data.rb new file mode 100644 index 000000000..b05b29b8e --- /dev/null +++ b/lib/square/types/terminal_refund_created_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalRefundCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_created_event_object.rb b/lib/square/types/terminal_refund_created_event_object.rb new file mode 100644 index 000000000..71e9a1c45 --- /dev/null +++ b/lib/square/types/terminal_refund_created_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundCreatedEventObject < Internal::Types::Model + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_query.rb b/lib/square/types/terminal_refund_query.rb new file mode 100644 index 000000000..79e3f2dee --- /dev/null +++ b/lib/square/types/terminal_refund_query.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundQuery < Internal::Types::Model + field :filter, Square::Types::TerminalRefundQueryFilter, optional: true, nullable: false + field :sort, Square::Types::TerminalRefundQuerySort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_query_filter.rb b/lib/square/types/terminal_refund_query_filter.rb new file mode 100644 index 000000000..e67662955 --- /dev/null +++ b/lib/square/types/terminal_refund_query_filter.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundQueryFilter < Internal::Types::Model + field :device_id, String, optional: true, nullable: false + field :created_at, Square::Types::TimeRange, optional: true, nullable: false + field :status, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_query_sort.rb b/lib/square/types/terminal_refund_query_sort.rb new file mode 100644 index 000000000..a1df9beae --- /dev/null +++ b/lib/square/types/terminal_refund_query_sort.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundQuerySort < Internal::Types::Model + field :sort_order, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_updated_event.rb b/lib/square/types/terminal_refund_updated_event.rb new file mode 100644 index 000000000..3787d4830 --- /dev/null +++ b/lib/square/types/terminal_refund_updated_event.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a Terminal API refund is updated. + class TerminalRefundUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::TerminalRefundUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_updated_event_data.rb b/lib/square/types/terminal_refund_updated_event_data.rb new file mode 100644 index 000000000..4f615cf31 --- /dev/null +++ b/lib/square/types/terminal_refund_updated_event_data.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::TerminalRefundUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/terminal_refund_updated_event_object.rb b/lib/square/types/terminal_refund_updated_event_object.rb new file mode 100644 index 000000000..56d35f666 --- /dev/null +++ b/lib/square/types/terminal_refund_updated_event_object.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class TerminalRefundUpdatedEventObject < Internal::Types::Model + field :refund, Square::Types::TerminalRefund, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/test_webhook_subscription_response.rb b/lib/square/types/test_webhook_subscription_response.rb new file mode 100644 index 000000000..b4f6c97f2 --- /dev/null +++ b/lib/square/types/test_webhook_subscription_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [TestWebhookSubscription](api-endpoint:WebhookSubscriptions-TestWebhookSubscription) endpoint. + # + # Note: If there are errors processing the request, the [SubscriptionTestResult](entity:SubscriptionTestResult) field is not + # present. + class TestWebhookSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription_test_result, Square::Types::SubscriptionTestResult, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/time_range.rb b/lib/square/types/time_range.rb new file mode 100644 index 000000000..781a1d319 --- /dev/null +++ b/lib/square/types/time_range.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a generic time range. The start and end values are + # represented in RFC 3339 format. Time ranges are customized to be + # inclusive or exclusive based on the needs of a particular endpoint. + # Refer to the relevant endpoint-specific documentation to determine + # how time ranges are handled. + class TimeRange < Internal::Types::Model + field :start_at, String, optional: true, nullable: false + field :end_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard.rb b/lib/square/types/timecard.rb new file mode 100644 index 000000000..f9be9ae5f --- /dev/null +++ b/lib/square/types/timecard.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Square + module Types + # A record of the hourly rate, start time, and end time of a single timecard (shift) + # for a team member. This might include a record of the start and end times of breaks + # taken during the shift. + class Timecard < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: false, nullable: false + field :timezone, String, optional: true, nullable: false + field :start_at, String, optional: false, nullable: false + field :end_at, String, optional: true, nullable: false + field :wage, Square::Types::TimecardWage, optional: true, nullable: false + field :breaks, Internal::Types::Array[Square::Types::Break], optional: true, nullable: false + field :status, Square::Types::TimecardStatus, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :team_member_id, String, optional: false, nullable: false + field :declared_cash_tip_money, Square::Types::Money, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_filter.rb b/lib/square/types/timecard_filter.rb new file mode 100644 index 000000000..a5f631870 --- /dev/null +++ b/lib/square/types/timecard_filter.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines a filter used in a search for `Timecard` records. `AND` logic is + # used by Square's servers to apply each filter property specified. + class TimecardFilter < Internal::Types::Model + field :location_ids, Internal::Types::Array[String], optional: true, nullable: false + field :status, Square::Types::TimecardFilterStatus, optional: true, nullable: false + field :start, Square::Types::TimeRange, optional: true, nullable: false + field :end_, Square::Types::TimeRange, optional: true, nullable: false + field :workday, Square::Types::TimecardWorkday, optional: true, nullable: false + field :team_member_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_filter_status.rb b/lib/square/types/timecard_filter_status.rb new file mode 100644 index 000000000..a90eeb8ed --- /dev/null +++ b/lib/square/types/timecard_filter_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TimecardFilterStatus + extend Square::Internal::Types::Enum + OPEN = "OPEN" + CLOSED = "CLOSED"end + end +end diff --git a/lib/square/types/timecard_query.rb b/lib/square/types/timecard_query.rb new file mode 100644 index 000000000..d6628797e --- /dev/null +++ b/lib/square/types/timecard_query.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The parameters of a `Timecard` search query, which includes filter and sort options. + class TimecardQuery < Internal::Types::Model + field :filter, Square::Types::TimecardFilter, optional: true, nullable: false + field :sort, Square::Types::TimecardSort, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_sort.rb b/lib/square/types/timecard_sort.rb new file mode 100644 index 000000000..e3d25c6fe --- /dev/null +++ b/lib/square/types/timecard_sort.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Sets the sort order of search results. + class TimecardSort < Internal::Types::Model + field :field, Square::Types::TimecardSortField, optional: true, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_sort_field.rb b/lib/square/types/timecard_sort_field.rb new file mode 100644 index 000000000..f6e38c45f --- /dev/null +++ b/lib/square/types/timecard_sort_field.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + module TimecardSortField + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + CREATED_AT = "CREATED_AT" + UPDATED_AT = "UPDATED_AT"end + end +end diff --git a/lib/square/types/timecard_status.rb b/lib/square/types/timecard_status.rb new file mode 100644 index 000000000..f27346110 --- /dev/null +++ b/lib/square/types/timecard_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TimecardStatus + extend Square::Internal::Types::Enum + OPEN = "OPEN" + CLOSED = "CLOSED"end + end +end diff --git a/lib/square/types/timecard_wage.rb b/lib/square/types/timecard_wage.rb new file mode 100644 index 000000000..58a54a64b --- /dev/null +++ b/lib/square/types/timecard_wage.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The hourly wage rate used to compensate a team member for a [timecard](entity:Timecard). + class TimecardWage < Internal::Types::Model + field :title, String, optional: true, nullable: false + field :hourly_rate, Square::Types::Money, optional: true, nullable: false + field :job_id, String, optional: true, nullable: false + field :tip_eligible, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_workday.rb b/lib/square/types/timecard_workday.rb new file mode 100644 index 000000000..96ab52d24 --- /dev/null +++ b/lib/square/types/timecard_workday.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A `Timecard` search query filter parameter that sets a range of days that + # a `Timecard` must start or end in before passing the filter condition. + class TimecardWorkday < Internal::Types::Model + field :date_range, Square::Types::DateRange, optional: true, nullable: false + field :match_timecards_by, Square::Types::TimecardWorkdayMatcher, optional: true, nullable: false + field :default_timezone, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/timecard_workday_matcher.rb b/lib/square/types/timecard_workday_matcher.rb new file mode 100644 index 000000000..53c922e0f --- /dev/null +++ b/lib/square/types/timecard_workday_matcher.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module TimecardWorkdayMatcher + extend Square::Internal::Types::Enum + START_AT = "START_AT" + END_AT = "END_AT" + INTERSECTION = "INTERSECTION"end + end +end diff --git a/lib/square/types/tip_settings.rb b/lib/square/types/tip_settings.rb new file mode 100644 index 000000000..9aae14667 --- /dev/null +++ b/lib/square/types/tip_settings.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + class TipSettings < Internal::Types::Model + field :allow_tipping, Internal::Types::Boolean, optional: true, nullable: false + field :separate_tip_screen, Internal::Types::Boolean, optional: true, nullable: false + field :custom_tip_field, Internal::Types::Boolean, optional: true, nullable: false + field :tip_percentages, Internal::Types::Array[Integer], optional: true, nullable: false + field :smart_tipping, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/transaction.rb b/lib/square/types/transaction.rb new file mode 100644 index 000000000..e0c859b4e --- /dev/null +++ b/lib/square/types/transaction.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a transaction processed with Square, either with the + # Connect API or with Square Point of Sale. + # + # The `tenders` field of this object lists all methods of payment used to pay in + # the transaction. + class Transaction < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :tenders, Internal::Types::Array[Square::Types::Tender], optional: true, nullable: false + field :refunds, Internal::Types::Array[Square::Types::Refund], optional: true, nullable: false + field :reference_id, String, optional: true, nullable: false + field :product, Square::Types::TransactionProduct, optional: true, nullable: false + field :client_id, String, optional: true, nullable: false + field :shipping_address, Square::Types::Address, optional: true, nullable: false + field :order_id, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/transaction_product.rb b/lib/square/types/transaction_product.rb new file mode 100644 index 000000000..05918f551 --- /dev/null +++ b/lib/square/types/transaction_product.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module TransactionProduct + extend Square::Internal::Types::Enum + REGISTER = "REGISTER" + EXTERNAL_API = "EXTERNAL_API" + BILLING = "BILLING" + APPOINTMENTS = "APPOINTMENTS" + INVOICES = "INVOICES" + ONLINE_STORE = "ONLINE_STORE" + PAYROLL = "PAYROLL" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/transaction_type.rb b/lib/square/types/transaction_type.rb new file mode 100644 index 000000000..81d3596b2 --- /dev/null +++ b/lib/square/types/transaction_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module TransactionType + extend Square::Internal::Types::Enum + DEBIT = "DEBIT" + CREDIT = "CREDIT"end + end +end diff --git a/lib/square/types/unlink_customer_from_gift_card_response.rb b/lib/square/types/unlink_customer_from_gift_card_response.rb new file mode 100644 index 000000000..246858091 --- /dev/null +++ b/lib/square/types/unlink_customer_from_gift_card_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # A response that contains the unlinked `GiftCard` object. If the request resulted in errors, + # the response contains a set of `Error` objects. + class UnlinkCustomerFromGiftCardResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :gift_card, Square::Types::GiftCard, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_booking_custom_attribute_definition_response.rb b/lib/square/types/update_booking_custom_attribute_definition_response.rb new file mode 100644 index 000000000..a890b1133 --- /dev/null +++ b/lib/square/types/update_booking_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateBookingCustomAttributeDefinition](api-endpoint:BookingCustomAttributes-UpdateBookingCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpdateBookingCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_booking_response.rb b/lib/square/types/update_booking_response.rb new file mode 100644 index 000000000..55600008d --- /dev/null +++ b/lib/square/types/update_booking_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateBookingResponse < Internal::Types::Model + field :booking, Square::Types::Booking, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_break_type_response.rb b/lib/square/types/update_break_type_response.rb new file mode 100644 index 000000000..4ae7a8f5d --- /dev/null +++ b/lib/square/types/update_break_type_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # A response to a request to update a `BreakType`. The response contains + # the requested `BreakType` objects and might contain a set of `Error` objects if + # the request resulted in errors. + class UpdateBreakTypeResponse < Internal::Types::Model + field :break_type, Square::Types::BreakType, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_catalog_image_request.rb b/lib/square/types/update_catalog_image_request.rb new file mode 100644 index 000000000..4998aacaa --- /dev/null +++ b/lib/square/types/update_catalog_image_request.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateCatalogImageRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/update_catalog_image_response.rb b/lib/square/types/update_catalog_image_response.rb new file mode 100644 index 000000000..4e59f1216 --- /dev/null +++ b/lib/square/types/update_catalog_image_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateCatalogImageResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :image, Square::Types::CatalogObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_customer_custom_attribute_definition_response.rb b/lib/square/types/update_customer_custom_attribute_definition_response.rb new file mode 100644 index 000000000..2a5817b6e --- /dev/null +++ b/lib/square/types/update_customer_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateCustomerCustomAttributeDefinition](api-endpoint:CustomerCustomAttributes-UpdateCustomerCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpdateCustomerCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_customer_group_response.rb b/lib/square/types/update_customer_group_response.rb new file mode 100644 index 000000000..e4d3cd7ff --- /dev/null +++ b/lib/square/types/update_customer_group_response.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [UpdateCustomerGroup](api-endpoint:CustomerGroups-UpdateCustomerGroup) endpoint. + # + # Either `errors` or `group` is present in a given response (never both). + class UpdateCustomerGroupResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :group, Square::Types::CustomerGroup, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_customer_response.rb b/lib/square/types/update_customer_response.rb new file mode 100644 index 000000000..bb5ca9ac6 --- /dev/null +++ b/lib/square/types/update_customer_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [UpdateCustomer](api-endpoint:Customers-UpdateCustomer) or + # [BulkUpdateCustomers](api-endpoint:Customers-BulkUpdateCustomers) endpoint. + # + # Either `errors` or `customer` is present in a given response (never both). + class UpdateCustomerResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :customer, Square::Types::Customer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_invoice_response.rb b/lib/square/types/update_invoice_response.rb new file mode 100644 index 000000000..a576c63eb --- /dev/null +++ b/lib/square/types/update_invoice_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Describes a `UpdateInvoice` response. + class UpdateInvoiceResponse < Internal::Types::Model + field :invoice, Square::Types::Invoice, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_item_modifier_lists_response.rb b/lib/square/types/update_item_modifier_lists_response.rb new file mode 100644 index 000000000..319c3d183 --- /dev/null +++ b/lib/square/types/update_item_modifier_lists_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateItemModifierListsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_item_taxes_response.rb b/lib/square/types/update_item_taxes_response.rb new file mode 100644 index 000000000..c6da36bd9 --- /dev/null +++ b/lib/square/types/update_item_taxes_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateItemTaxesResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_job_response.rb b/lib/square/types/update_job_response.rb new file mode 100644 index 000000000..42f457908 --- /dev/null +++ b/lib/square/types/update_job_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateJob](api-endpoint:Team-UpdateJob) response. Either `job` or `errors` + # is present in the response. + class UpdateJobResponse < Internal::Types::Model + field :job, Square::Types::Job, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_location_custom_attribute_definition_response.rb b/lib/square/types/update_location_custom_attribute_definition_response.rb new file mode 100644 index 000000000..bae1fb1f3 --- /dev/null +++ b/lib/square/types/update_location_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateLocationCustomAttributeDefinition](api-endpoint:LocationCustomAttributes-UpdateLocationCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpdateLocationCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_location_response.rb b/lib/square/types/update_location_response.rb new file mode 100644 index 000000000..d49c48e2d --- /dev/null +++ b/lib/square/types/update_location_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # The response object returned by the [UpdateLocation](api-endpoint:Locations-UpdateLocation) endpoint. + class UpdateLocationResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :location, Square::Types::Location, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_location_settings_response.rb b/lib/square/types/update_location_settings_response.rb new file mode 100644 index 000000000..7b2b36a0d --- /dev/null +++ b/lib/square/types/update_location_settings_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateLocationSettingsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :location_settings, Square::Types::CheckoutLocationSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_merchant_custom_attribute_definition_response.rb b/lib/square/types/update_merchant_custom_attribute_definition_response.rb new file mode 100644 index 000000000..30c72d4f1 --- /dev/null +++ b/lib/square/types/update_merchant_custom_attribute_definition_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateMerchantCustomAttributeDefinition](api-endpoint:MerchantCustomAttributes-UpdateMerchantCustomAttributeDefinition) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpdateMerchantCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_merchant_settings_response.rb b/lib/square/types/update_merchant_settings_response.rb new file mode 100644 index 000000000..8273f0e19 --- /dev/null +++ b/lib/square/types/update_merchant_settings_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdateMerchantSettingsResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :merchant_settings, Square::Types::CheckoutMerchantSettings, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_order_custom_attribute_definition_response.rb b/lib/square/types/update_order_custom_attribute_definition_response.rb new file mode 100644 index 000000000..b9e4bbfea --- /dev/null +++ b/lib/square/types/update_order_custom_attribute_definition_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from updating an order custom attribute definition. + class UpdateOrderCustomAttributeDefinitionResponse < Internal::Types::Model + field :custom_attribute_definition, Square::Types::CustomAttributeDefinition, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_order_response.rb b/lib/square/types/update_order_response.rb new file mode 100644 index 000000000..9b162191a --- /dev/null +++ b/lib/square/types/update_order_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. + class UpdateOrderResponse < Internal::Types::Model + field :order, Square::Types::Order, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_payment_link_response.rb b/lib/square/types/update_payment_link_response.rb new file mode 100644 index 000000000..2ea5a8941 --- /dev/null +++ b/lib/square/types/update_payment_link_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class UpdatePaymentLinkResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment_link, Square::Types::PaymentLink, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_payment_response.rb b/lib/square/types/update_payment_response.rb new file mode 100644 index 000000000..bed195a8d --- /dev/null +++ b/lib/square/types/update_payment_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the response returned by + # [UpdatePayment](api-endpoint:Payments-UpdatePayment). + class UpdatePaymentResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :payment, Square::Types::Payment, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_scheduled_shift_response.rb b/lib/square/types/update_scheduled_shift_response.rb new file mode 100644 index 000000000..b09cb00ca --- /dev/null +++ b/lib/square/types/update_scheduled_shift_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpdateScheduledShift](api-endpoint:Labor-UpdateScheduledShift) response. + # Either `scheduled_shift` or `errors` is present in the response. + class UpdateScheduledShiftResponse < Internal::Types::Model + field :scheduled_shift, Square::Types::ScheduledShift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_shift_response.rb b/lib/square/types/update_shift_response.rb new file mode 100644 index 000000000..7628443b5 --- /dev/null +++ b/lib/square/types/update_shift_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to update a `Shift`. The response contains + # the updated `Shift` object and might contain a set of `Error` objects if + # the request resulted in errors. + class UpdateShiftResponse < Internal::Types::Model + field :shift, Square::Types::Shift, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_subscription_response.rb b/lib/square/types/update_subscription_response.rb new file mode 100644 index 000000000..94175e805 --- /dev/null +++ b/lib/square/types/update_subscription_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines output parameters in a response from the + # [UpdateSubscription](api-endpoint:Subscriptions-UpdateSubscription) endpoint. + class UpdateSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::Subscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_team_member_request.rb b/lib/square/types/update_team_member_request.rb new file mode 100644 index 000000000..edfca8064 --- /dev/null +++ b/lib/square/types/update_team_member_request.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an update request for a `TeamMember` object. + class UpdateTeamMemberRequest < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_team_member_response.rb b/lib/square/types/update_team_member_response.rb new file mode 100644 index 000000000..04d32b468 --- /dev/null +++ b/lib/square/types/update_team_member_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from an update request containing the updated `TeamMember` object or error messages. + class UpdateTeamMemberResponse < Internal::Types::Model + field :team_member, Square::Types::TeamMember, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_timecard_response.rb b/lib/square/types/update_timecard_response.rb new file mode 100644 index 000000000..580e2ffbf --- /dev/null +++ b/lib/square/types/update_timecard_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to update a `Timecard`. The response contains + # the updated `Timecard` object and might contain a set of `Error` objects if + # the request resulted in errors. + class UpdateTimecardResponse < Internal::Types::Model + field :timecard, Square::Types::Timecard, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_vendor_request.rb b/lib/square/types/update_vendor_request.rb new file mode 100644 index 000000000..1a6b814c5 --- /dev/null +++ b/lib/square/types/update_vendor_request.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an input to a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). + class UpdateVendorRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/update_vendor_response.rb b/lib/square/types/update_vendor_response.rb new file mode 100644 index 000000000..6794d346c --- /dev/null +++ b/lib/square/types/update_vendor_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an output from a call to [UpdateVendor](api-endpoint:Vendors-UpdateVendor). + class UpdateVendorResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_wage_setting_response.rb b/lib/square/types/update_wage_setting_response.rb new file mode 100644 index 000000000..42ba7724f --- /dev/null +++ b/lib/square/types/update_wage_setting_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from an update request containing the updated `WageSetting` object + # or error messages. + class UpdateWageSettingResponse < Internal::Types::Model + field :wage_setting, Square::Types::WageSetting, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_webhook_subscription_response.rb b/lib/square/types/update_webhook_subscription_response.rb new file mode 100644 index 000000000..0f480d9f6 --- /dev/null +++ b/lib/square/types/update_webhook_subscription_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [UpdateWebhookSubscription](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscription) endpoint. + # + # Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not + # present. + class UpdateWebhookSubscriptionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :subscription, Square::Types::WebhookSubscription, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_webhook_subscription_signature_key_response.rb b/lib/square/types/update_webhook_subscription_signature_key_response.rb new file mode 100644 index 000000000..fe9b8027b --- /dev/null +++ b/lib/square/types/update_webhook_subscription_signature_key_response.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [UpdateWebhookSubscriptionSignatureKey](api-endpoint:WebhookSubscriptions-UpdateWebhookSubscriptionSignatureKey) endpoint. + # + # Note: If there are errors processing the request, the [Subscription](entity:WebhookSubscription) is not + # present. + class UpdateWebhookSubscriptionSignatureKeyResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :signature_key, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/update_workweek_config_response.rb b/lib/square/types/update_workweek_config_response.rb new file mode 100644 index 000000000..b49cc4cbe --- /dev/null +++ b/lib/square/types/update_workweek_config_response.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + # The response to a request to update a `WorkweekConfig` object. The response contains + # the updated `WorkweekConfig` object and might contain a set of `Error` objects if + # the request resulted in errors. + class UpdateWorkweekConfigResponse < Internal::Types::Model + field :workweek_config, Square::Types::WorkweekConfig, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_booking_custom_attribute_response.rb b/lib/square/types/upsert_booking_custom_attribute_response.rb new file mode 100644 index 000000000..e779a3a27 --- /dev/null +++ b/lib/square/types/upsert_booking_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpsertBookingCustomAttribute](api-endpoint:BookingCustomAttributes-UpsertBookingCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpsertBookingCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_catalog_object_response.rb b/lib/square/types/upsert_catalog_object_response.rb new file mode 100644 index 000000000..73cf1cdf7 --- /dev/null +++ b/lib/square/types/upsert_catalog_object_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + class UpsertCatalogObjectResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :catalog_object, Square::Types::CatalogObject, optional: true, nullable: false + field :id_mappings, Internal::Types::Array[Square::Types::CatalogIdMapping], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_customer_custom_attribute_response.rb b/lib/square/types/upsert_customer_custom_attribute_response.rb new file mode 100644 index 000000000..826176075 --- /dev/null +++ b/lib/square/types/upsert_customer_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpsertCustomerCustomAttribute](api-endpoint:CustomerCustomAttributes-UpsertCustomerCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpsertCustomerCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_location_custom_attribute_response.rb b/lib/square/types/upsert_location_custom_attribute_response.rb new file mode 100644 index 000000000..885bf07af --- /dev/null +++ b/lib/square/types/upsert_location_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpsertLocationCustomAttribute](api-endpoint:LocationCustomAttributes-UpsertLocationCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpsertLocationCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_merchant_custom_attribute_response.rb b/lib/square/types/upsert_merchant_custom_attribute_response.rb new file mode 100644 index 000000000..b82b866da --- /dev/null +++ b/lib/square/types/upsert_merchant_custom_attribute_response.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an [UpsertMerchantCustomAttribute](api-endpoint:MerchantCustomAttributes-UpsertMerchantCustomAttribute) response. + # Either `custom_attribute_definition` or `errors` is present in the response. + class UpsertMerchantCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_order_custom_attribute_response.rb b/lib/square/types/upsert_order_custom_attribute_response.rb new file mode 100644 index 000000000..b82fb6a21 --- /dev/null +++ b/lib/square/types/upsert_order_custom_attribute_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a response from upserting order custom attribute definitions. + class UpsertOrderCustomAttributeResponse < Internal::Types::Model + field :custom_attribute, Square::Types::CustomAttribute, optional: true, nullable: false + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/upsert_snippet_response.rb b/lib/square/types/upsert_snippet_response.rb new file mode 100644 index 000000000..e3d3cf982 --- /dev/null +++ b/lib/square/types/upsert_snippet_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents an `UpsertSnippet` response. The response can include either `snippet` or `errors`. + class UpsertSnippetResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :snippet, Square::Types::Snippet, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/v_1_money.rb b/lib/square/types/v_1_money.rb new file mode 100644 index 000000000..6d4ce4c48 --- /dev/null +++ b/lib/square/types/v_1_money.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class V1Money < Internal::Types::Model + field :amount, Integer, optional: true, nullable: false + field :currency_code, Square::Types::Currency, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/v_1_order.rb b/lib/square/types/v_1_order.rb new file mode 100644 index 000000000..2e425adca --- /dev/null +++ b/lib/square/types/v_1_order.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Square + module Types + # V1Order + class V1Order < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :buyer_email, String, optional: true, nullable: false + field :recipient_name, String, optional: true, nullable: false + field :recipient_phone_number, String, optional: true, nullable: false + field :state, Square::Types::V1OrderState, optional: true, nullable: false + field :shipping_address, Square::Types::Address, optional: true, nullable: false + field :subtotal_money, Square::Types::V1Money, optional: true, nullable: false + field :total_shipping_money, Square::Types::V1Money, optional: true, nullable: false + field :total_tax_money, Square::Types::V1Money, optional: true, nullable: false + field :total_price_money, Square::Types::V1Money, optional: true, nullable: false + field :total_discount_money, Square::Types::V1Money, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :expires_at, String, optional: true, nullable: false + field :payment_id, String, optional: true, nullable: false + field :buyer_note, String, optional: true, nullable: false + field :completed_note, String, optional: true, nullable: false + field :refunded_note, String, optional: true, nullable: false + field :canceled_note, String, optional: true, nullable: false + field :tender, Square::Types::V1Tender, optional: true, nullable: false + field :order_history, Internal::Types::Array[Square::Types::V1OrderHistoryEntry], optional: true, nullable: false + field :promo_code, String, optional: true, nullable: false + field :btc_receive_address, String, optional: true, nullable: false + field :btc_price_satoshi, Integer, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/v_1_order_history_entry.rb b/lib/square/types/v_1_order_history_entry.rb new file mode 100644 index 000000000..7198e8330 --- /dev/null +++ b/lib/square/types/v_1_order_history_entry.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # V1OrderHistoryEntry + class V1OrderHistoryEntry < Internal::Types::Model + field :action, Square::Types::V1OrderHistoryEntryAction, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/v_1_order_history_entry_action.rb b/lib/square/types/v_1_order_history_entry_action.rb new file mode 100644 index 000000000..16ba4546e --- /dev/null +++ b/lib/square/types/v_1_order_history_entry_action.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module V1OrderHistoryEntryAction + extend Square::Internal::Types::Enum + ORDER_PLACED = "ORDER_PLACED" + DECLINED = "DECLINED" + PAYMENT_RECEIVED = "PAYMENT_RECEIVED" + CANCELED = "CANCELED" + COMPLETED = "COMPLETED" + REFUNDED = "REFUNDED" + EXPIRED = "EXPIRED"end + end +end diff --git a/lib/square/types/v_1_order_state.rb b/lib/square/types/v_1_order_state.rb new file mode 100644 index 000000000..d79fbab92 --- /dev/null +++ b/lib/square/types/v_1_order_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Square + module Types + module V1OrderState + extend Square::Internal::Types::Enum + PENDING = "PENDING" + OPEN = "OPEN" + COMPLETED = "COMPLETED" + CANCELED = "CANCELED" + REFUNDED = "REFUNDED" + REJECTED = "REJECTED"end + end +end diff --git a/lib/square/types/v_1_tender.rb b/lib/square/types/v_1_tender.rb new file mode 100644 index 000000000..6a00e7fc2 --- /dev/null +++ b/lib/square/types/v_1_tender.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Square + module Types + # A tender represents a discrete monetary exchange. Square represents this + # exchange as a money object with a specific currency and amount, where the + # amount is given in the smallest denomination of the given currency. + # + # Square POS can accept more than one form of tender for a single payment (such + # as by splitting a bill between a credit card and a gift card). The `tender` + # field of the Payment object lists all forms of tender used for the payment. + # + # Split tender payments behave slightly differently from single tender payments: + # + # The receipt_url for a split tender corresponds only to the first tender listed + # in the tender field. To get the receipt URLs for the remaining tenders, use + # the receipt_url fields of the corresponding Tender objects. + # + # *A note on gift cards**: when a customer purchases a Square gift card from a + # merchant, the merchant receives the full amount of the gift card in the + # associated payment. + # + # When that gift card is used as a tender, the balance of the gift card is + # reduced and the merchant receives no funds. A `Tender` object with a type of + # `SQUARE_GIFT_CARD` indicates a gift card was used for some or all of the + # associated payment. + class V1Tender < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :type, Square::Types::V1TenderType, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :employee_id, String, optional: true, nullable: false + field :receipt_url, String, optional: true, nullable: false + field :card_brand, Square::Types::V1TenderCardBrand, optional: true, nullable: false + field :pan_suffix, String, optional: true, nullable: false + field :entry_method, Square::Types::V1TenderEntryMethod, optional: true, nullable: false + field :payment_note, String, optional: true, nullable: false + field :total_money, Square::Types::V1Money, optional: true, nullable: false + field :tendered_money, Square::Types::V1Money, optional: true, nullable: false + field :tendered_at, String, optional: true, nullable: false + field :settled_at, String, optional: true, nullable: false + field :change_back_money, Square::Types::V1Money, optional: true, nullable: false + field :refunded_money, Square::Types::V1Money, optional: true, nullable: false + field :is_exchange, Internal::Types::Boolean, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/v_1_tender_card_brand.rb b/lib/square/types/v_1_tender_card_brand.rb new file mode 100644 index 000000000..81c788dfb --- /dev/null +++ b/lib/square/types/v_1_tender_card_brand.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + module V1TenderCardBrand + extend Square::Internal::Types::Enum + OTHER_BRAND = "OTHER_BRAND" + VISA = "VISA" + MASTER_CARD = "MASTER_CARD" + AMERICAN_EXPRESS = "AMERICAN_EXPRESS" + DISCOVER = "DISCOVER" + DISCOVER_DINERS = "DISCOVER_DINERS" + JCB = "JCB" + CHINA_UNIONPAY = "CHINA_UNIONPAY" + SQUARE_GIFT_CARD = "SQUARE_GIFT_CARD"end + end +end diff --git a/lib/square/types/v_1_tender_entry_method.rb b/lib/square/types/v_1_tender_entry_method.rb new file mode 100644 index 000000000..44fabc513 --- /dev/null +++ b/lib/square/types/v_1_tender_entry_method.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module V1TenderEntryMethod + extend Square::Internal::Types::Enum + MANUAL = "MANUAL" + SCANNED = "SCANNED" + SQUARE_CASH = "SQUARE_CASH" + SQUARE_WALLET = "SQUARE_WALLET" + SWIPED = "SWIPED" + WEB_FORM = "WEB_FORM" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/v_1_tender_type.rb b/lib/square/types/v_1_tender_type.rb new file mode 100644 index 000000000..d42a012f2 --- /dev/null +++ b/lib/square/types/v_1_tender_type.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + module V1TenderType + extend Square::Internal::Types::Enum + CREDIT_CARD = "CREDIT_CARD" + CASH = "CASH" + THIRD_PARTY_CARD = "THIRD_PARTY_CARD" + NO_SALE = "NO_SALE" + SQUARE_WALLET = "SQUARE_WALLET" + SQUARE_GIFT_CARD = "SQUARE_GIFT_CARD" + UNKNOWN = "UNKNOWN" + OTHER = "OTHER"end + end +end diff --git a/lib/square/types/v_1_update_order_request_action.rb b/lib/square/types/v_1_update_order_request_action.rb new file mode 100644 index 000000000..8b47c5502 --- /dev/null +++ b/lib/square/types/v_1_update_order_request_action.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module V1UpdateOrderRequestAction + extend Square::Internal::Types::Enum + COMPLETE = "COMPLETE" + CANCEL = "CANCEL" + REFUND = "REFUND"end + end +end diff --git a/lib/square/types/vendor.rb b/lib/square/types/vendor.rb new file mode 100644 index 000000000..cfee541fd --- /dev/null +++ b/lib/square/types/vendor.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a supplier to a seller. + class Vendor < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :address, Square::Types::Address, optional: true, nullable: false + field :contacts, Internal::Types::Array[Square::Types::VendorContact], optional: true, nullable: false + field :account_number, String, optional: true, nullable: false + field :note, String, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :status, Square::Types::VendorStatus, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_contact.rb b/lib/square/types/vendor_contact.rb new file mode 100644 index 000000000..d9c1de67c --- /dev/null +++ b/lib/square/types/vendor_contact.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents a contact of a [Vendor](entity:Vendor). + class VendorContact < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :email_address, String, optional: true, nullable: false + field :phone_number, String, optional: true, nullable: false + field :removed, Internal::Types::Boolean, optional: true, nullable: false + field :ordinal, Integer, optional: false, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_created_event.rb b/lib/square/types/vendor_created_event.rb new file mode 100644 index 000000000..9b723932a --- /dev/null +++ b/lib/square/types/vendor_created_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Vendor](entity:Vendor) is created. + class VendorCreatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::VendorCreatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_created_event_data.rb b/lib/square/types/vendor_created_event_data.rb new file mode 100644 index 000000000..3342f17e8 --- /dev/null +++ b/lib/square/types/vendor_created_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the `vendor.created` event data structure. + class VendorCreatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::VendorCreatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_created_event_object.rb b/lib/square/types/vendor_created_event_object.rb new file mode 100644 index 000000000..382074c5e --- /dev/null +++ b/lib/square/types/vendor_created_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class VendorCreatedEventObject < Internal::Types::Model + field :operation, String, optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_status.rb b/lib/square/types/vendor_status.rb new file mode 100644 index 000000000..ab1cc9a46 --- /dev/null +++ b/lib/square/types/vendor_status.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Square + module Types + module VendorStatus + extend Square::Internal::Types::Enum + ACTIVE = "ACTIVE" + INACTIVE = "INACTIVE"end + end +end diff --git a/lib/square/types/vendor_updated_event.rb b/lib/square/types/vendor_updated_event.rb new file mode 100644 index 000000000..58351387f --- /dev/null +++ b/lib/square/types/vendor_updated_event.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Square + module Types + # Published when a [Vendor](entity:Vendor) is updated. + class VendorUpdatedEvent < Internal::Types::Model + field :merchant_id, String, optional: true, nullable: false + field :location_id, String, optional: true, nullable: false + field :type, String, optional: true, nullable: false + field :event_id, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :data, Square::Types::VendorUpdatedEventData, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_updated_event_data.rb b/lib/square/types/vendor_updated_event_data.rb new file mode 100644 index 000000000..5435038a2 --- /dev/null +++ b/lib/square/types/vendor_updated_event_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the `vendor.updated` event data structure. + class VendorUpdatedEventData < Internal::Types::Model + field :type, String, optional: true, nullable: false + field :id, String, optional: true, nullable: false + field :object, Square::Types::VendorUpdatedEventObject, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/vendor_updated_event_object.rb b/lib/square/types/vendor_updated_event_object.rb new file mode 100644 index 000000000..aa617febf --- /dev/null +++ b/lib/square/types/vendor_updated_event_object.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + class VendorUpdatedEventObject < Internal::Types::Model + field :operation, String, optional: true, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/visibility_filter.rb b/lib/square/types/visibility_filter.rb new file mode 100644 index 000000000..ff0e2ca15 --- /dev/null +++ b/lib/square/types/visibility_filter.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Square + module Types + module VisibilityFilter + extend Square::Internal::Types::Enum + ALL = "ALL" + READ = "READ" + READ_WRITE = "READ_WRITE"end + end +end diff --git a/lib/square/types/void_transaction_response.rb b/lib/square/types/void_transaction_response.rb new file mode 100644 index 000000000..10ffda6d1 --- /dev/null +++ b/lib/square/types/void_transaction_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Square + module Types + # Defines the fields that are included in the response body of + # a request to the [VoidTransaction](api-endpoint:Transactions-VoidTransaction) endpoint. + class VoidTransactionResponse < Internal::Types::Model + field :errors, Internal::Types::Array[Square::Types::Error], optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/wage_setting.rb b/lib/square/types/wage_setting.rb new file mode 100644 index 000000000..e7bf65e6d --- /dev/null +++ b/lib/square/types/wage_setting.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents information about the overtime exemption status, job assignments, and compensation + # for a [team member](entity:TeamMember). + class WageSetting < Internal::Types::Model + field :team_member_id, String, optional: true, nullable: false + field :job_assignments, Internal::Types::Array[Square::Types::JobAssignment], optional: true, nullable: false + field :is_overtime_exempt, Internal::Types::Boolean, optional: true, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/webhook_subscription.rb b/lib/square/types/webhook_subscription.rb new file mode 100644 index 000000000..78b9f8f9a --- /dev/null +++ b/lib/square/types/webhook_subscription.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Square + module Types + # Represents the details of a webhook subscription, including notification URL, + # event types, and signature key. + class WebhookSubscription < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :name, String, optional: true, nullable: false + field :enabled, Internal::Types::Boolean, optional: true, nullable: false + field :event_types, Internal::Types::Array[String], optional: true, nullable: false + field :notification_url, String, optional: true, nullable: false + field :api_version, String, optional: true, nullable: false + field :signature_key, String, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/types/weekday.rb b/lib/square/types/weekday.rb new file mode 100644 index 000000000..4a28deb6b --- /dev/null +++ b/lib/square/types/weekday.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Square + module Types + module Weekday + extend Square::Internal::Types::Enum + MON = "MON" + TUE = "TUE" + WED = "WED" + THU = "THU" + FRI = "FRI" + SAT = "SAT" + SUN = "SUN"end + end +end diff --git a/lib/square/types/workweek_config.rb b/lib/square/types/workweek_config.rb new file mode 100644 index 000000000..ffce149df --- /dev/null +++ b/lib/square/types/workweek_config.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Square + module Types + # Sets the day of the week and hour of the day that a business starts a + # workweek. This is used to calculate overtime pay. + class WorkweekConfig < Internal::Types::Model + field :id, String, optional: true, nullable: false + field :start_of_week, Square::Types::Weekday, optional: false, nullable: false + field :start_of_day_local_time, String, optional: false, nullable: false + field :version, Integer, optional: true, nullable: false + field :created_at, String, optional: true, nullable: false + field :updated_at, String, optional: true, nullable: false + + end + end +end diff --git a/lib/square/v_1_transactions/client.rb b/lib/square/v_1_transactions/client.rb new file mode 100644 index 000000000..670754c13 --- /dev/null +++ b/lib/square/v_1_transactions/client.rb @@ -0,0 +1,53 @@ + +module Square + module V1Transactions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::V1Transactions::Client] + def initialize(client) + @client = client + end + + # Provides summary information for a merchant's online store orders. + # + # @return [Array[Square::Types::V1Order]] + def v_1_list_orders(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return + else + raise _response.body + end + end + + # Provides comprehensive information for a single online store order, including the order's history. + # + # @return [Square::Types::V1Order] + def v_1_retrieve_order(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::V1Order.load(_response.body) + else + raise _response.body + end + end + + # Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: + # + # @return [Square::Types::V1Order] + def v_1_update_order(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::V1Order.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/v_1_transactions/types/v_1_list_orders_request.rb b/lib/square/v_1_transactions/types/v_1_list_orders_request.rb new file mode 100644 index 000000000..91c7278b8 --- /dev/null +++ b/lib/square/v_1_transactions/types/v_1_list_orders_request.rb @@ -0,0 +1,14 @@ + +module Square + module V1Transactions + module Types + class V1ListOrdersRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :order, Square::Types::SortOrder, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + field :batch_token, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/v_1_transactions/types/v_1_retrieve_order_request.rb b/lib/square/v_1_transactions/types/v_1_retrieve_order_request.rb new file mode 100644 index 000000000..73e467ca5 --- /dev/null +++ b/lib/square/v_1_transactions/types/v_1_retrieve_order_request.rb @@ -0,0 +1,12 @@ + +module Square + module V1Transactions + module Types + class V1RetrieveOrderRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :order_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/v_1_transactions/types/v_1_update_order_request.rb b/lib/square/v_1_transactions/types/v_1_update_order_request.rb new file mode 100644 index 000000000..d792fb5a2 --- /dev/null +++ b/lib/square/v_1_transactions/types/v_1_update_order_request.rb @@ -0,0 +1,17 @@ + +module Square + module V1Transactions + module Types + class V1UpdateOrderRequest < Internal::Types::Model + field :location_id, String, optional: false, nullable: false + field :order_id, String, optional: false, nullable: false + field :action, Square::Types::V1UpdateOrderRequestAction, optional: false, nullable: false + field :shipped_tracking_number, String, optional: true, nullable: false + field :completed_note, String, optional: true, nullable: false + field :refunded_note, String, optional: true, nullable: false + field :canceled_note, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/client.rb b/lib/square/vendors/client.rb new file mode 100644 index 000000000..147f93cda --- /dev/null +++ b/lib/square/vendors/client.rb @@ -0,0 +1,105 @@ + +module Square + module Vendors + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Vendors::Client] + def initialize(client) + @client = client + end + + # Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller. + # + # @return [Square::Types::BatchCreateVendorsResponse] + def batch_create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchCreateVendorsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs. + # + # @return [Square::Types::BatchGetVendorsResponse] + def batch_get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchGetVendorsResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller. + # + # @return [Square::Types::BatchUpdateVendorsResponse] + def batch_update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::BatchUpdateVendorsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller. + # + # @return [Square::Types::CreateVendorResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateVendorResponse.load(_response.body) + else + raise _response.body + end + end + + # Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter. + # + # @return [Square::Types::SearchVendorsResponse] + def search(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::SearchVendorsResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves the vendor of a specified [Vendor](entity:Vendor) ID. + # + # @return [Square::Types::GetVendorResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetVendorResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller. + # + # @return [Square::Types::UpdateVendorResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateVendorResponse.load(_response.body) + else + raise _response.body + end + end + + end + end +end diff --git a/lib/square/vendors/types/batch_create_vendors_request.rb b/lib/square/vendors/types/batch_create_vendors_request.rb new file mode 100644 index 000000000..8722c50b0 --- /dev/null +++ b/lib/square/vendors/types/batch_create_vendors_request.rb @@ -0,0 +1,11 @@ + +module Square + module Vendors + module Types + class BatchCreateVendorsRequest < Internal::Types::Model + field :vendors, Internal::Types::Hash[String, Square::Types::Vendor], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/batch_get_vendors_request.rb b/lib/square/vendors/types/batch_get_vendors_request.rb new file mode 100644 index 000000000..8e127c73d --- /dev/null +++ b/lib/square/vendors/types/batch_get_vendors_request.rb @@ -0,0 +1,11 @@ + +module Square + module Vendors + module Types + class BatchGetVendorsRequest < Internal::Types::Model + field :vendor_ids, Internal::Types::Array[String], optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/batch_update_vendors_request.rb b/lib/square/vendors/types/batch_update_vendors_request.rb new file mode 100644 index 000000000..efb8365cb --- /dev/null +++ b/lib/square/vendors/types/batch_update_vendors_request.rb @@ -0,0 +1,11 @@ + +module Square + module Vendors + module Types + class BatchUpdateVendorsRequest < Internal::Types::Model + field :vendors, Internal::Types::Hash[String, Square::Types::UpdateVendorRequest], optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/create_vendor_request.rb b/lib/square/vendors/types/create_vendor_request.rb new file mode 100644 index 000000000..3ad64a751 --- /dev/null +++ b/lib/square/vendors/types/create_vendor_request.rb @@ -0,0 +1,12 @@ + +module Square + module Vendors + module Types + class CreateVendorRequest < Internal::Types::Model + field :idempotency_key, String, optional: false, nullable: false + field :vendor, Square::Types::Vendor, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/get_vendors_request.rb b/lib/square/vendors/types/get_vendors_request.rb new file mode 100644 index 000000000..5595187e3 --- /dev/null +++ b/lib/square/vendors/types/get_vendors_request.rb @@ -0,0 +1,11 @@ + +module Square + module Vendors + module Types + class GetVendorsRequest < Internal::Types::Model + field :vendor_id, String, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/search_vendors_request.rb b/lib/square/vendors/types/search_vendors_request.rb new file mode 100644 index 000000000..c95323f07 --- /dev/null +++ b/lib/square/vendors/types/search_vendors_request.rb @@ -0,0 +1,13 @@ + +module Square + module Vendors + module Types + class SearchVendorsRequest < Internal::Types::Model + field :filter, Square::Types::SearchVendorsRequestFilter, optional: true, nullable: false + field :sort, Square::Types::SearchVendorsRequestSort, optional: true, nullable: false + field :cursor, String, optional: true, nullable: false + + end + end + end +end diff --git a/lib/square/vendors/types/update_vendors_request.rb b/lib/square/vendors/types/update_vendors_request.rb new file mode 100644 index 000000000..4ba280d40 --- /dev/null +++ b/lib/square/vendors/types/update_vendors_request.rb @@ -0,0 +1,12 @@ + +module Square + module Vendors + module Types + class UpdateVendorsRequest < Internal::Types::Model + field :vendor_id, String, optional: false, nullable: false + field :body, Square::Types::UpdateVendorRequest, optional: false, nullable: false + + end + end + end +end diff --git a/lib/square/webhooks/client.rb b/lib/square/webhooks/client.rb new file mode 100644 index 000000000..c6b745975 --- /dev/null +++ b/lib/square/webhooks/client.rb @@ -0,0 +1,14 @@ + +module Square + module Webhooks + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Webhooks::Client] + def initialize(client) + @client = client + end + + end + end +end diff --git a/lib/square/webhooks/event_types/client.rb b/lib/square/webhooks/event_types/client.rb new file mode 100644 index 000000000..6a286022d --- /dev/null +++ b/lib/square/webhooks/event_types/client.rb @@ -0,0 +1,29 @@ + +module Square + module Webhooks + module EventTypes + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Webhooks::EventTypes::Client] + def initialize(client) + @client = client + end + + # Lists all webhook event types that can be subscribed to. + # + # @return [Square::Types::ListWebhookEventTypesResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListWebhookEventTypesResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/webhooks/event_types/types/list_event_types_request.rb b/lib/square/webhooks/event_types/types/list_event_types_request.rb new file mode 100644 index 000000000..f7df93c3e --- /dev/null +++ b/lib/square/webhooks/event_types/types/list_event_types_request.rb @@ -0,0 +1,13 @@ + +module Square + module Webhooks + module EventTypes + module Types + class ListEventTypesRequest < Internal::Types::Model + field :api_version, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/client.rb b/lib/square/webhooks/subscriptions/client.rb new file mode 100644 index 000000000..986e550a6 --- /dev/null +++ b/lib/square/webhooks/subscriptions/client.rb @@ -0,0 +1,107 @@ + +module Square + module Webhooks + module Subscriptions + class Client + # @option client [Square::Internal::Http::RawClient] + # + # @return [Square::Webhooks::Subscriptions::Client] + def initialize(client) + @client = client + end + + # Lists all webhook subscriptions owned by your application. + # + # @return [Square::Types::ListWebhookSubscriptionsResponse] + def list(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::ListWebhookSubscriptionsResponse.load(_response.body) + else + raise _response.body + end + end + + # Creates a webhook subscription. + # + # @return [Square::Types::CreateWebhookSubscriptionResponse] + def create(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::CreateWebhookSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Retrieves a webhook subscription identified by its ID. + # + # @return [Square::Types::GetWebhookSubscriptionResponse] + def get(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::GetWebhookSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a webhook subscription. + # + # @return [Square::Types::UpdateWebhookSubscriptionResponse] + def update(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateWebhookSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Deletes a webhook subscription. + # + # @return [Square::Types::DeleteWebhookSubscriptionResponse] + def delete(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::DeleteWebhookSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + # Updates a webhook subscription by replacing the existing signature key with a new one. + # + # @return [Square::Types::UpdateWebhookSubscriptionSignatureKeyResponse] + def update_signature_key(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::UpdateWebhookSubscriptionSignatureKeyResponse.load(_response.body) + else + raise _response.body + end + end + + # Tests a webhook subscription by sending a test event to the notification URL. + # + # @return [Square::Types::TestWebhookSubscriptionResponse] + def test(request_options: {}, **params) + _request = params + _response = @client.send(_request) + if _response.code >= "200" && _response.code < "300" + return Square::Types::TestWebhookSubscriptionResponse.load(_response.body) + else + raise _response.body + end + end + + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/create_webhook_subscription_request.rb b/lib/square/webhooks/subscriptions/types/create_webhook_subscription_request.rb new file mode 100644 index 000000000..8c254f7d9 --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/create_webhook_subscription_request.rb @@ -0,0 +1,14 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class CreateWebhookSubscriptionRequest < Internal::Types::Model + field :idempotency_key, String, optional: true, nullable: false + field :subscription, Square::Types::WebhookSubscription, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/delete_subscriptions_request.rb b/lib/square/webhooks/subscriptions/types/delete_subscriptions_request.rb new file mode 100644 index 000000000..206d152df --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/delete_subscriptions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class DeleteSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/get_subscriptions_request.rb b/lib/square/webhooks/subscriptions/types/get_subscriptions_request.rb new file mode 100644 index 000000000..5e345d9b2 --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/get_subscriptions_request.rb @@ -0,0 +1,13 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class GetSubscriptionsRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/list_subscriptions_request.rb b/lib/square/webhooks/subscriptions/types/list_subscriptions_request.rb new file mode 100644 index 000000000..8bf50e99a --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/list_subscriptions_request.rb @@ -0,0 +1,16 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class ListSubscriptionsRequest < Internal::Types::Model + field :cursor, String, optional: true, nullable: false + field :include_disabled, Internal::Types::Boolean, optional: true, nullable: false + field :sort_order, Square::Types::SortOrder, optional: true, nullable: false + field :limit, Integer, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/test_webhook_subscription_request.rb b/lib/square/webhooks/subscriptions/types/test_webhook_subscription_request.rb new file mode 100644 index 000000000..ceacce525 --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/test_webhook_subscription_request.rb @@ -0,0 +1,14 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class TestWebhookSubscriptionRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :event_type, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/update_webhook_subscription_request.rb b/lib/square/webhooks/subscriptions/types/update_webhook_subscription_request.rb new file mode 100644 index 000000000..197364084 --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/update_webhook_subscription_request.rb @@ -0,0 +1,14 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class UpdateWebhookSubscriptionRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :subscription, Square::Types::WebhookSubscription, optional: true, nullable: false + + end + end + end + end +end diff --git a/lib/square/webhooks/subscriptions/types/update_webhook_subscription_signature_key_request.rb b/lib/square/webhooks/subscriptions/types/update_webhook_subscription_signature_key_request.rb new file mode 100644 index 000000000..8fd2948fa --- /dev/null +++ b/lib/square/webhooks/subscriptions/types/update_webhook_subscription_signature_key_request.rb @@ -0,0 +1,14 @@ + +module Square + module Webhooks + module Subscriptions + module Types + class UpdateWebhookSubscriptionSignatureKeyRequest < Internal::Types::Model + field :subscription_id, String, optional: false, nullable: false + field :idempotency_key, String, optional: true, nullable: false + + end + end + end + end +end diff --git a/test/integration/helpers.rb b/test/integration/helpers.rb new file mode 100644 index 000000000..0696d5276 --- /dev/null +++ b/test/integration/helpers.rb @@ -0,0 +1,115 @@ +require 'securerandom' +require_relative '../../lib/square' +require_relative '../../lib/square_legacy' + +module Helpers + def create_client + token = ENV['TEST_SQUARE_TOKEN'] || ENV['SQUARE_SANDBOX_TOKEN'] + raise 'TEST_SQUARE_TOKEN or SQUARE_SANDBOX_TOKEN is not set' unless token + + Square::Client.new( + token: token, + base_url: Square::Environment::SANDBOX, + ) + end + + def create_legacy_client + token = ENV['TEST_SQUARE_TOKEN'] || ENV['SQUARE_SANDBOX_TOKEN'] + raise 'TEST_SQUARE_TOKEN or SQUARE_SANDBOX_TOKEN is not set' unless token + + SquareLegacy::Client.new( + access_token: token, + environment: 'sandbox' + ) + end + + def new_test_uuid + SecureRandom.uuid + end + + def new_test_square_temp_id + "##{SecureRandom.uuid}" + end + + def new_test_money(amount) + Square::Types::Money.new( + amount: amount, + currency: 'USD' + ) + end + + def get_test_file + file_path = File.join(__dir__, 'testdata', 'image.jpeg') + File.open(file_path, 'rb') + end + + def get_default_location_id(client) + response = client.locations.list + response.locations.first.id + end + + def create_location(client) + response = client.locations.create( + location: { + name: "Test Location #{new_test_uuid}" + } + ) + response.location.id + end + + def create_test_catalog_item(opts = {}) + variation = Square::Types::CatalogObject.new( + type: 'ITEM_VARIATION', + id: "##{new_test_uuid}", + present_at_all_locations: true, + item_variation_data: { + name: opts[:variation_name] || "Variation #{new_test_uuid}", + track_inventory: true, + pricing_type: 'FIXED_PRICING', + price_money: { + amount: opts[:price] || 1000, + currency: opts[:currency] || 'USD' + } + } + ) + + Square::Types::CatalogObject.new( + type: 'ITEM', + id: "##{new_test_uuid}", + present_at_all_locations: true, + item_data: { + name: opts[:name] || "Item #{new_test_uuid}", + description: opts[:description] || 'Test item description', + abbreviation: opts[:abbreviation] || 'TST', + variations: [variation] + } + ) + end + + def test_address + Square::Types::Address.new( + address_line_1: '500 Electric Ave', + address_line_2: 'Suite 600', + locality: 'New York', + administrative_district_level_1: 'NY', + postal_code: '10003', + country: 'US' + ) + end + + def create_test_customer_request + Square::Types::CustomerRequest.new( + idempotency_key: new_test_uuid, + given_name: 'Amelia', + family_name: 'Earhart', + phone_number: '1-212-555-4240', + note: 'test customer', + address: test_address + ) + end + + def create_test_customer(client) + response = client.customers.create(create_test_customer_request) + response.customer.id + end +end diff --git a/test/integration/integration_test_base.rb b/test/integration/integration_test_base.rb new file mode 100644 index 000000000..54599d7ab --- /dev/null +++ b/test/integration/integration_test_base.rb @@ -0,0 +1,16 @@ +require 'json' +require 'minitest/autorun' +require 'minitest/hell' +require 'minitest/pride' +require 'minitest/proveit' +require_relative 'helpers' + +class IntegrationTestBase < Minitest::Test + parallelize_me! + include Square + + # Initializes the base test controller + def setup_class + @client = create_client + end +end diff --git a/test/integration/test_cash_drawers.rb b/test/integration/test_cash_drawers.rb new file mode 100644 index 000000000..ecb1076a0 --- /dev/null +++ b/test/integration/test_cash_drawers.rb @@ -0,0 +1,22 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + + +class CashDrawersTest < IntegrationTestBase + def setup + setup_class + end + + def test_list_cash_drawer_shifts + start_time = Time.now - 3600 # 1 hour ago + end_time = Time.now + + response = @client.cash_drawers.shifts.list( + location_id: get_default_location_id(@client), + begin_time: start_time.iso8601, + end_time: end_time.iso8601 + ) + + refute_nil(response) + end +end diff --git a/test/integration/test_catalog_serial.rb b/test/integration/test_catalog_serial.rb new file mode 100644 index 000000000..84289ba6f --- /dev/null +++ b/test/integration/test_catalog_serial.rb @@ -0,0 +1,368 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class CatalogSerialTest < IntegrationTestBase + MAX_CATALOG_PAGE_SIZE = 100 + MAX_RETRIES_CATALOG = 5 + MAX_TIMEOUT = 120 + + def setup + setup_class + @catalog_modifier_list_id = nil + @catalog_modifier_id = nil + @catalog_tax_id = nil + end + + def sleep(seconds) + sleep(seconds) + end + + def delete_all_catalog_objects(client) + catalog_objects_resp = client.catalog.list + object_ids = [] + + catalog_objects_resp.data.each do |catalog_object| + next unless catalog_object.id + + object_ids << catalog_object.id + + next unless catalog_object.respond_to?(:item_data) + + variation = catalog_object.item_data&.variations&.first + next unless variation&.id + + object_ids << variation.id + end + + client.catalog.batch_delete(object_ids: object_ids) + end + + def test_bulk_create_and_iterate_through_paginated_catalog_objects + delete_all_catalog_objects(@client) + sleep(2) # Wait after deletion + + # Setup: Create 200 catalog objects with 1 CatalogItemVariation each + catalog_objects = Array.new(200) { create_test_catalog_item } + + # Create the catalog objects in a bulk request + create_catalog_objects_resp = @client.catalog.batch_upsert( + idempotency_key: new_test_uuid, + batches: [ + { + objects: catalog_objects + } + ] + ) + + assert_equal 200, create_catalog_objects_resp.objects.length + sleep(2) # Wait after bulk creation + + # List all catalog objects + number_of_pages = 0 + catalog_objects_resp = @client.catalog.list + number_of_pages += 1 + assert_equal MAX_CATALOG_PAGE_SIZE, catalog_objects_resp.data.length + + while catalog_objects_resp.has_next_page? + sleep(1) # Wait between page requests + catalog_objects_resp = catalog_objects_resp.get_next_page + number_of_pages += 1 + end + + assert number_of_pages > 1 + sleep(2) # Wait before cleanup + + delete_catalog_objects_resp = delete_all_catalog_objects(@client) + assert_equal 200, delete_catalog_objects_resp.deleted_object_ids.length + end + + def test_upload_catalog_image + # Add retry logic for the image upload + max_retries = 5 + last_error = nil + + max_retries.times do |attempt| + begin + # If this isn't the first attempt, wait before retrying + if attempt > 0 + puts "Attempt #{attempt + 1} for image upload..." + # Increase wait time between retries exponentially + sleep(2 ** attempt * 5) + end + + puts "Starting image upload attempt #{attempt + 1}" + + # Setup: Load a test image file + image_file = get_test_file + puts 'Test file loaded' + + # Setup: Create a catalog object to associate the image with + catalog_object = create_test_catalog_item + + # Add delay before catalog creation + sleep(3) + puts 'Creating catalog object...' + + create_catalog_resp = @client.catalog.batch_upsert( + idempotency_key: new_test_uuid, + batches: [ + { + objects: [catalog_object] + } + ] + ) + + puts 'Catalog object created' + assert_equal 1, create_catalog_resp.objects.length + created_catalog_object = create_catalog_resp.objects.first + assert created_catalog_object + + # Add delay before image upload + sleep(5) + puts 'Uploading image...' + + # Create a new catalog image + image_name = "Test Image #{new_test_uuid}" + create_catalog_image_resp = @client.catalog.images.create( + image_file: image_file, + request: { + idempotency_key: new_test_uuid, + object_id: created_catalog_object.id, + image: { + type: "IMAGE", + id: new_test_square_temp_id, + image_data: { + name: image_name + } + } + } + ) + + puts 'Image uploaded successfully' + assert create_catalog_image_resp.image + + # Add delay before cleanup + sleep(3) + puts 'Starting cleanup...' + + # Cleanup: Delete the created catalog object and image + @client.catalog.batch_delete( + object_ids: [created_catalog_object.id, create_catalog_image_resp.image.id] + ) + + puts 'Cleanup completed' + # If we get here, the test succeeded, so break out of retry loop + return + + rescue => error + last_error = error + puts "Attempt #{attempt + 1} failed with error: #{error}" + # If this was the last attempt, the error will be thrown below + end + end + + # If we get here, all retries failed + puts 'All image upload attempts failed' + raise last_error + end + + def test_upsert_catalog_object + coffee = create_test_catalog_item( + name: "Coffee", + description: "Strong coffee", + abbreviation: "C", + price: 100, + variation_name: "Colombian Fair Trade" + ) + + sleep(2) # Wait before upsert + + response = @client.catalog.object.upsert( + object: coffee, + idempotency_key: new_test_uuid + ) + + catalog_object = response.catalog_object + + assert response + assert catalog_object + assert_equal "ITEM", catalog_object.type + assert_equal 1, catalog_object.item_data.variations.length + + variation = catalog_object.item_data.variations.first + assert_equal "Colombian Fair Trade", variation.item_variation_data.name + end + + def test_catalog_info + sleep(2) # Wait before info request + response = @client.catalog.info + assert response + end + + def test_list_catalog + sleep(2) # Wait before list request + response = @client.catalog.list + assert response + end + + def test_search_catalog_objects + sleep(2) # Wait before search + response = @client.catalog.search(limit: 1) + assert response + end + + def test_search_catalog_items + sleep(2) # Wait before search items + response = @client.catalog.search_items(limit: 1) + assert response + end + + def test_batch_upsert_catalog_objects + sleep(2) # Wait before batch upsert + + modifier = Square::Types::CatalogObjectModifier.new( + type: "MODIFIER", + id: "#temp-modifier-id", + modifier_data: Square::Types::CatalogModifier.new( + name: "Limited Time Only Price", + price_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ) + ) + ) + + modifier_list = Square::Types::CatalogObjectModifierList.new( + type: "MODIFIER_LIST", + id: "#temp-modifier-list-id", + modifier_list_data: Square::Types::CatalogModifierList.new( + name: "Special weekend deals", + modifiers: [modifier] + ) + ) + + tax = Square::Types::CatalogObjectTax.new( + type: "TAX", + id: "#temp-tax-id", + tax_data: Square::Types::CatalogTax.new( + name: "Online only Tax", + calculation_phase: "TAX_SUBTOTAL_PHASE", + inclusion_type: "ADDITIVE", + percentage: "5.0", + applies_to_custom_amounts: true, + enabled: true + ) + ) + + response = @client.catalog.batch_upsert( + idempotency_key: new_test_uuid, + batches: [ + { + objects: [tax, modifier_list] + } + ] + ) + + assert response + assert_equal 2, response.objects.length + + # Store IDs for later use + response.id_mappings&.each do |mapping| + case mapping.client_object_id + when "#temp-tax-id" + @catalog_tax_id = mapping.object_id + when "#temp-modifier-id" + @catalog_modifier_id = mapping.object_id + when "#temp-modifier-list-id" + @catalog_modifier_list_id = mapping.object_id + end + end + end + + def test_retrieve_catalog_object + sleep(2) # Wait before test start + + # First create a catalog object + coffee = create_test_catalog_item + create_resp = @client.catalog.object.upsert( + object: coffee, + idempotency_key: new_test_uuid + ) + + sleep(2) # Wait before retrieve + + # Then retrieve it + response = @client.catalog.object.get(object_id: create_resp.catalog_object.id) + assert response.object + assert_equal create_resp.catalog_object.id, response.object.id + + sleep(2) # Wait before cleanup + + # Cleanup + @client.catalog.object.delete(object_id: create_resp.catalog_object.id) + end + + def test_batch_retrieve_catalog_objects + sleep(2) # Wait before batch retrieve + + # Use the IDs created in the batch upsert test + response = @client.catalog.batch_get( + object_ids: [@catalog_modifier_id, @catalog_modifier_list_id, @catalog_tax_id] + ) + + assert response.objects + assert_equal 3, response.objects.length + assert_equal [@catalog_modifier_id, @catalog_modifier_list_id, @catalog_tax_id].sort, + response.objects.map(&:id).sort + end + + def test_update_item_taxes + sleep(2) # Wait before test start + + # First create a test item + item = create_test_catalog_item + create_resp = @client.catalog.object.upsert( + object: item, + idempotency_key: new_test_uuid + ) + + sleep(2) # Wait before update + + response = @client.catalog.update_item_taxes( + item_ids: [create_resp.catalog_object.id], + taxes_to_enable: [@catalog_tax_id] + ) + + assert response.updated_at + + sleep(2) # Wait before cleanup + + # Cleanup + @client.catalog.object.delete(object_id: create_resp.catalog_object.id) + end + + def test_update_item_modifier_lists + sleep(2) # Wait before test start + + # First create a test item + item = create_test_catalog_item + create_resp = @client.catalog.object.upsert( + object: item, + idempotency_key: new_test_uuid + ) + + sleep(2) # Wait before update + + response = @client.catalog.update_item_modifier_lists( + item_ids: [create_resp.catalog_object.id], + modifier_lists_to_enable: [@catalog_modifier_list_id] + ) + + assert response.updated_at + + sleep(2) # Wait before cleanup + + # Cleanup + @client.catalog.object.delete(object_id: create_resp.catalog_object.id) + end +end \ No newline at end of file diff --git a/test/integration/test_client_utils.rb b/test/integration/test_client_utils.rb new file mode 100644 index 000000000..2a3710427 --- /dev/null +++ b/test/integration/test_client_utils.rb @@ -0,0 +1,30 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class ClientUtilsTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_generate_a_new_uuid + uuid = new_test_uuid + assert_match /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, uuid + end + + def test_should_generate_a_new_square_temporary_id + temp_id = new_test_square_temp_id + assert_match /^#[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, temp_id + end + + def test_should_create_a_new_money_object + amount = 1000 + money = new_test_money(amount) + expected_money = Square::Types::Money.new(amount: amount, currency: "USD") + assert_equal expected_money, money + end + + def test_should_get_the_default_location_id + location_id = get_default_location_id(@client) + refute_nil location_id + end +end diff --git a/test/integration/test_customer_groups.rb b/test/integration/test_customer_groups.rb new file mode 100644 index 000000000..14c14be88 --- /dev/null +++ b/test/integration/test_customer_groups.rb @@ -0,0 +1,89 @@ +import { Square, SquareClient, SquareError } from "../../src"; +import { createClient, newTestUuid } from "./helpers"; + +async function createTestCustomerGroup(client: SquareClient): Promise { + return await client.customers.groups.create({ + idempotencyKey: newTestUuid(), + group: { + name: `Default-${newTestUuid()}`, + }, + }); +} + +function deleteTestCustomerGroup(client: SquareClient, groupId: string): Promise { + return client.customers.groups.delete({ groupId }); +} + +describe("CustomerGroups API", () => { + const client = createClient(); + + it("should create and list a customer group", async () => { + // create + const response = await createTestCustomerGroup(client); + + expect(response.group).toBeDefined(); + expect(response.group?.name).toBeDefined(); + + // list + const listResponse = await client.customers.groups.list(); + + expect(listResponse.data).toBeDefined(); + expect(listResponse.data.length).toBeGreaterThan(0); + + // Cleanup + await deleteTestCustomerGroup(client, response.group?.id!); + }); + + it("should retrieve a customer group", async () => { + const createResponse = await createTestCustomerGroup(client); + + const getResponse = await client.customers.groups.get({ groupId: createResponse.group?.id! }); + + expect(getResponse.group).toEqual(expect.objectContaining(createResponse.group)); + + // Cleanup + await deleteTestCustomerGroup(client, createResponse.group?.id!); + }); + + it("should update a customer group", async () => { + const createResponse = await createTestCustomerGroup(client); + + const newName = `Updated-${newTestUuid()}`; + const updateResponse = await client.customers.groups.update({ + groupId: createResponse.group?.id!, + group: { name: newName }, + }); + + expect(updateResponse.group).toEqual(expect.objectContaining({ name: newName })); + + // Cleanup + await deleteTestCustomerGroup(client, createResponse.group?.id!); + }); + + it("should delete a customer group", async () => { + const createResponse = await createTestCustomerGroup(client); + + const deleteResponse = await deleteTestCustomerGroup(client, createResponse.group?.id!); + + expect(deleteResponse).toBeDefined(); + expect(deleteResponse.errors).toBeUndefined(); + }); + + it("should handle error when retrieving non-existent group", async () => { + const nonExistentId = "non-existent-id"; + + expect(async () => await client.customers.groups.get({ groupId: nonExistentId })).rejects.toThrow(SquareError); + }); + + it("should handle error when creating group with invalid data", async () => { + expect( + async () => + await client.customers.groups.create({ + idempotencyKey: newTestUuid(), + group: { + name: "", // Empty name should be invalid + }, + }), + ).rejects.toThrow(SquareError); + }); +}); diff --git a/test/integration/test_customer_segments.rb b/test/integration/test_customer_segments.rb new file mode 100644 index 000000000..8798cca8e --- /dev/null +++ b/test/integration/test_customer_segments.rb @@ -0,0 +1,25 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class CustomerSegmentsTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_list_customer_segments + response = @client.customers.segments.list + + refute_nil response.data + assert response.data.length > 0 + end + + def test_should_retrieve_a_customer_segment + list_response = @client.customers.segments.list + segment_id = list_response.data.first.id + + response = @client.customers.segments.get(segment_id: segment_id) + + refute_nil response.segment + refute_nil response.segment.name + end +end diff --git a/test/integration/test_devices.rb b/test/integration/test_devices.rb new file mode 100644 index 000000000..64eadddfc --- /dev/null +++ b/test/integration/test_devices.rb @@ -0,0 +1,42 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class DevicesTest < IntegrationTestBase + def setup + setup_class + create_response = @client.devices.codes.create( + idempotency_key: new_test_uuid, + device_code: Square::Types::DeviceCode.new( + product_type: "TERMINAL_API" + ) + ) + @device_code_id = create_response.device_code.id + end + + def test_should_list_device_codes + response = @client.devices.codes.list + refute_nil response + refute_nil response.data + assert response.data.length > 0 + end + + def test_should_create_device_code + response = @client.devices.codes.create( + idempotency_key: new_test_uuid, + device_code: Square::Types::DeviceCode.new( + product_type: "TERMINAL_API" + ) + ) + + refute_nil response.device_code + assert_equal "TERMINAL_API", response.device_code.product_type + end + + def test_should_get_device_code + response = @client.devices.codes.get(id: @device_code_id) + + refute_nil response.device_code + assert_equal @device_code_id, response.device_code.id + assert_equal "TERMINAL_API", response.device_code.product_type + end +end diff --git a/test/integration/test_legacy.rb b/test/integration/test_legacy.rb new file mode 100644 index 000000000..ac219dcec --- /dev/null +++ b/test/integration/test_legacy.rb @@ -0,0 +1,15 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class LegacyTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_list_locations + response = @legacy_client.locations_api.list_locations + + refute_nil response.result.locations + assert response.result.locations.length > 0 + end +end diff --git a/test/integration/test_locations.rb b/test/integration/test_locations.rb new file mode 100644 index 000000000..2605d3198 --- /dev/null +++ b/test/integration/test_locations.rb @@ -0,0 +1,15 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class LocationsTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_list_locations + response = @client.locations.list + + refute_nil response.locations + assert response.locations.length > 0 + end +end diff --git a/test/integration/test_merchants.rb b/test/integration/test_merchants.rb new file mode 100644 index 000000000..41d5c16c6 --- /dev/null +++ b/test/integration/test_merchants.rb @@ -0,0 +1,25 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class MerchantsTest < IntegrationTestBase + def setup + setup_class + # Get first merchant ID + merchant_response = @client.merchants.list + @merchant_id = merchant_response.data.first.id + end + + def test_should_list_merchants + response = @client.merchants.list + + refute_nil response.data + assert response.data.length > 0 + end + + def test_should_retrieve_merchant + response = @client.merchants.get(merchant_id: @merchant_id) + + refute_nil response.merchant + assert_equal @merchant_id, response.merchant.id + end +end diff --git a/test/integration/test_mobile_authorization.rb b/test/integration/test_mobile_authorization.rb new file mode 100644 index 000000000..7b20bd152 --- /dev/null +++ b/test/integration/test_mobile_authorization.rb @@ -0,0 +1,17 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class MobileAuthorizationTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_create_mobile_authorization_code + response = @client.mobile.authorization_code( + location_id: get_default_location_id(@client) + ) + + refute_nil response.authorization_code + refute_nil response.expires_at + end +end diff --git a/test/integration/test_orders.rb b/test/integration/test_orders.rb new file mode 100644 index 000000000..eebafb56a --- /dev/null +++ b/test/integration/test_orders.rb @@ -0,0 +1,130 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class OrdersTest < IntegrationTestBase + def setup + setup_class + @location_id = get_default_location_id(@client) + + # Create initial order for testing + order_response = @client.orders.create( + idempotency_key: new_test_uuid, + order: Square::Types::Order.new( + location_id: @location_id, + line_items: [ + Square::Types::OrderLineItem.new( + name: "New Item", + quantity: "1", + base_price_money: Square::Types::Money.new( + amount: 100, + currency: "USD" + ) + ) + ] + ) + ) + + @order_id = order_response.order.id + @line_item_uid = order_response.order.line_items.first.uid + end + + def test_should_create_order + response = @client.orders.create( + idempotency_key: new_test_uuid, + order: Square::Types::Order.new( + location_id: @location_id, + line_items: [ + Square::Types::OrderLineItem.new( + name: "New Item", + quantity: "1", + base_price_money: Square::Types::Money.new( + amount: 100, + currency: "USD" + ) + ) + ] + ) + ) + + refute_nil response.order + assert_equal @location_id, response.order.location_id + assert_equal "New Item", response.order.line_items.first.name + end + + def test_should_batch_retrieve_orders + response = @client.orders.batch_get(order_ids: [@order_id]) + + refute_nil response.orders + assert_equal @order_id, response.orders.first.id + end + + def test_should_search_orders + response = @client.orders.search( + limit: 1, + location_ids: [@location_id] + ) + + refute_nil response.orders + assert response.orders.length > 0 + end + + def test_should_update_order + response = @client.orders.update( + order_id: @order_id, + idempotency_key: new_test_uuid, + order: Square::Types::Order.new( + version: 1, + location_id: @location_id, + line_items: [ + Square::Types::OrderLineItem.new( + name: "Updated Item", + quantity: "1", + base_price_money: Square::Types::Money.new( + amount: 0, + currency: "USD" + ), + note: nil + ) + ] + ), + fields_to_clear: ["line_items[#{@line_item_uid}]"] + ) + + refute_nil response.order + assert_equal @order_id, response.order.id + assert_equal "Updated Item", response.order.line_items.first.name + end + + def test_should_pay_order + response = @client.orders.pay( + order_id: @order_id, + idempotency_key: new_test_uuid, + order_version: 2, + payment_ids: [] + ) + + refute_nil response.order + assert_equal @order_id, response.order.id + end + + def test_should_calculate_order + response = @client.orders.calculate( + order: Square::Types::Order.new( + location_id: @location_id, + line_items: [ + Square::Types::OrderLineItem.new( + name: "New Item", + quantity: "1", + base_price_money: Square::Types::Money.new( + amount: 100, + currency: "USD" + ) + ) + ] + ) + ) + + refute_nil response.order + refute_nil response.order.total_money + end +end diff --git a/test/integration/test_payments.rb b/test/integration/test_payments.rb new file mode 100644 index 000000000..a3bdd3356 --- /dev/null +++ b/test/integration/test_payments.rb @@ -0,0 +1,114 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class PaymentsTest < IntegrationTestBase + def setup + setup_class + @location_id = get_default_location_id(@client) + + # Create initial payment for testing + payment_response = @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: new_test_uuid, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: false + ) + @payment_id = payment_response.payment.id + end + + def test_should_list_payments + response = @client.payments.list + + refute_nil response.data + assert response.data.length > 0 + end + + def test_should_create_payment + response = @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: new_test_uuid, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: true + ) + + refute_nil response.payment + assert_equal 10, response.payment.app_fee_money.amount + assert_equal "USD", response.payment.app_fee_money.currency + assert_equal 200, response.payment.amount_money.amount + assert_equal "USD", response.payment.amount_money.currency + end + + def test_should_get_payment + response = @client.payments.get(payment_id: @payment_id) + + refute_nil response.payment + assert_equal @payment_id, response.payment.id + end + + def test_should_cancel_payment + response = @client.payments.cancel(payment_id: @payment_id) + + refute_nil response.payment + assert_equal @payment_id, response.payment.id + end + + def test_should_cancel_payment_by_idempotency_key + idempotency_key = new_test_uuid + + # Create payment to cancel + @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: idempotency_key, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: false + ) + + # Cancel by idempotency key + response = @client.payments.cancel_by_idempotency_key(idempotency_key: idempotency_key) + + refute_nil response + end + + def test_should_complete_payment + # Create payment to complete + create_response = @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: new_test_uuid, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: false + ) + + response = @client.payments.complete(payment_id: create_response.payment.id) + + refute_nil response.payment + assert_equal "COMPLETED", response.payment.status + end +end diff --git a/test/integration/test_refunds.rb b/test/integration/test_refunds.rb new file mode 100644 index 000000000..155518b57 --- /dev/null +++ b/test/integration/test_refunds.rb @@ -0,0 +1,84 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class RefundsTest < IntegrationTestBase + def setup + setup_class + # Create payment for testing refunds + payment_response = @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: new_test_uuid, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: true + ) + @payment_id = payment_response.payment.id + + # Create initial refund for testing + refund_response = @client.refunds.refund_payment( + idempotency_key: new_test_uuid, + payment_id: @payment_id, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ) + ) + @refund_id = refund_response.refund.id + end + + def test_should_list_payment_refunds + response = @client.refunds.list + + refute_nil response.data + assert response.data.length > 0 + end + + def test_should_refund_payment + # Create new payment to refund + payment_response = @client.payments.create( + source_id: "cnon:card-nonce-ok", + idempotency_key: new_test_uuid, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ), + app_fee_money: Square::Types::Money.new( + amount: 10, + currency: "USD" + ), + autocomplete: true + ) + + response = @client.refunds.refund_payment( + idempotency_key: new_test_uuid, + payment_id: payment_response.payment.id, + amount_money: Square::Types::Money.new( + amount: 200, + currency: "USD" + ) + ) + + refute_nil response.refund + assert_equal payment_response.payment.id, response.refund.payment_id + end + + def test_should_get_payment_refund + response = @client.refunds.get(refund_id: @refund_id) + + refute_nil response.refund + assert_equal @refund_id, response.refund.id + assert_equal @payment_id, response.refund.payment_id + end + + def test_should_handle_invalid_refund_id + assert_raises(Square::SquareError) do + @client.refunds.get(refund_id: "invalid-id") + end + end +end diff --git a/test/integration/test_teams.rb b/test/integration/test_teams.rb new file mode 100644 index 000000000..a6cd895fe --- /dev/null +++ b/test/integration/test_teams.rb @@ -0,0 +1,84 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class TeamsTest < IntegrationTestBase + def setup + setup_class + end + + def test_should_bulk_update_team_members_with_mix_of_successes_and_failures + # Get default location ID + locations_response = @client.locations.list + location_id = locations_response.locations.first.id + refute_nil location_id + + # SETUP: Create 3 team members (should always be successful) + create_members_resp = @client.team_members.batch_create( + team_members: { + new_test_uuid => { + team_member: create_test_team_member([location_id]) + }, + new_test_uuid => { + team_member: create_test_team_member([location_id]) + }, + new_test_uuid => { + team_member: create_test_team_member([location_id]) + } + } + ) + + refute_nil create_members_resp.team_members + + created_member_ids = [] + create_members_resp.team_members.values.each do |response| + member_id = response.team_member.id + refute_nil member_id + assert_nil response.errors + created_member_ids << member_id + end + + # Update 3 team members in a bulk request, with 2 successful updates and 1 + # invalid update (location ID is invalid). This should result in a 200 + # response, with 2 nested success responses and 1 nested error response. + update_team_members_resp = @client.team_members.batch_update( + team_members: { + created_member_ids[0] => { + team_member: create_test_team_member([location_id]) + }, + created_member_ids[1] => { + team_member: create_test_team_member([location_id]) + }, + created_member_ids[2] => { + team_member: create_test_team_member(["INVALID_LocationID"]) + } + } + ) + + team_members = update_team_members_resp.team_members + assert_equal 3, team_members.keys.length + + member1_errors = team_members[created_member_ids[0]].errors + member2_errors = team_members[created_member_ids[1]].errors + member3_errors = team_members[created_member_ids[2]].errors + + assert_nil member1_errors + assert_nil member2_errors + refute_nil member3_errors + assert_equal "INVALID_VALUE", member3_errors.first.code + assert_equal "Expected the assigned_locations.location_ids to be valid", member3_errors.first.detail + end + + private + + # Helper function to create a test team member + def create_test_team_member(location_ids) + Square::Types::TeamMember.new( + assigned_locations: Square::Types::TeamMemberAssignedLocations.new( + assignment_type: "EXPLICIT_LOCATIONS", + location_ids: location_ids + ), + family_name: "Doe", + given_name: "Jane" + ) + end +end diff --git a/test/integration/test_terminal.rb b/test/integration/test_terminal.rb new file mode 100644 index 000000000..810cd4b3d --- /dev/null +++ b/test/integration/test_terminal.rb @@ -0,0 +1,64 @@ +require_relative 'helpers' +require_relative 'integration_test_base' + +class TerminalTest < IntegrationTestBase + def setup + setup_class + @sandbox_device_id = "da40d603-c2ea-4a65-8cfd-f42e36dab0c7" + + # Create terminal checkout for testing + checkout_response = @client.terminal.checkouts.create( + idempotency_key: new_test_uuid, + checkout: Square::Types::TerminalCheckout.new( + device_options: Square::Types::DeviceCheckoutOptions.new( + device_id: @sandbox_device_id + ), + amount_money: Square::Types::Money.new( + amount: 100, + currency: "USD" + ) + ) + ) + @checkout_id = checkout_response.checkout.id + end + + def test_should_create_terminal_checkout + response = @client.terminal.checkouts.create( + idempotency_key: new_test_uuid, + checkout: Square::Types::TerminalCheckout.new( + device_options: Square::Types::DeviceCheckoutOptions.new( + device_id: @sandbox_device_id + ), + amount_money: Square::Types::Money.new( + amount: 100, + currency: "USD" + ) + ) + ) + + refute_nil response.checkout + assert_equal @sandbox_device_id, response.checkout.device_options.device_id + assert_equal 100, response.checkout.amount_money.amount + end + + def test_should_search_terminal_checkouts + response = @client.terminal.checkouts.search(limit: 1) + + refute_nil response.checkouts + assert response.checkouts.length > 0 + end + + def test_should_get_terminal_checkout + response = @client.terminal.checkouts.get(checkout_id: @checkout_id) + + refute_nil response.checkout + assert_equal @checkout_id, response.checkout.id + end + + def test_should_cancel_terminal_checkout + response = @client.terminal.checkouts.cancel(checkout_id: @checkout_id) + + refute_nil response.checkout + assert_equal "CANCELED", response.checkout.status + end +end diff --git a/test/integration/testdata/image.jpeg b/test/integration/testdata/image.jpeg new file mode 100644 index 000000000..bb7bca31c Binary files /dev/null and b/test/integration/testdata/image.jpeg differ