PHP 클래스 ThreeScaleClient

Objects of this class are stateless and can be shared through multiple transactions and by multiple clients.
파일 보기 프로젝트 열기: 3scale/3scale_ws_api_for_php 1 사용 예제들

공개 메소드들

메소드 설명
__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.

비공개 메소드들

메소드 설명
buildAuthorizeResponse ( $body )
buildErrorResponse ( $body )
encodeTimestamp ( $timestamp )
encodeTransactions ( $transactions )
isHttpClientError ( $httpResponse )
isHttpStatusCodeIn ( $httpResponse, $min, $max )
isHttpSuccess ( $httpResponse )
processError ( $httpResponse )
urlencodeRecursive ( $array )

메소드 상세

__construct() 공개 메소드

Create a ThreeScaleClient instance.
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.

authorize() 공개 메소드

Authorize an application.
또한 보기: ThreeScaleAuthorizeResponse (which is derived from ThreeScaleResponse) and contains additional information about the usage status.
또한 보기: ThreeScaleResponse
또한 보기: ThreeScaleAuthorizeResponse
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
리턴 ThreeScaleResponse object containing additional authorization information. If both provider key and application id are valid, the returned object is actually

authorize_with_user_key() 공개 메소드

Authorize an application.
또한 보기: ThreeScaleAuthorizeResponse (which is derived from ThreeScaleResponse) and contains additional information about the usage status.
또한 보기: ThreeScaleResponse
또한 보기: ThreeScaleAuthorizeResponse
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
리턴 ThreeScaleResponse object containing additional authorization information. If both provider key and application id are valid, the returned object is actually

authrep() 공개 메소드

Authorize and report in a single shot.
또한 보기: ThreeScaleAuthorizeResponse (which is derived from ThreeScaleResponse) and contains additional information about the usage status.
또한 보기: ThreeScaleResponse
또한 보기: ThreeScaleAuthorizeResponse
public authrep ( $appId, $appKey = null, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null ) : ThreeScaleResponse
$appId application id.
$appKey secret application key.
리턴 ThreeScaleResponse object containing additional authorization information. If both provider key and application id are valid, the returned object is actually

authrep_with_user_key() 공개 메소드

public authrep_with_user_key ( $userKey, $usage = null, $userId = null, $object = null, $no_body = null, $serviceId = null )

getHost() 공개 메소드

Get hostname of 3scale backend server.
public getHost ( ) : string
리턴 string

getProviderKey() 공개 메소드

Get provider's API key.
public getProviderKey ( ) : string
리턴 string

oauth_authorize() 공개 메소드

Authorize an application.
또한 보기: ThreeScaleAuthorizeResponse (which is derived from ThreeScaleResponse) and contains additional information about the usage status.
또한 보기: ThreeScaleResponse
또한 보기: ThreeScaleAuthorizeResponse
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
리턴 ThreeScaleResponse object containing additional authorization information. If both provider key and application id are valid, the returned object is actually

report() 공개 메소드

Report transaction(s).
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.
리턴 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.

setHttpClient() 공개 메소드

Curl library, which is just a thin wrapper around php's curl functions.
public setHttpClient ( $httpClient )