aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws
diff options
context:
space:
mode:
Diffstat (limited to 'gsxws')
-rw-r--r--gsxws/core.py8
-rw-r--r--gsxws/returns.py20
2 files changed, 20 insertions, 8 deletions
diff --git a/gsxws/core.py b/gsxws/core.py
index 63b9f81..1b7da60 100644
--- a/gsxws/core.py
+++ b/gsxws/core.py
@@ -247,9 +247,10 @@ class GsxRequest(object):
if self._request == request_name:
"Some requests don't have a top-level container"
- self.data = list(self.data)[0]
-
- request.append(self.data)
+ #self.data = list(self.data)[0]
+ request.extend(self.data)
+ else:
+ request.append(self.data)
data = ET.tostring(self.env, "UTF-8")
res = self._send(method, data)
@@ -322,6 +323,7 @@ class GsxObject(object):
raise AttributeError("Invalid attribute: %s" % name)
def _submit(self, arg, method, ret=None, raw=False):
+ "Shortcut for submitting a GsxObject"
self._req = GsxRequest(**{arg: self})
result = self._req._submit(method, ret, raw)
return result if len(result) > 1 else result[0]
diff --git a/gsxws/returns.py b/gsxws/returns.py
index 9043ecd..42c002f 100644
--- a/gsxws/returns.py
+++ b/gsxws/returns.py
@@ -56,12 +56,12 @@ class Return(GsxObject):
The Parts Pending Return API returns a list of all parts that
are pending for return, based on the search criteria.
- >>> Returns(repairType='CA').get_pending() # doctest: +SKIP
+ >>> Return(repairType='CA').get_pending() # doctest: +SKIP
"""
dt = self._make_type('ns1:partsPendingReturnRequestType')
dt.repairData = self.data
- return self.submit('PartsPendingReturn', dt, 'partsPendingResponse')
+ return self._submit('PartsPendingReturn', dt, 'partsPendingResponse')
def get_report(self):
"""
@@ -76,12 +76,13 @@ class Return(GsxObject):
def get_label(self, part_number):
"""
The Return Label API retrieves the Return Label for a given Return Order Number.
- (Type not found: 'comptiaCode')
- so we're parsing the raw SOAP response and creating a "fake" return object from that.
+
+ >>> Return('7458231326').get_label('661-5852')
"""
if not validate(part_number, 'partNumber'):
raise ValueError("%s is not a valid part number" % part_number)
+ self.partNumber = part_number
self._submit("ReturnLabelRequest", "ReturnLabel", "returnLabelData")
return self._req.objects[0]
@@ -118,7 +119,7 @@ class Return(GsxObject):
with the status GPR(2), DOA(1), CTS(3), or TOW(4).
The API can be used only by ASP.
- >>> Returns().update_parts('G135877430',\
+ >>> Return().update_parts('G135877430',\ # doctest: +SKIP
[{'partNumber': '661-5174',\
'comptiaCode': 'Z29',\
'comptiaModifier': 'A',\
@@ -132,3 +133,12 @@ class Return(GsxObject):
dt.repairData = repairData
result = self.submit("PartsReturnUpdate", dt)
return result
+
+if __name__ == '__main__':
+ import sys
+ import doctest
+ import logging
+ from core import connect
+ logging.basicConfig(level=logging.DEBUG)
+ connect(*sys.argv[1:])
+ doctest.testmod()