private function createFixture($addTearDown = true)
 {
     $name = $this->getRandomName();
     $segment = new Segment();
     $segment->setName($name)->setDataProviderId(SANDBOX_DATA_PROVIDER_ID)->setStatus(new SegmentStatus('active'))->setTtl(100)->setCategoryId(377806)->setFrequency(5)->setRefId(strtolower($name))->setFee(0.6);
     $segment = $this->client->segments()->create($segment);
     if ($addTearDown) {
         $this->fixtures[] = $segment;
     }
     return $segment;
 }
 /**
  * Delete a category
  *
  * @param Segment $segment
  *
  * @throws Exception\ApiException if the API call fails
  *
  * @return Segment
  */
 public function delete(Segment $segment)
 {
     // Endpoint URI
     $uri = sprintf('v1/segments/%d', $segment->getId());
     try {
         $this->httpClient->delete($uri);
         if ($this->cache) {
             $this->cache->invalidate($this->cachePrefix);
         }
         return true;
     } catch (ClientException $e) {
         $response = $e->getResponse();
         $responseBody = $response->getBody()->getContents();
         $responseCode = $response->getStatusCode();
         throw Exception\ApiException::translate($responseBody, $responseCode);
     }
 }