diff --git a/composer.lock b/composer.lock index 40fa48df2aea14620eee04a1f7063de3b66583f6..d56df7afd28417b3d979686d54451d2e3162c3b5 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "jards/eventsapiclient", - "version": "v2.1", + "version": "v2.2", "source": { "type": "git", "url": "https://github.com/CarstenKarbach/EventsAPIClient.git", - "reference": "884557aea5a532a28340b4ae31b1b82992eb89e3" + "reference": "69d8a58854ea6a7cd822a568ba3b6aab70719f7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarstenKarbach/EventsAPIClient/zipball/884557aea5a532a28340b4ae31b1b82992eb89e3", - "reference": "884557aea5a532a28340b4ae31b1b82992eb89e3", + "url": "https://api.github.com/repos/CarstenKarbach/EventsAPIClient/zipball/69d8a58854ea6a7cd822a568ba3b6aab70719f7d", + "reference": "69d8a58854ea6a7cd822a568ba3b6aab70719f7d", "shasum": "" }, "require": { @@ -60,10 +60,10 @@ "swagger" ], "support": { - "source": "https://github.com/CarstenKarbach/EventsAPIClient/tree/v2.1", + "source": "https://github.com/CarstenKarbach/EventsAPIClient/tree/v2.2", "issues": "https://github.com/CarstenKarbach/EventsAPIClient/issues" }, - "time": "2017-10-29T15:19:25+00:00" + "time": "2017-11-06T10:22:24+00:00" }, { "name": "phpmailer/phpmailer", diff --git a/lib/EventManagement.php b/lib/EventManagement.php index 4b215fa697c15c68a006cb041783316fdce8485d..c8f404c18635057dabaeaa70be688e19a2666111 100644 --- a/lib/EventManagement.php +++ b/lib/EventManagement.php @@ -160,15 +160,28 @@ class EventManagement{ * @param string $name name of the event * @param string $description description of the event * @param string $baseURL the root URL of the event receiver REST API + * @param string $certFile path to certificate file to use or null to call URL without certificate + * @param string $certKey path to certificate key file, null to avoid usage of key + * @param string $certPassphrase path to passphrase file for key file, null for no passphrase * * @return boolean true on success, false on error */ - public function sendEvent($name, $description, $baseURL='http://localhost/myapps/EventsAPI/rest/events'){ + public function sendEvent($name, $description, $baseURL='http://localhost/myapps/EventsAPI/rest/events', $certFile = null, $certKey = null, $certPassphrase = null){ date_default_timezone_set ( 'Europe/Amsterdam' ); $apiClient = new \Swagger\Client\ApiClient (); $apiClient->getConfig ()->setHost ( $baseURL ); + if(! empty($certFile)){ + $apiClient->getConfig ()->setCertificate($certFile); + } + if(! empty($certKey)){ + $apiClient->getConfig ()->setCertificateKey($certKey); + } + if(! empty($certPassphrase)){ + $apiClient->getConfig ()->setCertificatePassphrase($certPassphrase); + } + $eventsApi = new EventsApi($apiClient); $event = new Event();