Skip to content

Commit acb3f6e

Browse files
refactor: update RecordApiHelper
1 parent bbb162f commit acb3f6e

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

includes/Actions/SmartSuite/RecordApiHelper.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ public function __construct($integrationDetails, $integId, $workspaceId, $apiTok
4242
];
4343
}
4444

45+
public function handleFilterResponse($response)
46+
{
47+
if ($response) {
48+
return $response;
49+
}
50+
51+
return (object) ['error' => wp_sprintf(__('%s plugin is not installed or activate', 'bit-integrations'), 'Bit Integration Pro')];
52+
}
53+
4554
public function createSolution($finalData)
4655
{
4756
if (isset($this->integrationDetails->selectedLogoColor) && !empty($this->integrationDetails->selectedLogoColor)) {
@@ -56,14 +65,14 @@ public function createTable($requestParams)
5665
{
5766
$response = apply_filters('btcbi_smartSuite_create_table', false, $requestParams, $this->workspaceId, $this->apiToken, $this->integrationDetails->selectedSolution);
5867

59-
return handleFilterResponse($response);
68+
return $this->handleFilterResponse($response);
6069
}
6170

6271
public function createRecord($requestParams)
6372
{
6473
$response = apply_filters('btcbi_smartSuite_create_record', false, $requestParams, $this->integrationDetails, $this->workspaceId, $this->apiToken);
6574

66-
return handleFilterResponse($response);
75+
return $this->handleFilterResponse($response);
6776
}
6877

6978
public function generateReqDataFromFieldMap($data, $fieldMap)
@@ -111,15 +120,3 @@ public function execute($fieldValues, $fieldMap, $actionName)
111120
return $apiResponse;
112121
}
113122
}
114-
function checkIsAValidDate($myDateString)
115-
{
116-
return (bool) strtotime($myDateString);
117-
}
118-
function handleFilterResponse($response)
119-
{
120-
if ($response) {
121-
return $response;
122-
}
123-
124-
return (object) ['error' => wp_sprintf(__('%s plugin is not installed or activate', 'bit-integrations'), 'Bit Integration Pro')];
125-
}

0 commit comments

Comments
 (0)