Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgrayson authored and github-actions[bot] committed Jun 3, 2024
1 parent 2f6c9cd commit 8ad4911
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Models/HubspotContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Tapp\LaravelHubspot\Models;

use HubSpot\Client\Crm\Associations\V4\ApiException as AssociationsApiException;
use HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec;
use HubSpot\Client\Crm\Companies\Model\PublicObjectSearchRequest as CompanySearch;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectInput as CompanyObject;
use HubSpot\Client\Crm\Contacts\ApiException;
Expand All @@ -11,8 +13,6 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
use Tapp\LaravelHubspot\Facades\Hubspot;
use HubSpot\Client\Crm\Associations\V4\ApiException as AssociationsApiException;
use HubSpot\Client\Crm\Associations\V4\Model\AssociationSpec;

trait HubspotContact
{
Expand Down Expand Up @@ -71,11 +71,11 @@ public static function updateOrCreateHubspotContact($model)
try {
// TODO get by ID is unreliable (404 with api but works with web UI)
// if ($model->hubspot_id) {
// $hubspotContact = Hubspot::crm()->contacts()->basicApi()->getById($model->hubspot_id, null, null, null, false, 'id');
// $hubspotContact = Hubspot::crm()->contacts()->basicApi()->getById($model->hubspot_id, null, null, null, false, 'id');
// } else {
$hubspotContact = Hubspot::crm()->contacts()->basicApi()->getById($model->email, null, null, null, false, 'email');
$hubspotContact = Hubspot::crm()->contacts()->basicApi()->getById($model->email, null, null, null, false, 'email');

$model->hubspot_id = $hubspotContact['id'];
$model->hubspot_id = $hubspotContact['id'];
// }
} catch (ApiException $e) {
// catch 404 error
Expand Down Expand Up @@ -157,13 +157,13 @@ public static function associateCompanyWithContact(string $companyId, string $co
{
$associationSpec = new AssociationSpec([
'association_category' => 'HUBSPOT_DEFINED',
'association_type_id' => 1
'association_type_id' => 1,
]);

try {
$apiResponse = Hubspot::crm()->associations()->v4()->basicApi()->create('contact', $contactId, 'company', $companyId, [$associationSpec]);
} catch (AssociationsApiException $e) {
echo "Exception when calling basic_api->create: ", $e->getMessage();
echo 'Exception when calling basic_api->create: ', $e->getMessage();
}
}
}

0 comments on commit 8ad4911

Please sign in to comment.