aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-03-18 20:41:01 +0200
committerFilipp Lepalaan <f@230.to>2013-03-18 20:41:01 +0200
commit3398e23fae2f8d8edeca06241f43ad1b63defb1d (patch)
treed8895ad4cef733b314f034727838a7c14cefad7e /gsxws.py
parentbcd1811204bfbb673ada35bd78d3bdb69c7557e6 (diff)
downloadpy-gsxws-3398e23fae2f8d8edeca06241f43ad1b63defb1d.tar.gz
py-gsxws-3398e23fae2f8d8edeca06241f43ad1b63defb1d.tar.bz2
py-gsxws-3398e23fae2f8d8edeca06241f43ad1b63defb1d.zip
Implementing update_carryin
Diffstat (limited to 'gsxws.py')
-rwxr-xr-xgsxws.py45
1 files changed, 22 insertions, 23 deletions
diff --git a/gsxws.py b/gsxws.py
index f46bcb6..f8b3ff8 100755
--- a/gsxws.py
+++ b/gsxws.py
@@ -338,7 +338,7 @@ class GsxError(Exception):
def __getitem__(self, idx):
return self.data[idx]
-
+
def __repr__(self):
print self.data
@@ -382,12 +382,22 @@ class Diagnostics(GsxObject):
if "alternateDeviceId" in self.data:
dt = self._make_type("ns3:fetchIOSDiagnosticRequestType")
dt.lookupRequestData = self.data
- result = CLIENT.service.FetchIOSDiagnostic(dt)
+
+ try:
+ result = CLIENT.service.FetchIOSDiagnostic(dt)
+ except suds.WebFault, e:
+ raise GsxError(fault=e)
+
root = ET.fromstring(result).findall('*//%s' % 'FetchIOSDiagnosticResponse')[0]
else:
dt = self._make_type('ns3:fetchRepairDiagnosticRequestType')
dt.lookupRequestData = self.data
- result = CLIENT.service.FetchRepairDiagnostic(dt)
+
+ try:
+ result = CLIENT.service.FetchRepairDiagnostic(dt)
+ except suds.WebFault, e:
+ raise GsxError(fault=e)
+
root = ET.fromstring(result).findall('*//%s' % 'FetchRepairDiagnosticResponse')[0]
return GsxResponse.Process(root)
@@ -530,6 +540,7 @@ class Repair(GsxObject):
"""
dt = self._make_type('ns2:carryInRequestType')
dt.repairData = self.data
+
return self.submit('CreateCarryInRepair', dt, 'repairConfirmation')
def create_cnd(self):
@@ -547,7 +558,7 @@ class Repair(GsxObject):
"""
pass
- def update_carryin(self):
+ def update_carryin(self, newdata):
"""
The Update Carry-In Repair API allows the service providers
to update the existing open carry-in repairs.
@@ -562,7 +573,12 @@ class Repair(GsxObject):
BEGR In Repair
RFPU Ready for Pickup
"""
- pass
+ dt = self._make_type('ns1:updateCarryInRequestType')
+ dt.repairData = dict(self.data.items() + newdata.items())
+ result = CLIENT.service.CarryInRepairUpdate(dt)
+ print result
+ return result
+ #return self.submit('CarryInRepairUpdate', dt)
def update_kgb_sn(self, sn):
"""
@@ -788,22 +804,5 @@ if __name__ == '__main__':
parser.add_argument('--timezone', default='CEST')
parser.add_argument('--environment', default='pr')
parser.add_argument('--region', default='emea')
- args = parser.parse_args()
-
- #connect(**vars(args))
-
- #f = 'tests/create_carryin_repair.json'
- #f = 'tests/warranty_status.json'
- #f = 'tests/fetch_ios_activation.json'
- #f = 'tests/update_escalation.json'
- #fp = open(f, 'r')
- #data = json.load(fp)
-
- #try:
- # print Escalation(**data).update()
- #except GsxError, e:
- # print e.code, e.message
- #data['requestReviewByApple'] = False
- #rep = Repair(dispatchId='')
- #print rep.update_kgb_sn('')
+ args = parser.parse_args()