From 29be81839f07d65e1686d522b562efba9f01e443 Mon Sep 17 00:00:00 2001 From: Fabian Mielke Date: Fri, 23 Oct 2015 14:37:39 +0200 Subject: [PATCH] externalCheckSum (Attachment) available Fill the externalCheckSum for Attachments for a better synchronization handling. --- .../Immobilienscout/Immobilienscout.php | 3 ++- Immocaster/Immobilienscout/Rest.php | 2 ++ Immocaster/Sdk.php | 22 +++++++++---------- README.txt | 5 ++++- index.php | 3 ++- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Immocaster/Immobilienscout/Immobilienscout.php b/Immocaster/Immobilienscout/Immobilienscout.php index 95ab5d1..8c99063 100755 --- a/Immocaster/Immobilienscout/Immobilienscout.php +++ b/Immocaster/Immobilienscout/Immobilienscout.php @@ -341,8 +341,9 @@ protected function createAttachmentBody($sMimeBoundary,$aArgs) $sBody .= 'xmlns:ns3="http://rest.immobilienscout24.de/schema/platform/gis/1.0" xmlns:xlink="http://www.w3.org/1999/xlink" '; $sBody .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $sBreak; $sBody .= ''.$aArgs['title'].'' . $sBreak; + $sBody .= ''.$aArgs['externalId'].'' . $sBreak; + $sBody .= ''.$aArgs['externalCheckSum'].'' . $sBreak; if( $aArgs['type']==='Picture' || $aArgs['type']==='PDFDocument') { - $sBody .= ''.$aArgs['externalId'].'' . $sBreak; $sBody .= ''.$aArgs['floorplan'].'' . $sBreak; } if( $aArgs['type']==='Picture') { diff --git a/Immocaster/Immobilienscout/Rest.php b/Immocaster/Immobilienscout/Rest.php index 4c98f9b..50b7258 100755 --- a/Immocaster/Immobilienscout/Rest.php +++ b/Immocaster/Immobilienscout/Rest.php @@ -817,6 +817,7 @@ private function _exportObjectAttachment($aArgs) if(!isset($aArgs['titlePicture'])){ $aArgs['titlePicture'] = 'false'; } if(!isset($aArgs['type'])){ $aArgs['type'] = ''; } if(!isset($aArgs['externalId'])){ $aArgs['externalId'] = ''; } + if(!isset($aArgs['externalCheckSum'])){ $aArgs['externalCheckSum'] = ''; } $oToken = null; $sSecret = null; $aHeader = array(); @@ -853,6 +854,7 @@ private function _exportObjectAttachment($aArgs) $req->unset_parameter('url'); $req->unset_parameter('type'); $req->unset_parameter('externalId'); + $req->unset_parameter('externalCheckSum'); return parent::getContent( $req, $sSecret, diff --git a/Immocaster/Sdk.php b/Immocaster/Sdk.php index c777318..d820051 100755 --- a/Immocaster/Sdk.php +++ b/Immocaster/Sdk.php @@ -9,17 +9,17 @@ * @author Norman Braun (medienopfer98.de) * @link http://www.immobilienscout24.de */ - + class Immocaster_Sdk { - + /** * Version and Application * * @var string */ private $_sImmocasterApplication = 'SDK'; - private $_sImmocasterVersion = '1_1_x'; + private $_sImmocasterVersion = '1_1_x'; /** * Service Objekt @@ -27,14 +27,14 @@ class Immocaster_Sdk * @var mixed */ private $_oService = false; - + /** * Singleton Instanzen * * @var array */ static private $_instances = array(); - + /** * Singleton Pattern für die Erstellung * der Instanzen von Immocaster_Sdk. @@ -55,7 +55,7 @@ static public function getInstance($sName,$sKey='',$sSecret='',$sService='immobi } return self::$_instances[$sName]; } - + /** * Abhängige Dateien laden und Verbindung * zu einem Service aufbauen. @@ -92,7 +92,7 @@ protected function __construct($sKey,$sSecret,$sService,$sAuth,$sProtocol) echo sprintf(IMMOCASTER_SDK_LANG_CANNOT_CONNECT_SERVICE,$sService,$sAuth.'/'.$sProtocol); return false; } - + /** * Aufgerufene Methode in den jeweiligen * Service weiterleiten und dort aufrufen. @@ -110,7 +110,7 @@ public function __call($method,$args) echo IMMOCASTER_SDK_LANG_NO_SERVICE_FOUND; return false; } - + /** * Haupt-URL zum Service ändern. * @@ -126,7 +126,7 @@ public function setRequestUrl($sUrl=false) echo IMMOCASTER_SDK_LANG_NO_SERVICE_FOR_CHANGE_URL; return false; } - + /** * Datenspeicherung Datenbank * initialisieren (für 3-legged-oauth). @@ -148,5 +148,5 @@ public function setDataStorage($aConnection,$sSessionNamespace=null,$sTableName= require_once(dirname(__FILE__).'/Data/'.$sFileName.'.php'); return call_user_func(array('Immocaster_Data_'.$sFileName,'getInstance'),$aConnection,$sTableName); } - -} \ No newline at end of file + +} diff --git a/README.txt b/README.txt index 7b380f1..cfc48f0 100755 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Immocaster PHP SDK v1.1.80 +Immocaster PHP SDK v1.1.81 ========================== Author: Norman Braun (http://www.medienopfer98.de) Copyright: Immobilien Scout GmbH @@ -9,6 +9,9 @@ Das PHP SDK von ImmobilienScout24 steht unter der FreeBSD Lizenz zur Verfügung History ======= +SDK Version 1.1.81 +- externalCheckSum für effizientere Synchronisierung von Attachments verfügbar. + SDK Version 1.1.80 - Erlaubt die Verwendung eines eigenen Proxys. Vielen Dank, webbird! diff --git a/index.php b/index.php index 3ea8a3f..4268fc4 100755 --- a/index.php +++ b/index.php @@ -353,7 +353,8 @@ 'type' => 'ATTACHMENTTYPE', // Picture, PDFDocument or Link 'file' => 'LOCATION', // file path OR URL //'url' => 'URL', - 'externalId' => 'EXTERNALID'); // optional + 'externalId' => 'EXTERNALID', // optional + 'externalCheckSum' => 'CHECKSUM'); // optional $res = $oImmocaster->exportObjectAttachment($aParameter); echo '
'; */