module Square::APIOperations::Create

Public Instance Methods

create(*args) click to toggle source

Create resource.

@param parent_id [String] ID of the 'parent' to update. Optional. @param params [Hash] Payload. Optional.

@return [DataType]

# File lib/square/api_operations/create.rb, line 10
def create(*args)
  if args.count == 1
    parent_id = nil
    params = args[0]
  elsif args.count == 2
    parent_id = args[0]
    params = args[1]
  end

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

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