diff --git a/README.md b/README.md index 39af689..7acab69 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ $client->contacts->create([ ]); /** Update a contact */ -$client->contacts->update([ +$client->contacts->update("570680a8a1bcbca8a90001b9", [ "email" => "test@example.com", "custom_attributes" => ['foo' => 'bar'] ]); diff --git a/src/IntercomContacts.php b/src/IntercomContacts.php index 5766e29..7cfc073 100644 --- a/src/IntercomContacts.php +++ b/src/IntercomContacts.php @@ -24,13 +24,15 @@ public function create(array $options) * Updates a Contact. * * @see https://developers.intercom.com/intercom-api-reference/reference#update-contact + * @param string $id * @param array $options * @return stdClass * @throws Exception */ - public function update(array $options) + public function update(string $id, array $options) { - return $this->client->put("contacts", $options); + $path = $this->contactPath($id); + return $this->client->put($path, $options); } /** diff --git a/test/IntercomContactsTest.php b/test/IntercomContactsTest.php index e623daf..9d1578d 100644 --- a/test/IntercomContactsTest.php +++ b/test/IntercomContactsTest.php @@ -20,7 +20,7 @@ public function testContactUpdate() $this->client->method('put')->willReturn('foo'); $contacts = new IntercomContacts($this->client); - $this->assertSame('foo', $contacts->update([])); + $this->assertSame('foo', $contacts->update('', [])); } public function testContactsGet()