Class: Square::LocationCustomAttributesApi
- Defined in:
- lib/square/api/location_custom_attributes_api.rb
Overview
LocationCustomAttributesApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#bulk_delete_location_custom_attributes(body:) ⇒ ApiResponse
Deletes [custom attributes]($m/CustomAttribute) for locations as a bulk operation.
-
#bulk_upsert_location_custom_attributes(body:) ⇒ ApiResponse
Creates or updates [custom attributes]($m/CustomAttribute) for locations as a bulk operation.
-
#create_location_custom_attribute_definition(body:) ⇒ ApiResponse
Creates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account.
-
#delete_location_custom_attribute(location_id:, key:) ⇒ ApiResponse
Deletes a [custom attribute]($m/CustomAttribute) associated with a location.
-
#delete_location_custom_attribute_definition(key:) ⇒ ApiResponse
Deletes a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account.
-
#list_location_custom_attribute_definitions(visibility_filter: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Lists the location-related [custom attribute definitions]($m/CustomAttributeDefinition) that belong to a Square seller account.
-
#list_location_custom_attributes(location_id:, visibility_filter: nil, limit: nil, cursor: nil, with_definitions: false) ⇒ ApiResponse
Lists the [custom attributes]($m/CustomAttribute) associated with a location.
-
#retrieve_location_custom_attribute(location_id:, key:, with_definition: false, version: nil) ⇒ ApiResponse
Retrieves a [custom attribute]($m/CustomAttribute) associated with a location.
-
#retrieve_location_custom_attribute_definition(key:, version: nil) ⇒ ApiResponse
Retrieves a location-related [custom attribute definition]($m/CustomAttributeDefinition) from a Square seller account.
-
#update_location_custom_attribute_definition(key:, body:) ⇒ ApiResponse
Updates a location-related [custom attribute definition]($m/CustomAttributeDefinition) for a Square seller account.
-
#upsert_location_custom_attribute(location_id:, key:, body:) ⇒ ApiResponse
Creates or updates a [custom attribute]($m/CustomAttribute) for a location.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#bulk_delete_location_custom_attributes(body:) ⇒ ApiResponse
Deletes [custom attributes]($m/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`. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 179 def bulk_delete_location_custom_attributes(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/custom-attributes/bulk-delete', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#bulk_upsert_location_custom_attributes(body:) ⇒ ApiResponse
Creates or updates [custom attributes]($m/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]($e/LocationCustomAttributes/Crea teLocationCustomAttributeDefinition) 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`. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 219 def bulk_upsert_location_custom_attributes(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/custom-attributes/bulk-upsert', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_location_custom_attribute_definition(body:) ⇒ ApiResponse
Creates a location-related [custom attribute definition]($m/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]($e/LocationCustomAttributes/UpsertLocation CustomAttribute) or [BulkUpsertLocationCustomAttributes]($e/LocationCustomAttributes/BulkUpser tLocationCustomAttributes) to set the custom attribute for locations. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 63 def create_location_custom_attribute_definition(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/custom-attribute-definitions', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_location_custom_attribute(location_id:, key:) ⇒ ApiResponse
Deletes a [custom attribute]($m/CustomAttribute) associated with a location. To delete a custom attribute owned by another application, the ‘visibility` setting must be `VISIBILITY_READ_WRITE_VALUES`. [location](entity:Location). delete. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key.
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 305 def delete_location_custom_attribute(location_id:, key:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/locations/{location_id}/custom-attributes/{key}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(key, key: 'key') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_location_custom_attribute_definition(key:) ⇒ ApiResponse
Deletes a location-related [custom attribute definition]($m/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. definition to delete.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 89 def delete_location_custom_attribute_definition(key:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/locations/custom-attribute-definitions/{key}', 'default') .template_param(new_parameter(key, key: 'key') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_location_custom_attribute_definitions(visibility_filter: nil, limit: nil, cursor: nil) ⇒ ApiResponse
Lists the location-related [custom attribute definitions]($m/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`. the `CustomAttributeDefinition` results by their `visibility` values. to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination).
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 28 def list_location_custom_attribute_definitions(visibility_filter: nil, limit: nil, cursor: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/custom-attribute-definitions', 'default') .query_param(new_parameter(visibility_filter, key: 'visibility_filter')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_location_custom_attributes(location_id:, visibility_filter: nil, limit: nil, cursor: nil, with_definitions: false) ⇒ ApiResponse
Lists the [custom attributes]($m/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`. [location](entity:Location). the `CustomAttributeDefinition` results by their `visibility` values. to return in a single paged response. This limit is advisory. The response might contain more or fewer results. The minimum value is 1 and the maximum value is 100. The default value is 20. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). paged response from the previous call to this endpoint. Provide this cursor to retrieve the next page of results for your original request. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of each custom attribute. Set this parameter to `true` to get the name and description of each custom attribute, information about the data type, or other definition details. The default value is `false`.
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 269 def list_location_custom_attributes(location_id:, visibility_filter: nil, limit: nil, cursor: nil, with_definitions: false) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/{location_id}/custom-attributes', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .query_param(new_parameter(visibility_filter, key: 'visibility_filter')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(with_definitions, key: 'with_definitions')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_location_custom_attribute(location_id:, key:, with_definition: false, version: nil) ⇒ ApiResponse
Retrieves a [custom attribute]($m/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`. [location](entity:Location). retrieve. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. Indicates whether to return the [custom attribute definition](entity:CustomAttributeDefinition) in the `definition` field of the custom attribute. Set this parameter to `true` to get the name and description of the custom attribute, information about the data type, or other definition details. The default value is `false`. custom attribute, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a `BAD_REQUEST` error.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 351 def retrieve_location_custom_attribute(location_id:, key:, with_definition: false, version: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/{location_id}/custom-attributes/{key}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(key, key: 'key') .should_encode(true)) .query_param(new_parameter(with_definition, key: 'with_definition')) .query_param(new_parameter(version, key: 'version')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_location_custom_attribute_definition(key:, version: nil) ⇒ ApiResponse
Retrieves a location-related [custom attribute definition]($m/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`. definition to retrieve. If the requesting application is not the definition owner, you must use the qualified key. custom attribute definition, which is used for strongly consistent reads to guarantee that you receive the most up-to-date data. When included in the request, Square returns the specified version or a higher version if one exists. If the specified version is higher than the current version, Square returns a `BAD_REQUEST` error.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 120 def retrieve_location_custom_attribute_definition(key:, version: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/locations/custom-attribute-definitions/{key}', 'default') .template_param(new_parameter(key, key: 'key') .should_encode(true)) .query_param(new_parameter(version, key: 'version')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_location_custom_attribute_definition(key:, body:) ⇒ ApiResponse
Updates a location-related [custom attribute definition]($m/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. definition to update. parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 150 def update_location_custom_attribute_definition(key:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/locations/custom-attribute-definitions/{key}', 'default') .template_param(new_parameter(key, key: 'key') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#upsert_location_custom_attribute(location_id:, key:, body:) ⇒ ApiResponse
Creates or updates a [custom attribute]($m/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]($e/LocationCustomAttributes/Crea teLocationCustomAttributeDefinition) endpoint. To create or update a custom attribute owned by another application, the ‘visibility` setting must be `VISIBILITY_READ_WRITE_VALUES`. [location](entity:Location). create or update. This key must match the `key` of a custom attribute definition in the Square seller account. If the requesting application is not the definition owner, you must use the qualified key. object containing the fields to POST for the request. See the corresponding object definition for field details.
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/square/api/location_custom_attributes_api.rb', line 396 def upsert_location_custom_attribute(location_id:, key:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/{location_id}/custom-attributes/{key}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .template_param(new_parameter(key, key: 'key') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |