aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/products.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-06-09 12:13:45 +0300
committerFilipp Lepalaan <f@230.to>2013-06-09 12:13:45 +0300
commit1f4ac1d6144dd79606942a742530845658309463 (patch)
tree48e5b6944984fc2a24c145b30265699075af4780 /gsxws/products.py
parentf454cc6167cd7d91297d6b24187193888ed719ee (diff)
downloadpy-gsxws-1f4ac1d6144dd79606942a742530845658309463.tar.gz
py-gsxws-1f4ac1d6144dd79606942a742530845658309463.tar.bz2
py-gsxws-1f4ac1d6144dd79606942a742530845658309463.zip
Make previous change pass some tests
Diffstat (limited to 'gsxws/products.py')
-rw-r--r--gsxws/products.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/gsxws/products.py b/gsxws/products.py
index d3c1860..96352f1 100644
--- a/gsxws/products.py
+++ b/gsxws/products.py
@@ -11,7 +11,7 @@ from core import GsxObject, GsxError
def models():
"""
>>> models() # doctest: +ELLIPSIS
- {'iphone_acc': {'models': 'Bluetooth Headset',...
+ {'MAC_ACC': {'models': ['AirPort Card', ...
"""
import os
import yaml
@@ -48,28 +48,28 @@ class Product(GsxObject):
>>> Product('DGKFL06JDHJP').warranty().warrantyStatus
u'Out Of Warranty (No Coverage)'
>>> Product('DGKFL06JDHJP').warranty().estimatedPurchaseDate
- '2011-06-02'
+ datetime.date(2011, 6, 2)
"""
self._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo")
- self.warrantyDetails = self._req.objects[0]
+ self.warrantyDetails = self._req.objects
return self.warrantyDetails
def parts(self):
"""
>>> Product('DGKFL06JDHJP').parts() # doctest: +ELLIPSIS
- [<core.GsxObject object at ...
+ {'exchangePrice': '0', 'isSerialized': 'N', 'partType': 'Other',...
>>> Product(productName='MacBook Pro (17-inch, Mid 2009)').parts() # doctest: +ELLIPSIS
- [<core.GsxObject object at ...
+ {'exchangePrice': '0', 'isSerialized': 'N', 'partType': 'Other',...
"""
- if hasattr(self, "serialNumber"):
+ try:
return Lookup(serialNumber=self.serialNumber).parts()
- else:
+ except AttributeError:
return Lookup(productName=self.productName).parts()
def repairs(self):
"""
>>> Product(serialNumber='DGKFL06JDHJP').repairs() # doctest: +ELLIPSIS
- <core.GsxObject object at ...
+ {'customerName': 'Lepalaan,Filipp',...
"""
return Lookup(serialNumber=self.serialNumber).repairs()