You are here

public function SalesforceAuthProviderPluginBase::getApiEndpoint in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/SalesforceAuthProviderPluginBase.php \Drupal\salesforce\SalesforceAuthProviderPluginBase::getApiEndpoint()
  2. 5.0.x src/SalesforceAuthProviderPluginBase.php \Drupal\salesforce\SalesforceAuthProviderPluginBase::getApiEndpoint()

API Url for this plugin.

Parameters

string $api_type: (optional) Which API for which to retrieve URL, defaults to "rest".

Return value

string The URL.

Overrides SalesforceAuthProviderInterface::getApiEndpoint

File

src/SalesforceAuthProviderPluginBase.php, line 267

Class

SalesforceAuthProviderPluginBase
Shared methods for auth providers.

Namespace

Drupal\salesforce

Code

public function getApiEndpoint($api_type = 'rest') {
  $url =& drupal_static(self::CLASS . __FUNCTION__ . $api_type);
  if (!isset($url)) {
    $identity = $this
      ->getIdentity();
    if (empty($identity)) {
      return FALSE;
    }
    if (is_string($identity)) {
      $url = $identity;
    }
    elseif (isset($identity['urls'][$api_type])) {
      $url = $identity['urls'][$api_type];
    }
    $url = str_replace('{version}', $this
      ->getApiVersion(), $url);
  }
  return $url;
}