You are here

public function SalesforceIdentity::getUrl in Salesforce Suite 5.0.x

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

Given API type and optional API version, return the API url.

Parameters

string $api_type: The api type, e.g. rest, partner, meta.

string $api_version: If given, replace {version} placeholder. Otherwise, return the raw URL.

Return value

string The API url.

Overrides SalesforceIdentityInterface::getUrl

File

src/Rest/SalesforceIdentity.php, line 50

Class

SalesforceIdentity

Namespace

Drupal\salesforce\Rest

Code

public function getUrl($api_type, $api_version = NULL) {
  if (empty($this->data['urls'][$api_type])) {
    return '';
  }
  $url = $this->data['urls'][$api_type];
  return $api_version ? str_replace('{version}', $api_version, $url) : $url;
}