Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function delete($url, array $headers = array())
 {
     $response = $this->browser->delete($url, $headers);
     if (!$response->isSuccessful()) {
         throw $this->handleResponse($response);
     }
 }
Esempio n. 2
0
 public function deleteRecord($table, array $criteria = [])
 {
     $record = $this->findRecord($table, $criteria);
     /** @var Response $response */
     $response = $this->browser->delete($this->getEndpoint($table, $record->getId()), ["content-type" => "application/json"]);
     $this->guardResponse($table, $response);
 }
Esempio n. 3
0
 /**
  * Common delete request for all API calls
  *
  * @param string $resource The path to the resource wanted. For example v2/room
  *
  * @return array Decoded array containing response
  * @throws Exception\RequestException
  */
 public function delete($resource)
 {
     $url = $this->baseUrl . $resource;
     $headers = array('Authorization' => $this->auth->getCredential());
     $response = $this->browser->delete($url, $headers);
     if ($this->browser->getLastResponse()->getStatusCode() > 299) {
         throw new RequestException(json_decode($this->browser->getLastResponse()->getContent(), true));
     }
     return json_decode($response->getContent(), true);
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function delete($url)
 {
     $response = $this->browser->delete($url);
     $this->handleResponse($response);
 }