aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgsxcl7
-rw-r--r--gsxlib.php10
-rw-r--r--tests/create_carryin_repair.json12
3 files changed, 23 insertions, 6 deletions
diff --git a/gsxcl b/gsxcl
index 060206c..1783587 100755
--- a/gsxcl
+++ b/gsxcl
@@ -39,7 +39,7 @@ usage: gsxcl -s sold-to -u username -p password [-r region] [-e environment] [-f
Defaults to production
-f format the output format. Either print_r (default), json, xml or csv
-d data data for the query (serial number, order confirmation, repair number, EEE code, etc
- Defaults to this machine's serial number
+ Defaults to this machine's serial number. Or path to a JSON file.
noun one of: {$verbs_str}
verb one of: {$nouns_str}
@@ -122,6 +122,11 @@ switch( $noun ) {
case 'status':
$result = $gsx->repairStatus( $query );
break;
+ case 'create':
+ $json = file_get_contents( $opts['d'] );
+ $data = json_decode( $json, TRUE );
+ $result = $gsx->createCarryInRepair( $data );
+ break;
}
case 'model':
diff --git a/gsxlib.php b/gsxlib.php
index 43ba53a..fae862e 100644
--- a/gsxlib.php
+++ b/gsxlib.php
@@ -192,6 +192,16 @@ class GsxLib
public function createCarryInRepair($repairData)
{
+ if( $repairData['fileData'] && file_exists( $repairData['fileData'] ))
+ {
+ $fp = $repairData['fileData'];
+ $fh = fopen($fp, "r");
+ $contents = fread($fh, filesize($fp));
+ $repairData['fileData'] = $contents;
+ $repairData['fileName'] = basename($fp);
+ fclose($fh);
+ }
+
$resp = $this->client->CreateCarryInRepair(
array('CreateCarryInRequest' => array(
'userSession' => array('userSessionId' => $this->getSessionId()),
diff --git a/tests/create_carryin_repair.json b/tests/create_carryin_repair.json
index 085c765..9780b51 100644
--- a/tests/create_carryin_repair.json
+++ b/tests/create_carryin_repair.json
@@ -1,10 +1,11 @@
{
- "shipTo": "677592",
+ "popFaxed": "N",
+ "shipTo": "",
"requestReviewByApple": "N",
- "serialNumber": "C3TFJJTNDCP9",
+ "serialNumber": "",
"symptom": "Does not work",
"diagnosis": "Does not work",
- "unitReceivedDate": "01/01/13",
+ "unitReceivedDate": "03/10/13",
"unitReceivedTime": "12:00 AM",
"checkIfOutOfWarrantyCoverage": "N",
"overrideDiagnosticCodeCheck": "Y",
@@ -12,7 +13,7 @@
"orderLines": [
{
"partNumber": "FD661-6136",
- "comptiaCode": "T03",
+ "comptiaCode": "E01",
"comptiaModifier": "B",
"abused": "Y",
"outOfWarrantyFlag": "N",
@@ -32,5 +33,6 @@
"companyName": "Apple Inc",
"primaryPhone": "4088887766",
"emailAddress": "abc@test.com"
- }
+ },
+ "fileData": "/tmp/test.pdf"
}