You are here

public function DataApi::__construct in Acquia Lift Connector 8

Constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory service.

\GuzzleHttp\ClientInterface $http_client: A Guzzle client interface.

\Drupal\Core\Routing\RequestContext $context: The current request.

Throws

\Drupal\acquia_lift\Exception\DataApiCredentialException

File

src/Service/Api/DataApi.php, line 71
Contains \Drupal\acquia_lift\Service\Api\DataApi.

Class

DataApi

Namespace

Drupal\acquia_lift\Service\Api

Code

public function __construct(ConfigFactoryInterface $config_factory, ClientInterface $http_client, RequestContext $context) {
  $this->httpClient = $http_client;
  $this->context = $context;
  $this->logger = \Drupal::logger('acquia_lift');
  $this->credentialSettings = $config_factory
    ->get('acquia_lift.settings')
    ->get('credential');
  if (SettingsHelper::isInvalidCredential($this->credentialSettings)) {
    throw new DataApiCredentialException('Acquia Lift credential is invalid.');
  }
}