Skip to content

Commit 4adf985

Browse files
author
pyranhax
authored
Merge pull request #1 from pyranhax/pyranhax-patch-1
Added delete function
2 parents f98d20f + 7b0d621 commit 4adf985

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

factories/ContactFactory.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,15 @@ public static function create($name, $phoneNumber, $emailAddress)
282282

283283
return new Contact($contactDetails);
284284
}
285+
286+
public static function delete(Contact $toDelete)
287+
{
288+
$client = GoogleHelper::getClient();
289+
290+
$req = new \Google_Http_Request($toDelete->editURL);
291+
$req->setRequestHeaders(array('content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
292+
$req->setRequestMethod('DELETE');
293+
294+
$client->getAuth()->authenticatedRequest($req);
295+
}
285296
}

0 commit comments

Comments
 (0)