Method: BaseCRM::ContactsService#create

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

#create(contact) ⇒ Contact

Create a contact

post ‘/contacts’

Create a new contact A contact may represent a single individual or an organization

Parameters:

  • contact (Contact, Hash)

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

Returns:

  • (Contact)

    The resulting object represting created resource.



58
59
60
61
62
63
64
65
# File 'lib/basecrm/services/contacts_service.rb', line 58

def create(contact)
  validate_type!(contact)

  attributes = sanitize(contact)
  _, _, root = @client.post("/contacts", attributes)

  Contact.new(root[:data])
end