Skip to content

Commit

Permalink
externalCheckSum (Attachment) available
Browse files Browse the repository at this point in the history
Fill the externalCheckSum for Attachments for a better synchronization
handling.
  • Loading branch information
Fabian Mielke committed Oct 23, 2015
1 parent 2628080 commit 29be818
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Immocaster/Immobilienscout/Immobilienscout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '<title>'.$aArgs['title'].'</title>' . $sBreak;
$sBody .= '<externalId>'.$aArgs['externalId'].'</externalId>' . $sBreak;
$sBody .= '<externalCheckSum>'.$aArgs['externalCheckSum'].'</externalCheckSum>' . $sBreak;
if( $aArgs['type']==='Picture' || $aArgs['type']==='PDFDocument') {
$sBody .= '<externalId>'.$aArgs['externalId'].'</externalId>' . $sBreak;
$sBody .= '<floorplan>'.$aArgs['floorplan'].'</floorplan>' . $sBreak;
}
if( $aArgs['type']==='Picture') {
Expand Down
2 changes: 2 additions & 0 deletions Immocaster/Immobilienscout/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions Immocaster/Sdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
* @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
*
* @var mixed
*/
private $_oService = false;

/**
* Singleton Instanzen
*
* @var array
*/
static private $_instances = array();

/**
* Singleton Pattern für die Erstellung
* der Instanzen von Immocaster_Sdk.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -110,7 +110,7 @@ public function __call($method,$args)
echo IMMOCASTER_SDK_LANG_NO_SERVICE_FOUND;
return false;
}

/**
* Haupt-URL zum Service ändern.
*
Expand All @@ -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).
Expand All @@ -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);
}
}

}
5 changes: 4 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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!

Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div class="codebox"><textarea>'.$res.'</textarea></div>';
*/
Expand Down

0 comments on commit 29be818

Please sign in to comment.