aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-07-02 11:19:38 +0300
committerFilipp Lepalaan <f@230.to>2013-07-02 11:19:38 +0300
commit0caf420521fffb52e0793b9da5a04b515c475fe1 (patch)
tree2f91a1076868dff6e8803dc0a36b605e562f8aec /gsxws
parent391949c68afedfe5a51675d614d7cde39c7313e1 (diff)
downloadpy-gsxws-0caf420521fffb52e0793b9da5a04b515c475fe1.tar.gz
py-gsxws-0caf420521fffb52e0793b9da5a04b515c475fe1.tar.bz2
py-gsxws-0caf420521fffb52e0793b9da5a04b515c475fe1.zip
Always return repair lookup results as a list
Diffstat (limited to 'gsxws')
-rw-r--r--gsxws/lookups.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/gsxws/lookups.py b/gsxws/lookups.py
index d05eea3..3d9814d 100644
--- a/gsxws/lookups.py
+++ b/gsxws/lookups.py
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
-import sys
import base64
import logging
import tempfile
from datetime import date
-from core import GsxObject
+from core import GsxObject, connect
+
class Lookup(GsxObject):
def __init__(self, *args, **kwargs):
@@ -32,8 +32,12 @@ class Lookup(GsxObject):
It fetches up to 2500 repairs in a given criteria.
Subsequently, the extended Repair Status API can be used
to retrieve more details of the repair.
+
+ >>> Lookup(serialNumber='DGKFL06JDHJP').repairs() # doctest: +ELLIPSIS
+ [{'customerName': 'Lepalaan,Filipp',...
"""
- return self.lookup("RepairLookup")
+ result = self.lookup("RepairLookup")
+ return [result] if isinstance(result, dict) else result
def invoices(self):
"""
@@ -58,9 +62,10 @@ class Lookup(GsxObject):
result.invoiceData = outfile.name
return result
+
if __name__ == '__main__':
import sys
import doctest
logging.basicConfig(level=logging.DEBUG)
- connect(*sys.argv[1:4])
+ connect(*sys.argv[1:])
doctest.testmod()