You are here

public function gapi::__construct in Google Analytics Statistics 7.2

Same name and namespace in other branches
  1. 7 includes/gapi.class.php \gapi::__construct()
  2. 7.x inc/gapi.class.php \gapi::__construct()

Constructor function for new gapi instances

Parameters

string $client_email Email of OAuth2 service account (XXXXX@developer.gserviceaccount.com):

string $key_file Location/filename of .p12 key file:

string $delegate_email Optional email of account to impersonate:

Return value

gapi

File

includes/gapi.class.php, line 50

Class

gapi
GAPI - Google Analytics PHP Interface

Code

public function __construct($client_email, $key_file, $delegate_email = null) {
  if (version_compare(PHP_VERSION, '5.3.0') < 0) {
    throw new Exception('GAPI: PHP version ' . PHP_VERSION . ' is below minimum required 5.3.0.');
  }
  $this->auth_method = new gapiOAuth2();
  $this->auth_method
    ->fetchToken($client_email, $key_file, $delegate_email);
}