You are here

protected function ContextUploader::getApi in TMGMT Translator Smartling 8

Same name and namespace in other branches
  1. 8.2 src/Context/ContextUploader.php \Drupal\tmgmt_smartling\Context\ContextUploader::getApi()

Parameters

bool $override_service_url:

Return value

SmartlingApi

2 calls to ContextUploader::getApi()
ContextUploader::isReadyAcceptContext in src/Context/ContextUploader.php
ContextUploader::uploadContextBody in src/Context/ContextUploader.php

File

src/Context/ContextUploader.php, line 113

Class

ContextUploader

Namespace

Drupal\tmgmt_smartling\Context

Code

protected function getApi($proj_settings, $override_service_url = FALSE) {
  $key = $proj_settings['key'];
  $project_id = $proj_settings['project_id'];
  $api_url = $proj_settings['api_url'];
  $client = \Drupal::getContainer()
    ->get('http_client');
  if ($override_service_url) {
    $smartlingApi = new SmartlingApi($key, $project_id, $client, 'https://api.smartling.com/context-api/v2');
  }
  else {
    $smartlingApi = new SmartlingApi($key, $project_id, $client, $api_url);
  }
  return $smartlingApi;
}