get project options via API call

This commit is contained in:
Marc Michalsky forumZFD 2020-10-07 15:16:23 +02:00
parent 0205b59c30
commit 0053ecc30f
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -69,6 +69,18 @@ class TwingleApiCall {
return $response;
}
public function getProjectOptions(int $projectId) {
$response = [];
foreach ($this->organisationId as $organisationId) {
$url = $this->protocol . 'project' . $this->baseUrl . $projectId .
'/options';
$response = array_merge($this->curlGet($url));
}
return $response;
}
/**
*
* Returns all Events for the given $projectId
@ -122,7 +134,15 @@ class TwingleApiCall {
// If $values is an array
if (is_array($values)) {
$project = new TwingleProject($values, TwingleProject::TWINGLE);
// Get project options
$project_options = $this->getProjectOptions($values['id']);
// Instantiate TwingleProject
$project = new TwingleProject(
$values,
$project_options,
TwingleProject::TWINGLE
);
// Check if the TwingleProject campaign already exists
if (!$project->exists()) {