diff --git a/src/Resources/Contacts.php b/src/Resources/Contacts.php index 7e49daed..33a1877a 100644 --- a/src/Resources/Contacts.php +++ b/src/Resources/Contacts.php @@ -20,9 +20,11 @@ public function create(array $properties) { $endpoint = 'https://api.hubapi.com/contacts/v1/contact'; - $options['json'] = ['properties' => $properties]; - - return $this->client->request('post', $endpoint, $options); + return $this->client->request( + 'post', + $endpoint, + ['json' => ['properties' => $properties]] + ); } /** @@ -39,9 +41,11 @@ public function update($id, array $properties) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/vid/{$id}/profile"; - $options['json'] = ['properties' => $properties]; - - return $this->client->request('post', $endpoint, $options); + return $this->client->request( + 'post', + $endpoint, + ['json' => ['properties' => $properties]] + ); } /** @@ -58,9 +62,11 @@ public function updateByEmail($email, array $properties) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile"; - $options['json'] = ['properties' => $properties]; - - return $this->client->request('post', $endpoint, $options); + return $this->client->request( + 'post', + $endpoint, + ['json' => ['properties' => $properties]] + ); } /** @@ -77,9 +83,11 @@ public function createOrUpdate($email, array $properties = []) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/{$email}"; - $options['json'] = ['properties' => $properties]; - - return $this->client->request('post', $endpoint, $options); + return $this->client->request( + 'post', + $endpoint, + ['json' => ['properties' => $properties]] + ); } /** @@ -96,11 +104,12 @@ public function createOrUpdateBatch(array $contacts, array $params = []) { $endpoint = 'https://api.hubapi.com/contacts/v1/contact/batch'; - $queryString = build_query_string($params); - - $options['json'] = $contacts; - - return $this->client->request('post', $endpoint, $options, $queryString); + return $this->client->request( + 'post', + $endpoint, + ['json' => $contacts], + build_query_string($params) + ); } /** @@ -139,9 +148,12 @@ public function all(array $params = []) { $endpoint = 'https://api.hubapi.com/contacts/v1/lists/all/contacts/all'; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -160,9 +172,12 @@ public function recent(array $params = []) { $endpoint = 'https://api.hubapi.com/contacts/v1/lists/recently_updated/contacts/recent'; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -181,9 +196,12 @@ public function recentNew(array $params = []) { $endpoint = 'https://api.hubapi.com/contacts/v1/lists/all/contacts/recent'; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -201,9 +219,12 @@ public function getById($id, array $params = []) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/vid/{$id}/profile"; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -227,9 +248,12 @@ public function getBatchByIds(array $vids, array $params = []) $params['vid'] = $vids; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -247,9 +271,12 @@ public function getByEmail($email, array $params = []) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/email/{$email}/profile"; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -272,9 +299,12 @@ public function getBatchByEmails($emails, array $params = []) $params['email'] = $emails; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -292,9 +322,12 @@ public function getByToken($utk, array $params = []) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/utk/{$utk}/profile"; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -321,9 +354,12 @@ public function getBatchByTokens(array $utks, array $params = []) $params['utk'] = $utks; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -348,9 +384,12 @@ public function search($query, array $params = []) $params['q'] = $query; - $queryString = build_query_string($params); - - return $this->client->request('get', $endpoint, [], $queryString); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } /** @@ -381,9 +420,11 @@ public function merge($id, $vidToMerge) { $endpoint = "https://api.hubapi.com/contacts/v1/contact/merge-vids/{$id}/"; - $options['json'] = ['vidToMerge' => $vidToMerge]; - - return $this->client->request('post', $endpoint, $options); + return $this->client->request( + 'post', + $endpoint, + ['json' => ['vidToMerge' => $vidToMerge]] + ); } /** @@ -397,6 +438,11 @@ public function getLifecycleStageMetrics(array $params = []) { $endpoint = 'https://api.hubapi.com/contacts/v1/contacts/statistics'; - return $this->client->request('get', $endpoint, [], build_query_string($params)); + return $this->client->request( + 'get', + $endpoint, + [], + build_query_string($params) + ); } }