Merged in cochalo/processmaker (pull request #191)

Adicion de end point para PMTABLES
This commit is contained in:
erik ao
2014-02-14 09:55:39 -04:00
2 changed files with 267 additions and 0 deletions

View File

@@ -99,6 +99,33 @@ class Pmtable extends Api
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
*
* @param array $request_data
* @param array $pmt_rows {@from body} {@required true}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url POST /:pmt_uid/data
* @status 201
*/
public function doPostPmTableData(
$pmt_uid,
$request_data,
$pmt_rows = ''
) {
try {
$oReportTable = new \BusinessModel\Table();
$response = $oReportTable->saveTableData($pmt_uid, $request_data);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
*
@@ -125,6 +152,32 @@ class Pmtable extends Api
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
*
* @param array $request_data
* @param array $pmt_rows {@from body} {@required true}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url PUT /:pmt_uid/data
*/
public function doPutPmTableData(
$pmt_uid,
$request_data,
$pmt_rows = ''
) {
try {
$oReportTable = new \BusinessModel\Table();
$response = $oReportTable->updateTableData($pmt_uid, $request_data);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
*
@@ -144,5 +197,41 @@ class Pmtable extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @param string $pmt_uid {@min 1} {@max 32}
* @param string $key1 {@min 1}
* @param string $value1 {@min 1}
* @param string $key2
* @param string $value2
* @param string $key3
* @param string $value3
*
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url DELETE /:pmt_uid/data/:key1/:value1
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
*/
public function doDeletePmTableData($pmt_uid, $key1, $value1, $key2 = '', $value2 = '', $key3 = '', $value3 = '')
{
try {
$rows = array($key1 => $value1);
if ($key2 != '') {
$rows[$key2] = $value2;
}
if ($key3 != '') {
$rows[$key3] = $value3;
}
$oReportTable = new \BusinessModel\Table();
$response = $oReportTable->deleteTableData($pmt_uid, $rows);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}