change $organisationIds to $organisationId
This commit is contained in:
parent
f9cbe9db6c
commit
81bd4bff44
1 changed files with 6 additions and 5 deletions
|
@ -16,7 +16,7 @@ class TwingleApiCall {
|
||||||
|
|
||||||
private $protocol = 'https://';
|
private $protocol = 'https://';
|
||||||
|
|
||||||
private $organisationIds;
|
private $organisationId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TwingleApiCall constructor.
|
* TwingleApiCall constructor.
|
||||||
|
@ -28,6 +28,7 @@ class TwingleApiCall {
|
||||||
public function __construct($apiKey) {
|
public function __construct($apiKey) {
|
||||||
$this->apiKey = $apiKey;
|
$this->apiKey = $apiKey;
|
||||||
|
|
||||||
|
// Get organisation id
|
||||||
$curl = curl_init($this->protocol . 'organisation' . $this->baseUrl);
|
$curl = curl_init($this->protocol . 'organisation' . $this->baseUrl);
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, [
|
curl_setopt($curl, CURLOPT_HTTPHEADER, [
|
||||||
|
@ -42,7 +43,7 @@ class TwingleApiCall {
|
||||||
throw new \API_Exception("Twingle API call failed");
|
throw new \API_Exception("Twingle API call failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->organisationIds = array_column($response, 'id');
|
$this->organisationId = array_column($response, 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +58,7 @@ class TwingleApiCall {
|
||||||
*/
|
*/
|
||||||
public function getProject($projectId = NULL) {
|
public function getProject($projectId = NULL) {
|
||||||
$response = [];
|
$response = [];
|
||||||
foreach ($this->organisationIds as $organisationId) {
|
foreach ($this->organisationId as $organisationId) {
|
||||||
$url = empty($projectId)
|
$url = empty($projectId)
|
||||||
? $this->protocol . 'project' . $this->baseUrl . 'by-organisation/' . $organisationId
|
? $this->protocol . 'project' . $this->baseUrl . 'by-organisation/' . $organisationId
|
||||||
: $this->protocol . 'project' . $this->baseUrl . $projectId;
|
: $this->protocol . 'project' . $this->baseUrl . $projectId;
|
||||||
|
@ -146,8 +147,8 @@ class TwingleApiCall {
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getOrganisationIds() {
|
public function getOrganisationId() {
|
||||||
return $this->organisationIds;
|
return $this->organisationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue