-
Notifications
You must be signed in to change notification settings - Fork 1
USPSTools EPF
This class is for managing USPS Electronic Product Fulfillment (EPF) interactions.
- Class name: EPF
- Namespace: USPSTools
const EPF_BASE_URL = 'https://epfws.usps.gov/ws/resources'
protected mixed $debugMode
Set if we are in debug mode or not.
- Visibility: protected
protected mixed $fileSaveLocation = ''
The file location to save downloads to.
- Visibility: protected
protected mixed $loginUser
The user ID assigned to use for login.
- Visibility: protected
protected mixed $loginPass
The password assigned to use for login.
- Visibility: protected
protected mixed $logonKey
Session key for this login instance.
- Visibility: protected
protected mixed $requestSuccess = null
Tracks if the latest request was successful or not.
- Visibility: protected
protected mixed $tokenKey
Rotating security token, changed with every request. To be used along with loginKey.
- Visibility: protected
protected mixed $subscribedProducts
A list of product codes and IDs that we are subscribed to, to be used with queries to API.
- Visibility: protected
mixed USPSTools\EPF::\USPSTools\EPF::__construct()(string $loginUser, string $loginPass, boolean $debugMode)
Handles the setup of this class
- Visibility: public
- $loginUser string - The user to log into the service with.
- $loginPass string - The password to log into the service with.
- $debugMode boolean - If we want to echo out debugging information.
array USPSTools\EPF::\USPSTools\EPF::downloadFile()(string $fileId, string $filePath)
Download the actual file you are looking to fetch from the Akamai edge servers.
- Visibility: public
- $fileId string - The file ID to download. This is returned as part of a listFiles call.
- $filePath string - The file to download. This is returned as part of a listFiles call.
array USPSTools\EPF::\USPSTools\EPF::downloadEpf()(string $fileId, string $filePath)
Download smaller files from the responding webserver.
- Visibility: public
- $fileId string - The file ID to download. This is returned as part of a listFiles call.
- $filePath string - The file to download. This is returned as part of a listFiles call.
array USPSTools\EPF::\USPSTools\EPF::downloadNewestFile()(string $productCode, string $productId, string $status, string $fulfilled)
Download the newest file available of this product.
- Visibility: public
- $productCode string - The product code to list files for.
- $productId string - The product ID under the product code to list files for.
- $status string - [Optional] Apply a filter on the file status.
- $fulfilled string - [Optional] Apply a filter on the file fulfillment status.
array USPSTools\EPF::\USPSTools\EPF::findNewestFile()(string $productCode, string $productId, string $status, string $fulfilled)
Find the newest file available for this product code/id combination. If set, some filtering can be applied to this list.
- Visibility: public
- $productCode string - The product code to list files for.
- $productId string - The product ID under the product code to list files for.
- $status string - [Optional] Apply a filter on the file status.
- $fulfilled string - [Optional] Apply a filter on the file fulfillment status.
array USPSTools\EPF::\USPSTools\EPF::listFiles()(string $productCode, string $productId, string $status, string $fulfilled)
You can get a list of available files for a particular EPF product code/id combination. If set, some filtering can be applied to this list.
- Visibility: public
- $productCode string - The product code to list files for.
- $productId string - The product ID under the product code to list files for.
- $status string - [Optional] Apply a filter on the file status.
- $fulfilled string - [Optional] Apply a filter on the file fulfillment status.
array USPSTools\EPF::\USPSTools\EPF::login()()
Use this function to log in to the EPF system.
- Visibility: public
array USPSTools\EPF::\USPSTools\EPF::logout()()
Use this function to log out of the EPF system. This is not required, but considered good practice.
- Visibility: public
mixed USPSTools\EPF::\USPSTools\EPF::parseHeaders()(string $headerString)
Parse cURL response headers into a usable array.
- Visibility: protected
- $headerString string - A string containing the headers to parse.
array USPSTools\EPF::\USPSTools\EPF::pullResource()(string $url, string $mode, array $jsonData)
This function will execute a request to the EPF server.
- Visibility: protected
- $url string - The EPF sub-url that we want to hit.
- $mode string - The mode we want to use in our request. By default, we're going to POST.
- $jsonData array - Extra parameters for the EPF request.
mixed USPSTools\EPF::\USPSTools\EPF::setDownloadLocation()(string $fileSaveLocation)
Set the download location to use when storing downloads.
- Visibility: public
- $fileSaveLocation string - The location to save our downloaded files to.
array USPSTools\EPF::\USPSTools\EPF::setStatus()(string $fileId, string $status)
Set the status on a particular file. This should be set after a download is successfully completed.
- Visibility: public
- $fileId string - The file ID to download. This is returned as part of a listFiles call.
- $status string - The status to set the file to.
array USPSTools\EPF::\USPSTools\EPF::version()()
This function allows you to check connectivity and get the version of the web service.
- Visibility: public