/** * Create REST client * * @param Transport $transportEntity * @return RestClientInterface * @throws InvalidConfigurationException */ protected function createRestClient(Transport $transportEntity) { $settings = $transportEntity->getSettingsBag(); $baseUrl = $this->getClientBaseUrl($settings); $clientOptions = $this->getClientOptions($settings); return $this->getClientFactory()->createRestClient($baseUrl, $clientOptions); }
/** * {@inheritdoc} */ public function init(Transport $transportEntity) { $apiKey = $transportEntity->getSettingsBag()->get('apiKey'); if (!$apiKey) { throw new RequiredOptionException('apiKey'); } $this->client = $this->mailChimpClientFactory->create($apiKey); }
/** * {@inheritdoc} */ public function init(Transport $transportEntity) { $token = $transportEntity->getSettingsBag()->get('token'); if (empty($token)) { throw new InvalidConfigurationException('GitHub API token isn\'t set.'); } $this->gitHubOrganization = $transportEntity->getSettingsBag()->get('organization'); if (empty($this->gitHubOrganization)) { throw new InvalidConfigurationException('GitHub organization isn\'t set.'); } $this->gitHubRepo = $transportEntity->getSettingsBag()->get('repo'); if (empty($this->gitHubRepo)) { throw new InvalidConfigurationException('GitHub repo isn\'t set.'); } $this->client = $this->gitHubClientFactory->createClient(); $this->client->authenticate($token, null, Client::AUTH_URL_TOKEN); return $this->client; }
/** * {@inheritdoc} */ public function init(Transport $transportEntity) { $this->resetAttemptCount(); $this->settings = $transportEntity->getSettingsBag(); $wsdlUrl = $this->settings->get('wsdl_url'); if (!$wsdlUrl) { throw new InvalidConfigurationException("SOAP Transport require 'wsdl_url' option to be defined."); } $this->client = $this->getSoapClient($wsdlUrl); }
public function init(Transport $transportEntity) { $this->settings = $transportEntity->getSettingsBag(); $this->client = new GRClient($this->settings->get('api_url')); }