diff options
author | Filipp Lepalaan <f@0x00.co> | 2013-01-12 10:28:50 +0200 |
---|---|---|
committer | Filipp Lepalaan <f@0x00.co> | 2013-01-12 10:28:50 +0200 |
commit | 7a46310b44d772a25ff775da4ea0b344ab7e1d0e (patch) | |
tree | 6f1317d0708ab37df73fc9f78464d41d60023bb8 | |
parent | 8578d726b575bcadfff9c1f590442e46b5069471 (diff) | |
download | gsxlib-7a46310b44d772a25ff775da4ea0b344ab7e1d0e.tar.gz gsxlib-7a46310b44d772a25ff775da4ea0b344ab7e1d0e.tar.bz2 gsxlib-7a46310b44d772a25ff775da4ea0b344ab7e1d0e.zip |
Modified readme
-rw-r--r-- | README.md | 15 | ||||
-rwxr-xr-x | gsxcl | 4 | ||||
-rw-r--r-- | gsxlib.php | 6 |
3 files changed, 15 insertions, 10 deletions
@@ -1,15 +1,19 @@ -##About## +About +===== GsxLib is a PHP library that simplifies communication with Apple's [GSX web service API][1]. It frees the application developer from knowing the underlying PHP SOAP architecture and to some extent even the GSX API itself. GsxLib also tries to provide some performance benefits by minimizing the number of requests made to the servers as well as doing some rudimentary input validation (as opposed to burdening Apple's servers with totally invalid requests). -##Requrements## +Requrements +=========== -Your PHP must have SOAP support. Most distributions should (including OS X Server 10.6 or later). For more details, consult your distribution or the [PHP documentation][2]. +- SOAP support in your PHP. +- GSX account with the "Can access Web Services" privilege enabled -##Usage## +Usage +===== Best illustrated with a simple example: @@ -25,7 +29,8 @@ Best illustrated with a simple example: If you're in the US, remember to set the fifth argument to the constructor to 'am'. -##gsxcl## +gsxcl +===== The package includes a rudimentary command line client to the GSX API called _gsxcl_. It can perform various functions in the library and is meant mainly as a simple test tool for the library. @@ -72,7 +72,7 @@ switch( $noun ) } } -$gsx = new GsxLib( $opts['s'], $opts['u'], $opts['p'], $environment, $region ); +$gsx = GsxLib::getInstance( $opts['s'], $opts['u'], $opts['p'], $environment, $region ); if( !isset( $opts['d'] )) { $data = `/usr/sbin/system_profiler SPHardwareDataType | awk '/Serial Number/ {print $4}'`; @@ -89,7 +89,7 @@ switch( $noun ) { case 'warranty': switch( $verb ) { case 'status': - $result = $gsx->warrantyStatus( $data ); + $result = $gsx->warrantyStatus( $data['serialNumber'] ); break; } @@ -186,7 +186,7 @@ class GsxLib $like => $query )); - return $this->request($request); + return $this->request($request)->activationDetailsInfo; } @@ -523,8 +523,8 @@ class GsxLib { $result = false; $rex = array( - 'partNumber' => '/^([A-Z]{1,2})?\d{3}\-?(\d{4}|[A-Z]{2})(/[A-Z])?$/i', - 'serialNumber' => '/^[a-z0-9]{11,12}$/i', + 'partNumber' => '/^([A-Z]{1,2})?\d{3}\-?(\d{4}|[A-Z]{2})(\/[A-Z])?$/i', + 'serialNumber' => '/^[A-Z0-9]{11,12}$/i', 'eeeCode' => '/^[A-Z0-9]{3,4}$/', // only match ALL-CAPS! 'returnOrder' => '/^7\d{9}$/', 'repairNumber' => '/^\d{12}$/', |