You are here

public function AcquiaLiftAPI::pingTest in Acquia Lift Connector 7

Tests the connection to Acquia Lift.

Return value

bool TRUE if the connection succeeded, FALSE otherwise.

File

includes/acquia_lift.classes.inc, line 404
Provides an agent type for Acquia Lift

Class

AcquiaLiftAPI
@file Provides an agent type for Acquia Lift

Code

public function pingTest() {

  // We use the list-agents endpoint for our ping test, in the absence of
  // an endpoint specifically provided for this purpose.
  $url = $this
    ->generateEndpoint("/list-agents");
  $admin_response = $this
    ->httpClient()
    ->get($url, array(
    'Accept' => 'application/json',
  ));
  $url = $this
    ->generateEndpoint('/ping-test-agent/expire', FALSE);
  $runtime_response = $this
    ->httpClient()
    ->post($url, array(
    'Accept' => 'application/json',
  ));
  return $admin_response->code == 200 && $runtime_response->code != 403;
}