aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/repairs.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-05-20 09:49:00 +0300
committerFilipp Lepalaan <f@230.to>2013-05-20 09:49:00 +0300
commit827c62eed77440367cc6b631bb567e05d4ece713 (patch)
treee6e46551cd06ed095566eb60906989a4d8b63507 /gsxws/repairs.py
parent1b8089d3307df99e5e12e961ada11072a9c3461e (diff)
downloadpy-gsxws-827c62eed77440367cc6b631bb567e05d4ece713.tar.gz
py-gsxws-827c62eed77440367cc6b631bb567e05d4ece713.tar.bz2
py-gsxws-827c62eed77440367cc6b631bb567e05d4ece713.zip
Added ServicePart
Diffstat (limited to 'gsxws/repairs.py')
-rw-r--r--gsxws/repairs.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/gsxws/repairs.py b/gsxws/repairs.py
index 4d0d1f5..c04c79f 100644
--- a/gsxws/repairs.py
+++ b/gsxws/repairs.py
@@ -3,7 +3,7 @@ import re
import sys
import logging
-from core import GsxObject
+from core import GsxObject, validate
from lookups import Lookup
REPAIR_TYPES = (
@@ -42,6 +42,17 @@ class RepairOrderLine(GsxObject):
comptiaModifier = ""
+class ServicePart(GsxObject):
+ "A generic service part (for PartInfo and whatnot)"
+ def __init__(self, number, *args, **kwargs):
+ super(ServicePart, self).__init__(*args, **kwargs)
+
+ if not validate(number, "partNumber"):
+ raise ValueError("Invalid part number: %s" % number)
+
+ self.partNumber = number
+
+
class Repair(GsxObject):
"Base class for the different GSX Repair types"
_namespace = "asp:"
@@ -61,6 +72,8 @@ class Repair(GsxObject):
Context:
The API is not applicable for whole unit replacement
serial number entry (see KGB serial update).
+
+ >>> Repair('G135762375').update_sn(ServicePart('661-4964', oldSerialNumber='W882300FK22YA'))
"""
self.partInfo = parts
if hasattr(self, "dispatchId"):
@@ -230,5 +243,5 @@ if __name__ == '__main__':
import doctest
from core import connect
logging.basicConfig(level=logging.DEBUG)
- connect(*sys.argv[1:4])
+ connect(*sys.argv[1:])
doctest.testmod()