Méthode | Description | |
---|---|---|
__construct ( $providerKey, $host = self::DEFAULT_HOST, $httpClient = null ) | Create a ThreeScaleClient instance. | |
authorize ( $appId, $appKey = null, $serviceId = null, $usage = null ) : ThreeScaleResponse | Authorize an application. | |
authorize_with_user_key ( $userKey, $serviceId = null, $usage = null ) : ThreeScaleResponse | Authorize an application. | |
authrep ( $appId, $appKey = null, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) : ThreeScaleResponse | Authorize and report in a single shot. | |
authrep_with_user_key ( $userKey, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) | ||
getHost ( ) : string | Get hostname of 3scale backend server. | |
getProviderKey ( ) : string | Get provider's API key. | |
oauth_authorize ( $appId, $serviceId = null, $usage = null ) : ThreeScaleResponse | Authorize an application. | |
report ( $transactions, $serviceId = null ) : ThreeScaleResponse | Report transaction(s). | |
setHttpClient ( $httpClient ) | Curl library, which is just a thin wrapper around php's curl functions. |
Méthode | Description | |
---|---|---|
buildAuthorizeResponse ( $body ) | ||
buildErrorResponse ( $body ) | ||
encodeTimestamp ( $timestamp ) | ||
encodeTransactions ( $transactions ) | ||
isHttpClientError ( $httpResponse ) | ||
isHttpStatusCodeIn ( $httpResponse, $min, $max ) | ||
isHttpSuccess ( $httpResponse ) | ||
processError ( $httpResponse ) | ||
urlencodeRecursive ( $array ) |
public __construct ( $providerKey, $host = self::DEFAULT_HOST, $httpClient = null ) | ||
$providerKey | String Unique API key that identifies the provider. | |
$host | String Hostname of 3scale backend server. Usually there is no reason to use anything else than the default value. | |
$httpClient | Object Object for handling HTTP requests. Default is CURL. Don't change it unless you know what you are doing. |
public authorize ( $appId, $appKey = null, $serviceId = null, $usage = null ) : ThreeScaleResponse | ||
$appId | application id. | |
$appKey | secret application key. | |
$serviceId | service id, only required in the case of multiple services | |
Résultat | ThreeScaleResponse | object containing additional authorization information. If both provider key and application id are valid, the returned object is actually |
public authorize_with_user_key ( $userKey, $serviceId = null, $usage = null ) : ThreeScaleResponse | ||
$userKey | user key. | |
$serviceId | service id, only required in the case of multiple services | |
Résultat | ThreeScaleResponse | object containing additional authorization information. If both provider key and application id are valid, the returned object is actually |
public authrep ( $appId, $appKey = null, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) : ThreeScaleResponse | ||
$appId | application id. | |
$appKey | secret application key. | |
Résultat | ThreeScaleResponse | object containing additional authorization information. If both provider key and application id are valid, the returned object is actually |
public authrep_with_user_key ( $userKey, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) |
public getProviderKey ( ) : string | ||
Résultat | string |
public oauth_authorize ( $appId, $serviceId = null, $usage = null ) : ThreeScaleResponse | ||
$appId | application id or client id (they are equivalent) | |
$serviceId | service id, only required in the case of multiple services | |
$usage | usage | |
Résultat | ThreeScaleResponse | object containing additional authorization information. If both provider key and application id are valid, the returned object is actually |
public report ( $transactions, $serviceId = null ) : ThreeScaleResponse | ||
$transactions | array of transactions to report. Each transaction is an array with these elements: "app_id" - ID of the application to report the transaction for. This parameter is required. "usage" - Array of usage values. The keys are metric names and values are correspoding numeric values. Example: array('hits' => 1, 'transfer' => 1024). This parameter is required. "timestamp" - Timestamp of the transaction. This can be either an integer (the unix timestamp) or a string in the "YYYY-MM-DD HH:MM:SS" format (if the time is in the UTC), or a string in the "YYYY-MM-DD HH:MM:SS ZZZZZZ" format, where the ZZZZZZ is the time offset from the UTC. For example, "US Pacific Time" has offset -08:00, "Tokyo" has offset +09:00. This parameter is optional, and if not provided, equals to the current time. | |
Résultat | ThreeScaleResponse | The response object's isSuccess() method returns true if the report was successful, or false if there was an error. See @see ThreeScaleResponse class for more information. |
public setHttpClient ( $httpClient ) |