From 44943702e5015e942ebf78642118773f07d25619 Mon Sep 17 00:00:00 2001 From: xtech86 <6GW7iqJ78B> Date: Fri, 15 Jul 2016 22:49:44 +0100 Subject: [PATCH] Included id variable and set both functions to var_dump for data clarity on testing. Specified functions with access modifiers. Fixed getProperty() function to work as designed. --- core/class.gPropsRestClient.php | 14 +++++++------- example.php | 10 +++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/class.gPropsRestClient.php b/core/class.gPropsRestClient.php index 6af9e4b..cd9206e 100644 --- a/core/class.gPropsRestClient.php +++ b/core/class.gPropsRestClient.php @@ -22,7 +22,7 @@ class gPropsRestClient extends bdCoreRestClient{ /** * constructor */ -function __construct(){ +public function __construct(){ parent :: __construct(); } @@ -30,14 +30,14 @@ function __construct(){ * Gets property data *@param int $pId Property Id */ -function getProperty($pId=0){ +public function getProperty($pId=0){ //run the query $output = false; //$result = $this->post("property/michael",array('pId'=>$pId)); //example post - use later for updating try{ - $result = $this->api->get("props/". $sQuery,array(),array('Content-Type'=>'application/json')); + $result = $this->api->get("property/". $pId ,array(),array('Content-Type'=>'application/json')); $output = json_decode($result->response,true); - echo $result->response; exit; + //echo $result->response; exit; } catch(Exception $e){ $this->logApiError($e); @@ -50,7 +50,7 @@ function getProperty($pId=0){ * Gets all property data *@param int $pId Property Id */ -function getProperties($sQuery=0){ +public function getProperties($sQuery=0){ //run the query //$result = $this->post("property/michael",array('pId'=>$pId)); //example post - use later for updating $output = false; @@ -70,7 +70,7 @@ function getProperties($sQuery=0){ /** * Gets all branch data */ -function getBranches(){ +public function getBranches(){ //run the query //$result = $this->post("property/michael",array('pId'=>$pId)); //example post - use later for updating $output = false; @@ -90,7 +90,7 @@ function getBranches(){ * creates a new detail request - this covers viewins, details about properties and general newsletter requests *@param array $rData Request Data */ -function newRequest($rData=array()){ +public function newRequest($rData=array()){ //run the query //$result = $this->post("property/michael",array('pId'=>$pId)); //example post - use later for updating $output = false; diff --git a/example.php b/example.php index 9f420bf..a20b6f2 100644 --- a/example.php +++ b/example.php @@ -28,16 +28,20 @@ //Retrieve Specific Property Data //Use a valid property ID on your account -$propertyData = $api->getProperty('1'); + +$id = '1'; // This is the property ID we are going to fetch. + +$propertyData = $api->getProperty($id); echo'Got property data:'; -print_r($propertyData); + +var_dump($propertyData); $allProperties = $api->getProperties(); //$allProperties = $api->getProperties('nres=999999'); var_dump($allProperties); -echo"
"; +echo '
'; echo count($api->apiErrors) .' Api Errors'; var_dump($api->apiErrors);