Property | Type | Description | |
---|---|---|---|
$CURL_OPTS | Default options for curl. | ||
$testMode | - set whether we are in a test mode or not |
Property | Type | Description | |
---|---|---|---|
$apiCodes | - different kind of supported api calls by this wrapper | ||
$apiVersion | string | The api type we are about to call. | |
$arrayResponse | array | The response represented as an array. | |
$errorCode | integer | the error code if one exists. | |
$errorMessage | string | the error message if one exists. | |
$headers | array | the headers returned from the call made. | |
$postFields | array | All the post fields we will add to the call. | |
$response | string | the response message. | |
$username | - the usps username provided by the usps website |
Method | Description | |
---|---|---|
__construct ( string $username = '' ) | Constructor. | |
convertResponseToArray ( ) : array | Return the response represented as string. | |
getArrayResponse ( ) : array | Return the array representation of the last response. | |
getEndpoint ( ) | ||
getErrorCode ( ) : integer | Get the error code number. | |
getErrorMessage ( ) : string | Get the error code message. | |
getHeaders ( ) : array | Get the headers. | |
getPostData ( ) : array | Return the post data fields as an array. | |
getPostFields ( ) | ||
getResponse ( ) : mixed | Get the response data. | |
getResponseApiName ( ) : string | Response api name. | |
isError ( ) : boolean | Did we encounter an error? | |
isSuccess ( ) : boolean | Was the last call successful. | |
setApiVersion ( string $version ) : void | Set the api version we are going to use. | |
setArrayResponse ( array $value ) : void | Set the array response value. | |
setErrorCode ( integer $code ) : self | Set the error code number. | |
setErrorMessage ( string $message = '' ) : self | Set the error message. | |
setHeaders ( array $headers = [] ) : self | Set the headers. | |
setResponse ( mixed $response = '' ) : self | Set the response. | |
setTestMode ( boolean $value ) : void | Set whether we are in a test mode or not. | |
setUsername ( string $username ) | set the usps api username we are going to user. |
Method | Description | |
---|---|---|
doRequest ( resource $ch = null ) : string | Makes an HTTP request. This method can be overriden by subclasses if developers want to do fancier things or use something other than curl to make the request. | |
getValueByKey ( array $array, string $key ) : mixed | Find a key inside a multi dim. array. | |
getXMLString ( ) : string | Return the xml string built that we are about to send over to the api. |
public __construct ( string $username = '' ) | ||
$username | string | - the usps api username |
public convertResponseToArray ( ) : array | ||
return | array |
public getArrayResponse ( ) : array | ||
return | array |
public getErrorCode ( ) : integer | ||
return | integer | error code number |
public getErrorMessage ( ) : string | ||
return | string | error code message |
public getHeaders ( ) : array | ||
return | array | the headers returned from the call |
public getPostData ( ) : array | ||
return | array |
public getResponse ( ) : mixed | ||
return | mixed | the response data |
public getResponseApiName ( ) : string | ||
return | string |
protected getXMLString ( ) : string | ||
return | string |
public setApiVersion ( string $version ) : void | ||
$version | string | the new api version |
return | void |
public setArrayResponse ( array $value ) : void | ||
$value | array | |
return | void |
public setErrorCode ( integer $code ) : self | ||
$code | integer | the error code number |
return | self |
public setErrorMessage ( string $message = '' ) : self | ||
$message | string | the error message |
return | self |
public setHeaders ( array $headers = [] ) : self | ||
$headers | array | the headers array |
return | self |
public setResponse ( mixed $response = '' ) : self | ||
$response | mixed | The response returned from the call |
return | self |
public setTestMode ( boolean $value ) : void | ||
$value | boolean | |
return | void |
public setUsername ( string $username ) | ||
$username | string | - the usps api username |
protected $apiCodes |
protected string $apiVersion | ||
return | string |
protected array $arrayResponse | ||
return | array |
protected string $errorMessage | ||
return | string |
protected array $headers | ||
return | array |
protected array $postFields | ||
return | array |