You are here

public function RestClient::isInit in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::isInit()

Check if the client is ready to perform API calls.

TRUE indicates that the various dependencies are in place to initiate an API call. It does NOT indicate that the API call will be successful, or return a 200 status.

Return value

bool FALSE if the client is not initialized. TRUE otherwise.

Overrides RestClientInterface::isInit

1 call to RestClient::isInit()
RestClient::apiCall in src/Rest/RestClient.php
Make a call to the Salesforce REST API.
1 method overrides RestClient::isInit()
TestRestClient::isInit in src/Tests/TestRestClient.php
Check if the client is ready to perform API calls.

File

src/Rest/RestClient.php, line 168

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

public function isInit() {
  if (!$this->authProvider || !$this->authManager) {
    return FALSE;
  }

  // If authToken is not set, try refreshing it before failing init.
  if (!$this->authToken) {
    $this->authToken = $this->authManager
      ->refreshToken();
    return isset($this->authToken);
  }
  return TRUE;
}