You are here

public function BaseCcuClient::postPurgeRequest in Akamai 7.3

Implements CcuClientInterface::postPurgeRequest().

Overrides CcuClientInterface::postPurgeRequest

File

src/BaseCcuClient.php, line 90
Constains the Drupal\akamai\BaseCcuClient class.

Class

BaseCcuClient

Namespace

Drupal\akamai

Code

public function postPurgeRequest($hostname, array $paths) {
  if (empty($hostname)) {
    throw new InvalidArgumentException("Expected hostname to be a non-empty string.");
  }
  $uri = $this
    ->getPurgeApiEndpoint();
  $response = $this->client
    ->post($uri, [
    'body' => $this
      ->getPurgeBody($hostname, $paths),
    'headers' => [
      'Content-Type' => 'application/json',
    ],
  ]);
  return json_decode($response
    ->getBody());
}