aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws
diff options
context:
space:
mode:
Diffstat (limited to 'gsxws')
-rw-r--r--gsxws/core.py18
-rw-r--r--gsxws/products.py5
-rw-r--r--gsxws/returns.py18
3 files changed, 23 insertions, 18 deletions
diff --git a/gsxws/core.py b/gsxws/core.py
index cb8f49d..97bf717 100644
--- a/gsxws/core.py
+++ b/gsxws/core.py
@@ -384,7 +384,7 @@ class GsxObject(object):
setattr(obj, k, attr)
- if k in ['packingList', 'proformaFileData', 'returnLabelFileData']:
+ if k in ["packingList", "proformaFileData", "returnLabelFileData"]:
v = base64.b64decode(v)
of = tempfile.NamedTemporaryFile(suffix=".pdf", delete=False)
of.write(v)
@@ -396,7 +396,11 @@ class GsxObject(object):
# convert Y and N to boolean
if re.search(r'^[YN]$', v):
- v = (v == 'Y')
+ v = (v == "Y")
+
+ # convert true/false to boolean
+ if re.search(r'^(true)|(false)$', v):
+ v = (v == "true")
# strip currency prefix and munge into float
if re.search(r'Price$', k):
@@ -405,7 +409,7 @@ class GsxObject(object):
# Convert timestamps to native Python type
# 18-Jan-13 14:38:04
if re.search(r'TimeStamp$', k):
- v = datetime.strptime(v, '%d-%b-%y %H:%M:%S')
+ v = datetime.strptime(v, "%d-%b-%y %H:%M:%S")
if re.search(r'Date$', k):
# looks like some sort of date, let's try to convert
@@ -513,10 +517,10 @@ if __name__ == '__main__':
parser.add_argument("user_id")
parser.add_argument("password")
parser.add_argument("sold_to")
- parser.add_argument("--language", default='en')
- parser.add_argument("--timezone", default='CEST')
- parser.add_argument("--environment", default='it')
- parser.add_argument("--region", default='emea')
+ parser.add_argument("--language", default="en")
+ parser.add_argument("--timezone", default="CEST")
+ parser.add_argument("--environment", default="it")
+ parser.add_argument("--region", default="emea")
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG)
diff --git a/gsxws/products.py b/gsxws/products.py
index 04d3fee..d3c1860 100644
--- a/gsxws/products.py
+++ b/gsxws/products.py
@@ -99,7 +99,7 @@ class Product(GsxObject):
fetch activation details of iOS Devices.
>>> Product('013348005376007').activation().unlocked
- 'true'
+ True
>>> Product('W874939YX92').activation().unlocked # doctest: +ELLIPSIS
Traceback (most recent call last):
...
@@ -107,7 +107,8 @@ class Product(GsxObject):
"""
self._namespace = "glob:"
act = self._submit("FetchIOSActivationDetailsRequest",
- "FetchIOSActivationDetails")
+ "FetchIOSActivationDetails",
+ "activationDetailsInfo")
return act
diff --git a/gsxws/returns.py b/gsxws/returns.py
index e929f1d..f46690e 100644
--- a/gsxws/returns.py
+++ b/gsxws/returns.py
@@ -102,8 +102,10 @@ class Return(GsxObject):
>>> Return(shipToCode=123456).register_parts([ServicePart('661-5852')])
"""
self.bulkReturnOrder = parts
- self._submit("bulkPartsRegistrationRequest", "RegisterPartsForBulkReturn",
+ self._submit("bulkPartsRegistrationRequest",
+ "RegisterPartsForBulkReturn",
"bulkPartsRegistrationData")
+
return self._req.objects[0]
def update_parts(self, confirmation, parts):
@@ -118,14 +120,12 @@ class Return(GsxObject):
'comptiaModifier': 'A',\
'returnType': 2}])
"""
- dt = self._make_type("ns1:partsReturnUpdateRequestType")
- repairData = {
- 'repairConfirmationNumber': confirmation,
- 'orderLines': parts
- }
- dt.repairData = repairData
- result = self.submit("PartsReturnUpdate", dt)
- return result
+ rd = GsxObject(repairConfirmationNumber=confirmation)
+ rd.orderLines = parts
+ self.repairData = rd
+ self._submit("repairData", "UpdateCarryIn", "repairConfirmation")
+ return self._req.objects[0]
+
if __name__ == '__main__':
import sys