@@ 141-157 (lines=17) @@ | ||
138 | * @param string $contentType |
|
139 | * @return array |
|
140 | */ |
|
141 | public function get($ressourceName, $ressourcePath =null, $ressourceId = null, $query = array(), |
|
142 | $assoc = false, $contentType = 'json') |
|
143 | { |
|
144 | try { |
|
145 | $urlRessource = $this->builPathToCall($ressourceName, $ressourcePath, $ressourceId); |
|
146 | $response = $this->getClient()->get($urlRessource, |
|
147 | array( |
|
148 | 'auth' => [$this->username, $this->password], |
|
149 | 'headers' => ['Accept' => "application/$contentType"], |
|
150 | 'query' => $query, |
|
151 | 'verify' => false |
|
152 | )); |
|
153 | } catch (ClientException $ex) { |
|
154 | $response = $ex->getResponse(); |
|
155 | } |
|
156 | return $this->makeCertainApiResponse($response, $contentType, $assoc); |
|
157 | } |
|
158 | ||
159 | /** |
|
160 | * Make "POST" request with the client. |
|
@@ 236-251 (lines=16) @@ | ||
233 | * @param string $contentType |
|
234 | * @return array |
|
235 | */ |
|
236 | public function delete($ressourceName, $ressourcePath =null, $ressourceId = null, $assoc = false, |
|
237 | $contentType = 'json') |
|
238 | { |
|
239 | try { |
|
240 | $urlRessource = $this->builPathToCall($ressourceName, $ressourcePath, $ressourceId); |
|
241 | $response = $this->getClient()->delete($urlRessource, |
|
242 | array( |
|
243 | 'auth' => [$this->username, $this->password], |
|
244 | 'headers' => ['Accept' => "application/$contentType"], |
|
245 | 'verify' => false |
|
246 | )); |
|
247 | } catch (ClientException $ex) { |
|
248 | $response = $ex->getResponse(); |
|
249 | } |
|
250 | return $this->makeCertainApiResponse($response, $contentType, $assoc); |
|
251 | } |
|
252 | ||
253 | /** |
|
254 | * Make the Certain Api repsonse. |