public function CircleCiManager::retrieveLatestBuildsFromCircleciForEnvironment in Build Hooks 3.x
Same name and namespace in other branches
- 8.2 modules/build_hooks_circleci/src/CircleCiManager.php \Drupal\build_hooks_circleci\CircleCiManager::retrieveLatestBuildsFromCircleciForEnvironment()
Get the latest builds from Circle CI for and environment.
Parameters
array $settings: The plugin settings array.
int $limit: Number of desired builds to retrieve.
Return value
array An array with info about the builds.
Throws
\GuzzleHttp\Exception\GuzzleException
Overrides CircleCiManagerInterface::retrieveLatestBuildsFromCircleciForEnvironment
File
- modules/
build_hooks_circleci/ src/ CircleCiManager.php, line 114
Class
- CircleCiManager
- Defines a service for managing Circle CI deployments.
Namespace
Drupal\build_hooks_circleciCode
public function retrieveLatestBuildsFromCircleciForEnvironment(array $settings, $limit = 1) {
$url = $this
->buildCircleCiApiRetrieveBuildsUrl($settings, $limit);
$options = [
'headers' => [
'Accept' => 'application/json',
],
];
$response = $this->httpClient
->request('GET', $url, $options);
$payload = json_decode($response
->getBody()
->getContents(), TRUE);
return $payload;
}