lib/square/api/customers_api.rb
def update_customer(customer_id:,
                        body:)
      # Prepare query url.
      _query_builder = config.get_base_uri
      _query_builder << '/v2/customers/{customer_id}'
      _query_builder = APIHelper.append_url_with_template_parameters(
        _query_builder,
        'customer_id' => { 'value' => customer_id, 'encode' => true }
      )
      _query_url = APIHelper.clean_url _query_builder

      # Prepare headers.
      _headers = {
        'accept' => 'application/json',
        'content-type' => 'application/json; charset=utf-8'
      }

      # Prepare and execute HttpRequest.
      _request = config.http_client.put(
        _query_url,
        headers: _headers,
        parameters: body.to_json
      )
      OAuth2.apply(config, _request)
      _response = execute_request(_request)

      # Return appropriate response type.
      decoded = APIHelper.json_deserialize(_response.raw_body)
      _errors = APIHelper.map_response(decoded, ['errors'])
      ApiResponse.new(
        _response, data: decoded, errors: _errors
      )
    end
# Updates a customer profile. To change an attribute, specify the new value.
# To remove an attribute, specify the value as an empty string or empty
# object.
# As a best practice, you should include the `version` field in the request
# to enable [optimistic
# concurrency](https://developer.squareup.com/docs/working-with-apis/optimis
# tic-concurrency) control. The value must be set to the current version of
# the customer profile.
# To update a customer profile that was created by merging existing
# profiles, you must use the ID of the newly created profile.
# You cannot use this endpoint to change cards on file. To make changes, use
# the [Cards API]($e/Cards) or [Gift Cards API]($e/GiftCards).
# @param [String] customer_id Required parameter: The ID of the customer to
# update.
# @param [UpdateCustomerRequest] body Required parameter: An object
# containing the fields to POST for the request.  See the corresponding
# object definition for field details.
# @return [UpdateCustomerResponse Hash] response from the API call
Updates a customer profile. To change an attribute, specify the new value.
To remove an attribute, specify the value as an empty string or empty
object.
Updates a customer profile . To change an attribute specify the new value . To remove an attribute specify the value as an empty string or empty object .
def update_customer(customer_id:,
                        body:)
      _query_builder = config.get_base_uri
      _query_builder << '/v2/customers/{customer_id}'
      _query_builder = APIHelper.append_url_with_template_parameters(
        _query_builder,
        'customer_id' => { 'value' => customer_id, 'encode' => true }
      )
      _query_url = APIHelper.clean_url _query_builder
      _headers = {
        'accept' => 'application/json',
        'content-type' => 'application/json; charset=utf-8'
      }
      _request = config.http_client.put(
        _query_url,
        headers: _headers,
        parameters: body.to_json
      )
      OAuth2.apply(config, _request)
      _response = execute_request(_request)
      decoded = APIHelper.json_deserialize(_response.raw_body)
      _errors = APIHelper.map_response(decoded, ['errors'])
      ApiResponse.new(
        _response, data: decoded, errors: _errors
      )
    end
def update_customer ( customer_id : , body : ) _query_builder = config . get_base_uri _query_builder << '/v2/customers/{customer_id}' _query_builder = APIHelper . append_url_with_template_parameters ( _query_builder , 'customer_id' => { 'value' => customer_id , 'encode' => true } ) _query_url = APIHelper . clean_url _query_builder _headers = { 'accept' => 'application/json' , 'content-type' => 'application/json; charset=utf-8' } _request = config . http_client . put ( _query_url , headers : _headers , parameters : body . to_json ) OAuth2 . apply ( config , _request ) _response = execute_request ( _request ) decoded = APIHelper . json_deserialize ( _response . raw_body ) _errors = APIHelper . map_response ( decoded , [ 'errors' ] ) ApiResponse . new ( _response , data : decoded , errors : _errors ) end
Updates a customer profile.
Updates a customer profile .
# Prepare query url. # Prepare headers. # Prepare and execute HttpRequest. # Return appropriate response type.
response from the API call
response from the API call
UpdateCustomerResponse Hash
customer_id
body
body Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
body Required parameter : An object containing the fields to POST for the request . See the corresponding object definition for field details .