You are here

function drush_salesforce_sf_rest_version in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 salesforce.drush.inc \drush_salesforce_sf_rest_version()
  2. 8.3 salesforce.drush.inc \drush_salesforce_sf_rest_version()
  3. 7.3 salesforce.drush.inc \drush_salesforce_sf_rest_version()

Displays information about the REST API version the site is using.

File

./salesforce.drush.inc, line 257
Drush integration for Salesforce.

Code

function drush_salesforce_sf_rest_version() {
  _drush_salesforce_deprecated();
  $salesforce = \Drupal::service('salesforce.client');
  $version_id = $salesforce
    ->getApiVersion();
  $versions = $salesforce
    ->getVersions();
  $version = $versions[$version_id];
  $latest = array_pop($versions);
  foreach ($version as $key => $value) {
    $rows[] = [
      $key,
      $value,
    ];
  }
  $rows[] = [
    'login url',
    $salesforce
      ->getLoginUrl(),
  ];
  $rows[] = [
    'latest version',
    strcmp($version_id, $latest['version']) ? $latest['version'] : 'Yes',
  ];
  drush_print_table($rows, TRUE);
}