aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md15
-rwxr-xr-xgsxcl4
-rw-r--r--gsxlib.php6
3 files changed, 15 insertions, 10 deletions
diff --git a/README.md b/README.md
index e8b0edf..6e2e9da 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/gsxcl b/gsxcl
index 7bb0ee6..badf7be 100755
--- a/gsxcl
+++ b/gsxcl
@@ -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;
}
diff --git a/gsxlib.php b/gsxlib.php
index b32539a..a12e8c0 100644
--- a/gsxlib.php
+++ b/gsxlib.php
@@ -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}$/',