diff options
author | Filipp Lepalaan <f@230.to> | 2013-05-12 22:34:53 +0300 |
---|---|---|
committer | Filipp Lepalaan <f@230.to> | 2013-05-12 22:34:53 +0300 |
commit | aaacaebb861beaf2ef39b6bc54db2d12262e9b0d (patch) | |
tree | 2d373fc7d04ab03f87bfe5e4d13f36d6d7bc81a5 /products.py | |
parent | 452005bbb83059913d4c8b7648d9e368936e53da (diff) | |
download | py-gsxws-aaacaebb861beaf2ef39b6bc54db2d12262e9b0d.tar.gz py-gsxws-aaacaebb861beaf2ef39b6bc54db2d12262e9b0d.tar.bz2 py-gsxws-aaacaebb861beaf2ef39b6bc54db2d12262e9b0d.zip |
More speed, more power, less suds, WIP
Diffstat (limited to 'products.py')
-rw-r--r-- | products.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/products.py b/products.py deleted file mode 100644 index dc878f8..0000000 --- a/products.py +++ /dev/null @@ -1,65 +0,0 @@ -import sys -import suds -from gsxws import connect, GsxError -from repairs import GsxObject -from lookups import Lookup - - -class GsxRequest(object): - def submit(self, method, data, attr=None): - "Submits the SOAP envelope" - from gsxws import CLIENT, SESSION - f = getattr(CLIENT.service, method) - - try: - result = f(data) - return getattr(result, attr) if attr else result - except suds.WebFault, e: - raise GsxError(fault=e) - - -class Product(GsxObject, GsxRequest): - "Something serviceable that Apple makes" - serialNumber = "" - alternateDeviceId = "" - configDescription = "" - - def model(self): - """ - Returns the model description of this Product - - >>> Product(serialNumber='DGKFL06JDHJP').model().configDescription - iMac (27-inch, Mid 2011) - """ - dt = self._make_type("ns3:fetchProductModelRequestType") - dt.productModelRequest = self.data - result = self.submit('FetchProductModel', dt, "productModelResponse")[0] - self.configDescription = result.configDescription - self.productLine = result.productLine - self.configCode = result.configCode - return result - - def warranty(self): - """ - The Warranty Status API retrieves the same warranty details - displayed on the GSX Coverage screen. - If part information is provided, the part warranty information is returned. - If you do not provide the optional part information in the - warranty status request, the unit level warranty information is returned. - - >>> Product(serialNumber='DGKFL06JDHJP').warranty().warrantyStatus - Out Of Warranty (No Coverage) - """ - dt = self._make_type("ns3:warrantyStatusRequestType") - dt.unitDetail = self.data - result = self.submit("WarrantyStatus", dt, "warrantyDetailInfo") - return result - - @property - def parts(self): - pass - -if __name__ == '__main__': - import doctest - connect(*sys.argv[1:4]) - doctest.testmod() |