You are here

protected function Fastly::getActiveVersion in Fastly 7.2

Same name and namespace in other branches
  1. 7 fastly.api.inc \Fastly::getActiveVersion()

Gets active version number for the current service.

2 calls to Fastly::getActiveVersion()
Fastly::getSettings in ./fastly.api.inc
Gets the settings for a version.
Fastly::updateSettings in ./fastly.api.inc
Updates the settings for a version.

File

./fastly.api.inc, line 208
Contains Faslt class that handles API calls to the Fastly service.

Class

Fastly
Fastly API for Drupal.

Code

protected function getActiveVersion() {
  $service = json_decode($this
    ->query('service/' . $this->service_id)->data);
  if (is_object($service) && isset($service->versions)) {
    foreach ($service->versions as $version) {
      if ($version->active) {
        return $version->number;
      }
    }
  }
  return NULL;
}