Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Customerio/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function createCustomer($id, $email, $attributes=array())
return $this->request->authenticate($this->siteId, $this->apiSecret)->customer($id, $email, $attributes);
}

public function updateCustomer($id, $email, $attributes=array())
public function updateCustomer($id, $email=null, $attributes=array())
{
return $this->createCustomer($id, $email, $attributes);
}
Expand Down
13 changes: 8 additions & 5 deletions src/Customerio/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public function __construct($client=null)
*/
public function customer($id, $email, $attributes)
{
$body = array_merge(array('email' => $email), $attributes);
if (is_null($email)) {
$body = $attributes;
} else {
$body = array_merge(array('email' => $email), $attributes);
}

try {
$response = $this->client->put('/api/v1/customers/'.$id, array(
Expand Down Expand Up @@ -183,10 +187,9 @@ public function authenticate($apiKey, $apiSecret)
*/
protected function parseData(array $data)
{
if (empty($data))
{
$data = new stdClass();
}
if (empty($data)) {
$data = new stdClass();
}

return array('data' => $data);
}
Expand Down