|
@@ 126-140 (lines=15) @@
|
| 123 |
|
* @param string $contentType |
| 124 |
|
* @return array |
| 125 |
|
*/ |
| 126 |
|
public function get($ressourceName, $ressourcePath =null, $ressourceId = null, $query = array(), |
| 127 |
|
$assoc = false, $contentType = 'json') |
| 128 |
|
{ |
| 129 |
|
try { |
| 130 |
|
$urlRessource = $this->builPathToCall($ressourceName, $ressourcePath, $ressourceId); |
| 131 |
|
$response = $this->getClient()->get($urlRessource, |
| 132 |
|
array( |
| 133 |
|
'headers' => ['Accept' => "application/$contentType"], |
| 134 |
|
'query' => $query |
| 135 |
|
)); |
| 136 |
|
} catch (ClientException $ex) { |
| 137 |
|
$response = $ex->getResponse(); |
| 138 |
|
} |
| 139 |
|
return $this->makeCertainApiResponse($response, $contentType, $assoc); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Make "POST" request with the client. |
|
@@ 215-228 (lines=14) @@
|
| 212 |
|
* @param string $contentType |
| 213 |
|
* @return array |
| 214 |
|
*/ |
| 215 |
|
public function delete($ressourceName, $ressourcePath =null, $ressourceId = null, $assoc = false, |
| 216 |
|
$contentType = 'json') |
| 217 |
|
{ |
| 218 |
|
try { |
| 219 |
|
$urlRessource = $this->builPathToCall($ressourceName, $ressourcePath, $ressourceId); |
| 220 |
|
$response = $this->getClient()->delete($urlRessource, |
| 221 |
|
array( |
| 222 |
|
'headers' => ['Accept' => "application/$contentType"], |
| 223 |
|
)); |
| 224 |
|
} catch (ClientException $ex) { |
| 225 |
|
$response = $ex->getResponse(); |
| 226 |
|
} |
| 227 |
|
return $this->makeCertainApiResponse($response, $contentType, $assoc); |
| 228 |
|
} |
| 229 |
|
|
| 230 |
|
/** |
| 231 |
|
* Make the Certain Api repsonse. |