Method: BaseCRM::ContactsService#update

Defined in:
lib/basecrm/services/contacts_service.rb

#update(contact) ⇒ Contact

Update a contact

put ‘/contacts/BaseCRM#id

Updates contact information If the specified contact does not exist, the request will return an error Notice When updating contact tags, you need to provide all tags Any missing tag will be removed from a contact’s tags

Parameters:

  • contact (Contact, Hash)

    Either object of the Contact type or Hash. This object’s attributes describe the object to be updated.

Returns:

  • (Contact)

    The resulting object represting updated resource.



95
96
97
98
99
100
101
102
103
104
# File 'lib/basecrm/services/contacts_service.rb', line 95

def update(contact)
  validate_type!(contact)
  params = extract_params!(contact, :id)
  id = params[:id]

  attributes = sanitize(contact)
  _, _, root = @client.put("/contacts/#{id}", attributes)

  Contact.new(root[:data])
end