square.rb 8.0.0.20201216 → 26.1.0.20230119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +79 -221
- data/lib/square/api/apple_pay_api.rb +15 -8
- data/lib/square/api/bank_accounts_api.rb +5 -5
- data/lib/square/api/base_api.rb +27 -9
- data/lib/square/api/booking_custom_attributes_api.rb +555 -0
- data/lib/square/api/bookings_api.rb +107 -15
- data/lib/square/api/cards_api.rb +171 -0
- data/lib/square/api/cash_drawers_api.rb +2 -2
- data/lib/square/api/catalog_api.rb +167 -73
- data/lib/square/api/checkout_api.rb +205 -3
- data/lib/square/api/customer_custom_attributes_api.rb +561 -0
- data/lib/square/api/customer_groups_api.rb +17 -8
- data/lib/square/api/customer_segments_api.rb +15 -6
- data/lib/square/api/customers_api.rb +67 -33
- data/lib/square/api/devices_api.rb +3 -2
- data/lib/square/api/disputes_api.rb +109 -105
- data/lib/square/api/gift_card_activities_api.rb +132 -0
- data/lib/square/api/gift_cards_api.rb +298 -0
- data/lib/square/api/inventory_api.rb +263 -24
- data/lib/square/api/invoices_api.rb +21 -21
- data/lib/square/api/labor_api.rb +70 -68
- data/lib/square/api/location_custom_attributes_api.rb +584 -0
- data/lib/square/api/locations_api.rb +21 -14
- data/lib/square/api/loyalty_api.rb +333 -50
- data/lib/square/api/merchants_api.rb +11 -9
- data/lib/square/api/mobile_authorization_api.rb +4 -4
- data/lib/square/api/o_auth_api.rb +78 -25
- data/lib/square/api/order_custom_attributes_api.rb +601 -0
- data/lib/square/api/orders_api.rb +84 -45
- data/lib/square/api/payments_api.rb +72 -24
- data/lib/square/api/payouts_api.rb +173 -0
- data/lib/square/api/refunds_api.rb +18 -7
- data/lib/square/api/sites_api.rb +43 -0
- data/lib/square/api/snippets_api.rb +146 -0
- data/lib/square/api/subscriptions_api.rb +190 -15
- data/lib/square/api/team_api.rb +46 -46
- data/lib/square/api/terminal_api.rb +172 -22
- data/lib/square/api/transactions_api.rb +15 -191
- data/lib/square/api/v1_transactions_api.rb +52 -124
- data/lib/square/api/vendors_api.rb +257 -0
- data/lib/square/api/webhook_subscriptions_api.rb +327 -0
- data/lib/square/api_helper.rb +217 -57
- data/lib/square/client.rb +90 -18
- data/lib/square/configuration.rb +64 -20
- data/lib/square/exceptions/validation_exception.rb +13 -0
- data/lib/square/http/api_response.rb +7 -9
- data/lib/square/http/faraday_client.rb +40 -9
- data/lib/square/http/http_client.rb +31 -12
- data/lib/square/http/http_request.rb +6 -2
- data/lib/square/utilities/date_time_helper.rb +151 -0
- data/lib/square/utilities/file_wrapper.rb +1 -2
- data/lib/square.rb +56 -44
- data/test/api/test_locations_api.rb +2 -5
- data/test/test_helper.rb +2 -2
- metadata +83 -15
- data/lib/square/api/v1_employees_api.rb +0 -751
- data/lib/square/api/v1_items_api.rb +0 -1766
| @@ -5,17 +5,22 @@ module Square | |
| 5 5 | 
             
                  super(config, http_call_back: http_call_back)
         | 
| 6 6 | 
             
                end
         | 
| 7 7 |  | 
| 8 | 
            -
                # Deletes a set of [CatalogItem]( | 
| 8 | 
            +
                # Deletes a set of [CatalogItem]($m/CatalogItem)s based on the
         | 
| 9 9 | 
             
                # provided list of target IDs and returns a set of successfully deleted IDs
         | 
| 10 10 | 
             
                # in
         | 
| 11 11 | 
             
                # the response. Deletion is a cascading event such that all children of the
         | 
| 12 12 | 
             
                # targeted object are also deleted. For example, deleting a CatalogItem will
         | 
| 13 | 
            -
                # also delete all of its [CatalogItemVariation]( | 
| 13 | 
            +
                # also delete all of its [CatalogItemVariation]($m/CatalogItemVariation)
         | 
| 14 14 | 
             
                # children.
         | 
| 15 15 | 
             
                # `BatchDeleteCatalogObjects` succeeds even if only a portion of the
         | 
| 16 16 | 
             
                # targeted
         | 
| 17 17 | 
             
                # IDs can be deleted. The response will only include IDs that were
         | 
| 18 18 | 
             
                # actually deleted.
         | 
| 19 | 
            +
                # To ensure consistency, only one delete request is processed at a time per
         | 
| 20 | 
            +
                # seller account.
         | 
| 21 | 
            +
                # While one (batch or non-batch) delete request is being processed, other
         | 
| 22 | 
            +
                # (batched and non-batched)
         | 
| 23 | 
            +
                # delete requests are rejected with the `429` error code.
         | 
| 19 24 | 
             
                # @param [BatchDeleteCatalogObjectsRequest] body Required parameter: An
         | 
| 20 25 | 
             
                # object containing the fields to POST for the request.  See the
         | 
| 21 26 | 
             
                # corresponding object definition for field details.
         | 
| @@ -29,7 +34,7 @@ module Square | |
| 29 34 | 
             
                  # Prepare headers.
         | 
| 30 35 | 
             
                  _headers = {
         | 
| 31 36 | 
             
                    'accept' => 'application/json',
         | 
| 32 | 
            -
                    ' | 
| 37 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 33 38 | 
             
                  }
         | 
| 34 39 |  | 
| 35 40 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -50,13 +55,11 @@ module Square | |
| 50 55 | 
             
                end
         | 
| 51 56 |  | 
| 52 57 | 
             
                # Returns a set of objects based on the provided ID.
         | 
| 53 | 
            -
                # Each [CatalogItem]( | 
| 54 | 
            -
                # its
         | 
| 58 | 
            +
                # Each [CatalogItem]($m/CatalogItem) returned in the set includes all of its
         | 
| 55 59 | 
             
                # child information including: all of its
         | 
| 56 | 
            -
                # [CatalogItemVariation]( | 
| 57 | 
            -
                # its [CatalogModifierList]( | 
| 58 | 
            -
                #  | 
| 59 | 
            -
                # any [CatalogTax](#type-catalogtax) objects that apply to it.
         | 
| 60 | 
            +
                # [CatalogItemVariation]($m/CatalogItemVariation) objects, references to
         | 
| 61 | 
            +
                # its [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
         | 
| 62 | 
            +
                # any [CatalogTax]($m/CatalogTax) objects that apply to it.
         | 
| 60 63 | 
             
                # @param [BatchRetrieveCatalogObjectsRequest] body Required parameter: An
         | 
| 61 64 | 
             
                # object containing the fields to POST for the request.  See the
         | 
| 62 65 | 
             
                # corresponding object definition for field details.
         | 
| @@ -70,7 +73,7 @@ module Square | |
| 70 73 | 
             
                  # Prepare headers.
         | 
| 71 74 | 
             
                  _headers = {
         | 
| 72 75 | 
             
                    'accept' => 'application/json',
         | 
| 73 | 
            -
                    ' | 
| 76 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 74 77 | 
             
                  }
         | 
| 75 78 |  | 
| 76 79 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -104,6 +107,11 @@ module Square | |
| 104 107 | 
             
                # request (items, variations, modifier lists, discounts, and taxes) is no
         | 
| 105 108 | 
             
                # more
         | 
| 106 109 | 
             
                # than 10,000.
         | 
| 110 | 
            +
                # To ensure consistency, only one update request is processed at a time per
         | 
| 111 | 
            +
                # seller account.
         | 
| 112 | 
            +
                # While one (batch or non-batch) update request is being processed, other
         | 
| 113 | 
            +
                # (batched and non-batched)
         | 
| 114 | 
            +
                # update requests are rejected with the `429` error code.
         | 
| 107 115 | 
             
                # @param [BatchUpsertCatalogObjectsRequest] body Required parameter: An
         | 
| 108 116 | 
             
                # object containing the fields to POST for the request.  See the
         | 
| 109 117 | 
             
                # corresponding object definition for field details.
         | 
| @@ -117,7 +125,7 @@ module Square | |
| 117 125 | 
             
                  # Prepare headers.
         | 
| 118 126 | 
             
                  _headers = {
         | 
| 119 127 | 
             
                    'accept' => 'application/json',
         | 
| 120 | 
            -
                    ' | 
| 128 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 121 129 | 
             
                  }
         | 
| 122 130 |  | 
| 123 131 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -138,10 +146,10 @@ module Square | |
| 138 146 | 
             
                end
         | 
| 139 147 |  | 
| 140 148 | 
             
                # Uploads an image file to be represented by a
         | 
| 141 | 
            -
                # [CatalogImage]( | 
| 142 | 
            -
                # [CatalogObject]( | 
| 143 | 
            -
                #  | 
| 144 | 
            -
                #  | 
| 149 | 
            +
                # [CatalogImage]($m/CatalogImage) object that can be linked to an existing
         | 
| 150 | 
            +
                # [CatalogObject]($m/CatalogObject) instance. The resulting `CatalogImage`
         | 
| 151 | 
            +
                # is unattached to any `CatalogObject` if the `object_id`
         | 
| 152 | 
            +
                # is not specified.
         | 
| 145 153 | 
             
                # This `CreateCatalogImage` endpoint accepts HTTP multipart/form-data
         | 
| 146 154 | 
             
                # requests with a JSON part and an image file part in
         | 
| 147 155 | 
             
                # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
         | 
| @@ -198,6 +206,71 @@ module Square | |
| 198 206 | 
             
                  )
         | 
| 199 207 | 
             
                end
         | 
| 200 208 |  | 
| 209 | 
            +
                # Uploads a new image file to replace the existing one in the specified
         | 
| 210 | 
            +
                # [CatalogImage]($m/CatalogImage) object.
         | 
| 211 | 
            +
                # This `UpdateCatalogImage` endpoint accepts HTTP multipart/form-data
         | 
| 212 | 
            +
                # requests with a JSON part and an image file part in
         | 
| 213 | 
            +
                # JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.
         | 
| 214 | 
            +
                # @param [String] image_id Required parameter: The ID of the `CatalogImage`
         | 
| 215 | 
            +
                # object to update the encapsulated image file.
         | 
| 216 | 
            +
                # @param [UpdateCatalogImageRequest] request Optional parameter: Example:
         | 
| 217 | 
            +
                # @param [File | UploadIO] image_file Optional parameter: Example:
         | 
| 218 | 
            +
                # @return [UpdateCatalogImageResponse Hash] response from the API call
         | 
| 219 | 
            +
                def update_catalog_image(image_id:,
         | 
| 220 | 
            +
                                         request: nil,
         | 
| 221 | 
            +
                                         image_file: nil)
         | 
| 222 | 
            +
                  # Prepare query url.
         | 
| 223 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 224 | 
            +
                  _query_builder << '/v2/catalog/images/{image_id}'
         | 
| 225 | 
            +
                  _query_builder = APIHelper.append_url_with_template_parameters(
         | 
| 226 | 
            +
                    _query_builder,
         | 
| 227 | 
            +
                    'image_id' => { 'value' => image_id, 'encode' => true }
         | 
| 228 | 
            +
                  )
         | 
| 229 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 230 | 
            +
             | 
| 231 | 
            +
                  if image_file.is_a? FileWrapper
         | 
| 232 | 
            +
                    image_file_wrapper = image_file.file
         | 
| 233 | 
            +
                    image_file_content_type = image_file.content_type
         | 
| 234 | 
            +
                  else
         | 
| 235 | 
            +
                    image_file_wrapper = image_file
         | 
| 236 | 
            +
                    image_file_content_type = 'image/jpeg'
         | 
| 237 | 
            +
                  end
         | 
| 238 | 
            +
             | 
| 239 | 
            +
                  # Prepare headers.
         | 
| 240 | 
            +
                  _headers = {
         | 
| 241 | 
            +
                    'accept' => 'application/json'
         | 
| 242 | 
            +
                  }
         | 
| 243 | 
            +
             | 
| 244 | 
            +
                  # Prepare form parameters.
         | 
| 245 | 
            +
                  _parameters = {
         | 
| 246 | 
            +
                    'request' => Faraday::UploadIO.new(
         | 
| 247 | 
            +
                      StringIO.new(request.to_json),
         | 
| 248 | 
            +
                      'application/json'
         | 
| 249 | 
            +
                    ),
         | 
| 250 | 
            +
                    'image_file' => Faraday::UploadIO.new(
         | 
| 251 | 
            +
                      image_file_wrapper,
         | 
| 252 | 
            +
                      image_file_content_type
         | 
| 253 | 
            +
                    )
         | 
| 254 | 
            +
                  }
         | 
| 255 | 
            +
                  _parameters = APIHelper.form_encode_parameters(_parameters)
         | 
| 256 | 
            +
             | 
| 257 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 258 | 
            +
                  _request = config.http_client.put(
         | 
| 259 | 
            +
                    _query_url,
         | 
| 260 | 
            +
                    headers: _headers,
         | 
| 261 | 
            +
                    parameters: _parameters
         | 
| 262 | 
            +
                  )
         | 
| 263 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 264 | 
            +
                  _response = execute_request(_request)
         | 
| 265 | 
            +
             | 
| 266 | 
            +
                  # Return appropriate response type.
         | 
| 267 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 268 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 269 | 
            +
                  ApiResponse.new(
         | 
| 270 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 271 | 
            +
                  )
         | 
| 272 | 
            +
                end
         | 
| 273 | 
            +
             | 
| 201 274 | 
             
                # Retrieves information about the Square Catalog API, such as batch size
         | 
| 202 275 | 
             
                # limits that can be used by the `BatchUpsertCatalogObjects` endpoint.
         | 
| 203 276 | 
             
                # @return [CatalogInfoResponse Hash] response from the API call
         | 
| @@ -228,34 +301,40 @@ module Square | |
| 228 301 | 
             
                  )
         | 
| 229 302 | 
             
                end
         | 
| 230 303 |  | 
| 231 | 
            -
                # Returns a list of [CatalogObject]( | 
| 232 | 
            -
                #  | 
| 233 | 
            -
                #  | 
| 234 | 
            -
                #  | 
| 235 | 
            -
                #  | 
| 236 | 
            -
                #  | 
| 237 | 
            -
                # [CatalogObject](#type-catalogobject) types:
         | 
| 238 | 
            -
                # `ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`,
         | 
| 239 | 
            -
                # `DISCOUNT`, `TAX`, `IMAGE`.
         | 
| 304 | 
            +
                # Returns a list of all [CatalogObject]($m/CatalogObject)s of the specified
         | 
| 305 | 
            +
                # types in the catalog.
         | 
| 306 | 
            +
                # The `types` parameter is specified as a comma-separated list of the
         | 
| 307 | 
            +
                # [CatalogObjectType]($m/CatalogObjectType) values,
         | 
| 308 | 
            +
                # for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`,
         | 
| 309 | 
            +
                # `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
         | 
| 240 310 | 
             
                # __Important:__ ListCatalog does not return deleted catalog items. To
         | 
| 241 311 | 
             
                # retrieve
         | 
| 242 312 | 
             
                # deleted catalog items, use
         | 
| 243 | 
            -
                # [SearchCatalogObjects]( | 
| 313 | 
            +
                # [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
         | 
| 244 314 | 
             
                # and set the `include_deleted_objects` attribute value to `true`.
         | 
| 245 315 | 
             
                # @param [String] cursor Optional parameter: The pagination cursor returned
         | 
| 246 | 
            -
                # in the previous response. Leave unset for an initial request.  | 
| 316 | 
            +
                # in the previous response. Leave unset for an initial request. The page
         | 
| 317 | 
            +
                # size is currently set to be 100. See
         | 
| 247 318 | 
             
                # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
         | 
| 248 319 | 
             
                # for more information.
         | 
| 249 320 | 
             
                # @param [String] types Optional parameter: An optional case-insensitive,
         | 
| 250 | 
            -
                # comma-separated list of object types to retrieve | 
| 251 | 
            -
                #  | 
| 252 | 
            -
                #  | 
| 253 | 
            -
                # ` | 
| 254 | 
            -
                #  | 
| 255 | 
            -
                #  | 
| 321 | 
            +
                # comma-separated list of object types to retrieve.  The valid values are
         | 
| 322 | 
            +
                # defined in the [CatalogObjectType]($m/CatalogObjectType) enum, for
         | 
| 323 | 
            +
                # example, `ITEM`, `ITEM_VARIATION`, `CATEGORY`, `DISCOUNT`, `TAX`,
         | 
| 324 | 
            +
                # `MODIFIER`, `MODIFIER_LIST`, `IMAGE`, etc.  If this is unspecified, the
         | 
| 325 | 
            +
                # operation returns objects of all the top level types at the version of the
         | 
| 326 | 
            +
                # Square API used to make the request. Object types that are nested onto
         | 
| 327 | 
            +
                # other object types are not included in the defaults.  At the current API
         | 
| 328 | 
            +
                # version the default object types are: ITEM, CATEGORY, TAX, DISCOUNT,
         | 
| 329 | 
            +
                # MODIFIER_LIST,  PRICING_RULE, PRODUCT_SET, TIME_PERIOD, MEASUREMENT_UNIT,
         | 
| 330 | 
            +
                # SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION,
         | 
| 331 | 
            +
                # QUICK_AMOUNT_SETTINGS.
         | 
| 332 | 
            +
                # @param [Integer] catalog_version Optional parameter: The specific version
         | 
| 333 | 
            +
                # of the catalog objects to be included in the response. This allows you to
         | 
| 256 334 | 
             
                # retrieve historical versions of objects. The specified version value is
         | 
| 257 | 
            -
                # matched against the [CatalogObject]( | 
| 258 | 
            -
                # attribute.
         | 
| 335 | 
            +
                # matched against the [CatalogObject]($m/CatalogObject)s' `version`
         | 
| 336 | 
            +
                # attribute.  If not included, results will be from the current version of
         | 
| 337 | 
            +
                # the catalog.
         | 
| 259 338 | 
             
                # @return [ListCatalogResponse Hash] response from the API call
         | 
| 260 339 | 
             
                def list_catalog(cursor: nil,
         | 
| 261 340 | 
             
                                 types: nil,
         | 
| @@ -292,7 +371,12 @@ module Square | |
| 292 371 | 
             
                  )
         | 
| 293 372 | 
             
                end
         | 
| 294 373 |  | 
| 295 | 
            -
                # Creates or updates the  | 
| 374 | 
            +
                # Creates a new or updates the specified [CatalogObject]($m/CatalogObject).
         | 
| 375 | 
            +
                # To ensure consistency, only one update request is processed at a time per
         | 
| 376 | 
            +
                # seller account.
         | 
| 377 | 
            +
                # While one (batch or non-batch) update request is being processed, other
         | 
| 378 | 
            +
                # (batched and non-batched)
         | 
| 379 | 
            +
                # update requests are rejected with the `429` error code.
         | 
| 296 380 | 
             
                # @param [UpsertCatalogObjectRequest] body Required parameter: An object
         | 
| 297 381 | 
             
                # containing the fields to POST for the request.  See the corresponding
         | 
| 298 382 | 
             
                # object definition for field details.
         | 
| @@ -306,7 +390,7 @@ module Square | |
| 306 390 | 
             
                  # Prepare headers.
         | 
| 307 391 | 
             
                  _headers = {
         | 
| 308 392 | 
             
                    'accept' => 'application/json',
         | 
| 309 | 
            -
                    ' | 
| 393 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 310 394 | 
             
                  }
         | 
| 311 395 |  | 
| 312 396 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -326,14 +410,19 @@ module Square | |
| 326 410 | 
             
                  )
         | 
| 327 411 | 
             
                end
         | 
| 328 412 |  | 
| 329 | 
            -
                # Deletes a single [CatalogObject]( | 
| 413 | 
            +
                # Deletes a single [CatalogObject]($m/CatalogObject) based on the
         | 
| 330 414 | 
             
                # provided ID and returns the set of successfully deleted IDs in the
         | 
| 331 415 | 
             
                # response.
         | 
| 332 416 | 
             
                # Deletion is a cascading event such that all children of the targeted
         | 
| 333 417 | 
             
                # object
         | 
| 334 | 
            -
                # are also deleted. For example, deleting a [CatalogItem]( | 
| 418 | 
            +
                # are also deleted. For example, deleting a [CatalogItem]($m/CatalogItem)
         | 
| 335 419 | 
             
                # will also delete all of its
         | 
| 336 | 
            -
                # [CatalogItemVariation]( | 
| 420 | 
            +
                # [CatalogItemVariation]($m/CatalogItemVariation) children.
         | 
| 421 | 
            +
                # To ensure consistency, only one delete request is processed at a time per
         | 
| 422 | 
            +
                # seller account.
         | 
| 423 | 
            +
                # While one (batch or non-batch) delete request is being processed, other
         | 
| 424 | 
            +
                # (batched and non-batched)
         | 
| 425 | 
            +
                # delete requests are rejected with the `429` error code.
         | 
| 337 426 | 
             
                # @param [String] object_id Required parameter: The ID of the catalog object
         | 
| 338 427 | 
             
                # to be deleted. When an object is deleted, other objects in the graph that
         | 
| 339 428 | 
             
                # depend on that object will be deleted as well (for example, deleting a
         | 
| @@ -370,30 +459,35 @@ module Square | |
| 370 459 | 
             
                  )
         | 
| 371 460 | 
             
                end
         | 
| 372 461 |  | 
| 373 | 
            -
                # Returns a single [CatalogItem]( | 
| 374 | 
            -
                # [CatalogObject]( | 
| 375 | 
            -
                #  | 
| 376 | 
            -
                #  | 
| 377 | 
            -
                # information including: [CatalogItemVariation](#type-catalogitemvariation)
         | 
| 462 | 
            +
                # Returns a single [CatalogItem]($m/CatalogItem) as a
         | 
| 463 | 
            +
                # [CatalogObject]($m/CatalogObject) based on the provided ID. The returned
         | 
| 464 | 
            +
                # object includes all of the relevant [CatalogItem]($m/CatalogItem)
         | 
| 465 | 
            +
                # information including: [CatalogItemVariation]($m/CatalogItemVariation)
         | 
| 378 466 | 
             
                # children, references to its
         | 
| 379 | 
            -
                # [CatalogModifierList]( | 
| 380 | 
            -
                # any [CatalogTax]( | 
| 467 | 
            +
                # [CatalogModifierList]($m/CatalogModifierList) objects, and the ids of
         | 
| 468 | 
            +
                # any [CatalogTax]($m/CatalogTax) objects that apply to it.
         | 
| 381 469 | 
             
                # @param [String] object_id Required parameter: The object ID of any type of
         | 
| 382 470 | 
             
                # catalog objects to be retrieved.
         | 
| 383 | 
            -
                # @param [ | 
| 384 | 
            -
                # the response will include additional objects that are related | 
| 385 | 
            -
                # requested  | 
| 386 | 
            -
                #  | 
| 387 | 
            -
                #  | 
| 388 | 
            -
                # ` | 
| 389 | 
            -
                #  | 
| 390 | 
            -
                # be  | 
| 391 | 
            -
                #  | 
| 392 | 
            -
                #  | 
| 393 | 
            -
                #  | 
| 394 | 
            -
                #  | 
| 395 | 
            -
                #  | 
| 396 | 
            -
                #  | 
| 471 | 
            +
                # @param [TrueClass|FalseClass] include_related_objects Optional parameter:
         | 
| 472 | 
            +
                # If `true`, the response will include additional objects that are related
         | 
| 473 | 
            +
                # to the requested objects. Related objects are defined as any objects
         | 
| 474 | 
            +
                # referenced by ID by the results in the `objects` field of the response.
         | 
| 475 | 
            +
                # These objects are put in the `related_objects` field. Setting this to
         | 
| 476 | 
            +
                # `true` is helpful when the objects are needed for immediate display to a
         | 
| 477 | 
            +
                # user. This process only goes one level deep. Objects referenced by the
         | 
| 478 | 
            +
                # related objects will not be included. For example,  if the `objects` field
         | 
| 479 | 
            +
                # of the response contains a CatalogItem, its associated CatalogCategory
         | 
| 480 | 
            +
                # objects, CatalogTax objects, CatalogImage objects and CatalogModifierLists
         | 
| 481 | 
            +
                # will be returned in the `related_objects` field of the response. If the
         | 
| 482 | 
            +
                # `objects` field of the response contains a CatalogItemVariation, its
         | 
| 483 | 
            +
                # parent CatalogItem will be returned in the `related_objects` field of the
         | 
| 484 | 
            +
                # response.  Default value: `false`
         | 
| 485 | 
            +
                # @param [Integer] catalog_version Optional parameter: Requests objects as
         | 
| 486 | 
            +
                # of a specific version of the catalog. This allows you to retrieve
         | 
| 487 | 
            +
                # historical versions of objects. The value to retrieve a specific version
         | 
| 488 | 
            +
                # of an object can be found in the version field of
         | 
| 489 | 
            +
                # [CatalogObject]($m/CatalogObject)s. If not included, results will be from
         | 
| 490 | 
            +
                # the current version of the catalog.
         | 
| 397 491 | 
             
                # @return [RetrieveCatalogObjectResponse Hash] response from the API call
         | 
| 398 492 | 
             
                def retrieve_catalog_object(object_id:,
         | 
| 399 493 | 
             
                                            include_related_objects: false,
         | 
| @@ -433,12 +527,12 @@ module Square | |
| 433 527 | 
             
                  )
         | 
| 434 528 | 
             
                end
         | 
| 435 529 |  | 
| 436 | 
            -
                # Searches for [CatalogObject]( | 
| 530 | 
            +
                # Searches for [CatalogObject]($m/CatalogObject) of any type by matching
         | 
| 437 531 | 
             
                # supported search attribute values,
         | 
| 438 532 | 
             
                # excluding custom attribute values on items or item variations, against one
         | 
| 439 | 
            -
                # or more of the specified query  | 
| 533 | 
            +
                # or more of the specified query filters.
         | 
| 440 534 | 
             
                # This (`SearchCatalogObjects`) endpoint differs from the
         | 
| 441 | 
            -
                # [SearchCatalogItems]( | 
| 535 | 
            +
                # [SearchCatalogItems]($e/Catalog/SearchCatalogItems)
         | 
| 442 536 | 
             
                # endpoint in the following aspects:
         | 
| 443 537 | 
             
                # - `SearchCatalogItems` can only search for items or item variations,
         | 
| 444 538 | 
             
                # whereas `SearchCatalogObjects` can search for any type of catalog objects.
         | 
| @@ -463,7 +557,7 @@ module Square | |
| 463 557 | 
             
                  # Prepare headers.
         | 
| 464 558 | 
             
                  _headers = {
         | 
| 465 559 | 
             
                    'accept' => 'application/json',
         | 
| 466 | 
            -
                    ' | 
| 560 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 467 561 | 
             
                  }
         | 
| 468 562 |  | 
| 469 563 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -486,9 +580,9 @@ module Square | |
| 486 580 | 
             
                # Searches for catalog items or item variations by matching supported search
         | 
| 487 581 | 
             
                # attribute values, including
         | 
| 488 582 | 
             
                # custom attribute values, against one or more of the specified query
         | 
| 489 | 
            -
                #  | 
| 583 | 
            +
                # filters.
         | 
| 490 584 | 
             
                # This (`SearchCatalogItems`) endpoint differs from the
         | 
| 491 | 
            -
                # [SearchCatalogObjects]( | 
| 585 | 
            +
                # [SearchCatalogObjects]($e/Catalog/SearchCatalogObjects)
         | 
| 492 586 | 
             
                # endpoint in the following aspects:
         | 
| 493 587 | 
             
                # - `SearchCatalogItems` can only search for items or item variations,
         | 
| 494 588 | 
             
                # whereas `SearchCatalogObjects` can search for any type of catalog objects.
         | 
| @@ -513,7 +607,7 @@ module Square | |
| 513 607 | 
             
                  # Prepare headers.
         | 
| 514 608 | 
             
                  _headers = {
         | 
| 515 609 | 
             
                    'accept' => 'application/json',
         | 
| 516 | 
            -
                    ' | 
| 610 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 517 611 | 
             
                  }
         | 
| 518 612 |  | 
| 519 613 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -533,8 +627,8 @@ module Square | |
| 533 627 | 
             
                  )
         | 
| 534 628 | 
             
                end
         | 
| 535 629 |  | 
| 536 | 
            -
                # Updates the [CatalogModifierList]( | 
| 537 | 
            -
                # that apply to the targeted [CatalogItem]( | 
| 630 | 
            +
                # Updates the [CatalogModifierList]($m/CatalogModifierList) objects
         | 
| 631 | 
            +
                # that apply to the targeted [CatalogItem]($m/CatalogItem) without having
         | 
| 538 632 | 
             
                # to perform an upsert on the entire item.
         | 
| 539 633 | 
             
                # @param [UpdateItemModifierListsRequest] body Required parameter: An object
         | 
| 540 634 | 
             
                # containing the fields to POST for the request.  See the corresponding
         | 
| @@ -549,7 +643,7 @@ module Square | |
| 549 643 | 
             
                  # Prepare headers.
         | 
| 550 644 | 
             
                  _headers = {
         | 
| 551 645 | 
             
                    'accept' => 'application/json',
         | 
| 552 | 
            -
                    ' | 
| 646 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 553 647 | 
             
                  }
         | 
| 554 648 |  | 
| 555 649 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -569,8 +663,8 @@ module Square | |
| 569 663 | 
             
                  )
         | 
| 570 664 | 
             
                end
         | 
| 571 665 |  | 
| 572 | 
            -
                # Updates the [CatalogTax]( | 
| 573 | 
            -
                # targeted [CatalogItem]( | 
| 666 | 
            +
                # Updates the [CatalogTax]($m/CatalogTax) objects that apply to the
         | 
| 667 | 
            +
                # targeted [CatalogItem]($m/CatalogItem) without having to perform an
         | 
| 574 668 | 
             
                # upsert on the entire item.
         | 
| 575 669 | 
             
                # @param [UpdateItemTaxesRequest] body Required parameter: An object
         | 
| 576 670 | 
             
                # containing the fields to POST for the request.  See the corresponding
         | 
| @@ -585,7 +679,7 @@ module Square | |
| 585 679 | 
             
                  # Prepare headers.
         | 
| 586 680 | 
             
                  _headers = {
         | 
| 587 681 | 
             
                    'accept' => 'application/json',
         | 
| 588 | 
            -
                    ' | 
| 682 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 589 683 | 
             
                  }
         | 
| 590 684 |  | 
| 591 685 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -5,9 +5,16 @@ module Square | |
| 5 5 | 
             
                  super(config, http_call_back: http_call_back)
         | 
| 6 6 | 
             
                end
         | 
| 7 7 |  | 
| 8 | 
            -
                # Links a `checkoutId` to a `checkout_page_url` that customers  | 
| 9 | 
            -
                #  | 
| 8 | 
            +
                # Links a `checkoutId` to a `checkout_page_url` that customers are
         | 
| 9 | 
            +
                # directed to in order to provide their payment information using a
         | 
| 10 10 | 
             
                # payment processing workflow hosted on connect.squareup.com.
         | 
| 11 | 
            +
                # NOTE: The Checkout API has been updated with new features.
         | 
| 12 | 
            +
                # For more information, see [Checkout API
         | 
| 13 | 
            +
                # highlights](https://developer.squareup.com/docs/checkout-api#checkout-api-
         | 
| 14 | 
            +
                # highlights).
         | 
| 15 | 
            +
                # We recommend that you use the
         | 
| 16 | 
            +
                # new [CreatePaymentLink]($e/Checkout/CreatePaymentLink)
         | 
| 17 | 
            +
                # endpoint in place of this previously released endpoint.
         | 
| 11 18 | 
             
                # @param [String] location_id Required parameter: The ID of the business
         | 
| 12 19 | 
             
                # location to associate the checkout with.
         | 
| 13 20 | 
             
                # @param [CreateCheckoutRequest] body Required parameter: An object
         | 
| @@ -16,6 +23,7 @@ module Square | |
| 16 23 | 
             
                # @return [CreateCheckoutResponse Hash] response from the API call
         | 
| 17 24 | 
             
                def create_checkout(location_id:,
         | 
| 18 25 | 
             
                                    body:)
         | 
| 26 | 
            +
                  warn 'Endpoint create_checkout in CheckoutApi is deprecated'
         | 
| 19 27 | 
             
                  # Prepare query url.
         | 
| 20 28 | 
             
                  _query_builder = config.get_base_uri
         | 
| 21 29 | 
             
                  _query_builder << '/v2/locations/{location_id}/checkouts'
         | 
| @@ -28,7 +36,7 @@ module Square | |
| 28 36 | 
             
                  # Prepare headers.
         | 
| 29 37 | 
             
                  _headers = {
         | 
| 30 38 | 
             
                    'accept' => 'application/json',
         | 
| 31 | 
            -
                    ' | 
| 39 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 32 40 | 
             
                  }
         | 
| 33 41 |  | 
| 34 42 | 
             
                  # Prepare and execute HttpRequest.
         | 
| @@ -47,5 +55,199 @@ module Square | |
| 47 55 | 
             
                    _response, data: decoded, errors: _errors
         | 
| 48 56 | 
             
                  )
         | 
| 49 57 | 
             
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                # Lists all payment links.
         | 
| 60 | 
            +
                # @param [String] cursor Optional parameter: A pagination cursor returned by
         | 
| 61 | 
            +
                # a previous call to this endpoint. Provide this cursor to retrieve the next
         | 
| 62 | 
            +
                # set of results for the original query. If a cursor is not provided, the
         | 
| 63 | 
            +
                # endpoint returns the first page of the results. For more  information, see
         | 
| 64 | 
            +
                # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
         | 
| 65 | 
            +
                # .
         | 
| 66 | 
            +
                # @param [Integer] limit Optional parameter: A limit on the number of
         | 
| 67 | 
            +
                # results to return per page. The limit is advisory and the implementation
         | 
| 68 | 
            +
                # might return more or less results. If the supplied limit is negative,
         | 
| 69 | 
            +
                # zero, or greater than the maximum limit of 1000, it is ignored.  Default
         | 
| 70 | 
            +
                # value: `100`
         | 
| 71 | 
            +
                # @return [ListPaymentLinksResponse Hash] response from the API call
         | 
| 72 | 
            +
                def list_payment_links(cursor: nil,
         | 
| 73 | 
            +
                                       limit: nil)
         | 
| 74 | 
            +
                  # Prepare query url.
         | 
| 75 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 76 | 
            +
                  _query_builder << '/v2/online-checkout/payment-links'
         | 
| 77 | 
            +
                  _query_builder = APIHelper.append_url_with_query_parameters(
         | 
| 78 | 
            +
                    _query_builder,
         | 
| 79 | 
            +
                    'cursor' => cursor,
         | 
| 80 | 
            +
                    'limit' => limit
         | 
| 81 | 
            +
                  )
         | 
| 82 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  # Prepare headers.
         | 
| 85 | 
            +
                  _headers = {
         | 
| 86 | 
            +
                    'accept' => 'application/json'
         | 
| 87 | 
            +
                  }
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 90 | 
            +
                  _request = config.http_client.get(
         | 
| 91 | 
            +
                    _query_url,
         | 
| 92 | 
            +
                    headers: _headers
         | 
| 93 | 
            +
                  )
         | 
| 94 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 95 | 
            +
                  _response = execute_request(_request)
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                  # Return appropriate response type.
         | 
| 98 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 99 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 100 | 
            +
                  ApiResponse.new(
         | 
| 101 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 102 | 
            +
                  )
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                # Creates a Square-hosted checkout page. Applications can share the
         | 
| 106 | 
            +
                # resulting payment link with their buyer to pay for goods and services.
         | 
| 107 | 
            +
                # @param [CreatePaymentLinkRequest] body Required parameter: An object
         | 
| 108 | 
            +
                # containing the fields to POST for the request.  See the corresponding
         | 
| 109 | 
            +
                # object definition for field details.
         | 
| 110 | 
            +
                # @return [CreatePaymentLinkResponse Hash] response from the API call
         | 
| 111 | 
            +
                def create_payment_link(body:)
         | 
| 112 | 
            +
                  # Prepare query url.
         | 
| 113 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 114 | 
            +
                  _query_builder << '/v2/online-checkout/payment-links'
         | 
| 115 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  # Prepare headers.
         | 
| 118 | 
            +
                  _headers = {
         | 
| 119 | 
            +
                    'accept' => 'application/json',
         | 
| 120 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 121 | 
            +
                  }
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 124 | 
            +
                  _request = config.http_client.post(
         | 
| 125 | 
            +
                    _query_url,
         | 
| 126 | 
            +
                    headers: _headers,
         | 
| 127 | 
            +
                    parameters: body.to_json
         | 
| 128 | 
            +
                  )
         | 
| 129 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 130 | 
            +
                  _response = execute_request(_request)
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                  # Return appropriate response type.
         | 
| 133 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 134 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 135 | 
            +
                  ApiResponse.new(
         | 
| 136 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 137 | 
            +
                  )
         | 
| 138 | 
            +
                end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                # Deletes a payment link.
         | 
| 141 | 
            +
                # @param [String] id Required parameter: The ID of the payment link to
         | 
| 142 | 
            +
                # delete.
         | 
| 143 | 
            +
                # @return [DeletePaymentLinkResponse Hash] response from the API call
         | 
| 144 | 
            +
                def delete_payment_link(id:)
         | 
| 145 | 
            +
                  # Prepare query url.
         | 
| 146 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 147 | 
            +
                  _query_builder << '/v2/online-checkout/payment-links/{id}'
         | 
| 148 | 
            +
                  _query_builder = APIHelper.append_url_with_template_parameters(
         | 
| 149 | 
            +
                    _query_builder,
         | 
| 150 | 
            +
                    'id' => { 'value' => id, 'encode' => true }
         | 
| 151 | 
            +
                  )
         | 
| 152 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                  # Prepare headers.
         | 
| 155 | 
            +
                  _headers = {
         | 
| 156 | 
            +
                    'accept' => 'application/json'
         | 
| 157 | 
            +
                  }
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 160 | 
            +
                  _request = config.http_client.delete(
         | 
| 161 | 
            +
                    _query_url,
         | 
| 162 | 
            +
                    headers: _headers
         | 
| 163 | 
            +
                  )
         | 
| 164 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 165 | 
            +
                  _response = execute_request(_request)
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                  # Return appropriate response type.
         | 
| 168 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 169 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 170 | 
            +
                  ApiResponse.new(
         | 
| 171 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 172 | 
            +
                  )
         | 
| 173 | 
            +
                end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                # Retrieves a payment link.
         | 
| 176 | 
            +
                # @param [String] id Required parameter: The ID of link to retrieve.
         | 
| 177 | 
            +
                # @return [RetrievePaymentLinkResponse Hash] response from the API call
         | 
| 178 | 
            +
                def retrieve_payment_link(id:)
         | 
| 179 | 
            +
                  # Prepare query url.
         | 
| 180 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 181 | 
            +
                  _query_builder << '/v2/online-checkout/payment-links/{id}'
         | 
| 182 | 
            +
                  _query_builder = APIHelper.append_url_with_template_parameters(
         | 
| 183 | 
            +
                    _query_builder,
         | 
| 184 | 
            +
                    'id' => { 'value' => id, 'encode' => true }
         | 
| 185 | 
            +
                  )
         | 
| 186 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                  # Prepare headers.
         | 
| 189 | 
            +
                  _headers = {
         | 
| 190 | 
            +
                    'accept' => 'application/json'
         | 
| 191 | 
            +
                  }
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 194 | 
            +
                  _request = config.http_client.get(
         | 
| 195 | 
            +
                    _query_url,
         | 
| 196 | 
            +
                    headers: _headers
         | 
| 197 | 
            +
                  )
         | 
| 198 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 199 | 
            +
                  _response = execute_request(_request)
         | 
| 200 | 
            +
             | 
| 201 | 
            +
                  # Return appropriate response type.
         | 
| 202 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 203 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 204 | 
            +
                  ApiResponse.new(
         | 
| 205 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 206 | 
            +
                  )
         | 
| 207 | 
            +
                end
         | 
| 208 | 
            +
             | 
| 209 | 
            +
                # Updates a payment link. You can update the `payment_link` fields such as
         | 
| 210 | 
            +
                # `description`, `checkout_options`, and  `pre_populated_data`.
         | 
| 211 | 
            +
                # You cannot update other fields such as the `order_id`, `version`, `URL`,
         | 
| 212 | 
            +
                # or `timestamp` field.
         | 
| 213 | 
            +
                # @param [String] id Required parameter: The ID of the payment link to
         | 
| 214 | 
            +
                # update.
         | 
| 215 | 
            +
                # @param [UpdatePaymentLinkRequest] body Required parameter: An object
         | 
| 216 | 
            +
                # containing the fields to POST for the request.  See the corresponding
         | 
| 217 | 
            +
                # object definition for field details.
         | 
| 218 | 
            +
                # @return [UpdatePaymentLinkResponse Hash] response from the API call
         | 
| 219 | 
            +
                def update_payment_link(id:,
         | 
| 220 | 
            +
                                        body:)
         | 
| 221 | 
            +
                  # Prepare query url.
         | 
| 222 | 
            +
                  _query_builder = config.get_base_uri
         | 
| 223 | 
            +
                  _query_builder << '/v2/online-checkout/payment-links/{id}'
         | 
| 224 | 
            +
                  _query_builder = APIHelper.append_url_with_template_parameters(
         | 
| 225 | 
            +
                    _query_builder,
         | 
| 226 | 
            +
                    'id' => { 'value' => id, 'encode' => true }
         | 
| 227 | 
            +
                  )
         | 
| 228 | 
            +
                  _query_url = APIHelper.clean_url _query_builder
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                  # Prepare headers.
         | 
| 231 | 
            +
                  _headers = {
         | 
| 232 | 
            +
                    'accept' => 'application/json',
         | 
| 233 | 
            +
                    'Content-Type' => 'application/json'
         | 
| 234 | 
            +
                  }
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                  # Prepare and execute HttpRequest.
         | 
| 237 | 
            +
                  _request = config.http_client.put(
         | 
| 238 | 
            +
                    _query_url,
         | 
| 239 | 
            +
                    headers: _headers,
         | 
| 240 | 
            +
                    parameters: body.to_json
         | 
| 241 | 
            +
                  )
         | 
| 242 | 
            +
                  OAuth2.apply(config, _request)
         | 
| 243 | 
            +
                  _response = execute_request(_request)
         | 
| 244 | 
            +
             | 
| 245 | 
            +
                  # Return appropriate response type.
         | 
| 246 | 
            +
                  decoded = APIHelper.json_deserialize(_response.raw_body)
         | 
| 247 | 
            +
                  _errors = APIHelper.map_response(decoded, ['errors'])
         | 
| 248 | 
            +
                  ApiResponse.new(
         | 
| 249 | 
            +
                    _response, data: decoded, errors: _errors
         | 
| 250 | 
            +
                  )
         | 
| 251 | 
            +
                end
         | 
| 50 252 | 
             
              end
         | 
| 51 253 | 
             
            end
         |