Module: Square::APIOperations::Update

Included in:
Category, Discount, Fee, Item, Variation, Webhook
Defined in:
lib/square/api_operations/update.rb

Instance Method Summary collapse

Instance Method Details

#update(*args, params) ⇒ Square::DataType

Update a resource.

Parameters:

  • id (String)

    ID of the resource to update.

  • parent_id (String)

    ID of the ‘parent’ to update. Optional.

  • params (Hash)

    Payload. Optional.

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/square/api_operations/update.rb', line 11

def update(*args, params)
  id, parent_id = args

  response = Square.make_request(
    method: 'PUT',
    endpoint: self.generate_endpoint_url(id, parent_id),
    payload: params
  )

  response = Square.parse_response(response)
  @data_type.new(response)
end