You are here

protected function Fastly::query in Fastly 7

Same name and namespace in other branches
  1. 7.2 fastly.api.inc \Fastly::query()

Performs http queries to Fastly API server.

Parameters

string $uri: The uri to use for the request, appended to the host.

array $data: (optional) Data to send with the request.

string $method: (optional) The method to use for the request, defaults to GET.

array $headers: (optional) An array of headers to send with the request.

Return value

object From drupal_http_request().

7 calls to Fastly::query()
Fastly::createService in ./fastly.api.inc
Creates a default service for our website once we signed up.
Fastly::getServices in ./fastly.api.inc
Gets a list of services for the current customer.
Fastly::getSettings in ./fastly.api.inc
Gets the settings for a version.
Fastly::purgeAll in ./fastly.api.inc
Purge whole service.
Fastly::purgeKey in ./fastly.api.inc
Purge cache by key.

... See full list

File

./fastly.api.inc, line 178
Contains Faslt class that handles API calls to the Fastly service.

Class

Fastly
Fastly API for Drupal.

Code

protected function query($uri, $data = array(), $method = 'GET', $headers = array()) {
  $url = $this->host . $uri;
  $options['headers'] = $headers;
  $options['method'] = $method;
  $options['data'] = http_build_query($data);
  if ($this->api_key) {
    $options['headers']['Fastly-Key'] = $this->api_key;
  }
  $result = drupal_http_request($url, $options);
  return $result;
}