diff options
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/products.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gsxws/products.py b/gsxws/products.py index de83b25..38a0b7a 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -3,6 +3,7 @@ """ https://gsxwsut.apple.com/apidocs/ut/html/WSAPIChangeLog.html?user=asp """ +import re import urllib from lookups import Lookup @@ -25,7 +26,7 @@ class Product(object): """ Something serviceable made by Apple """ - def __init__(self, sn): + def __init__(self, sn, **kwargs): if validate(sn, 'alternateDeviceId'): self.alternateDeviceId = sn self._gsx = GsxObject(alternateDeviceId=sn) @@ -157,10 +158,18 @@ class Product(object): return ad.unlocked or ("unlock" in policy) @property + def is_locked(self): + return not self.is_unlocked() + + @property def should_check_activation(self): return hasattr(self, "alternateDeviceId") and not hasattr(self, "serialNumber") @property + def is_mac(self): + return re.match(r'^i?Mac', self.description) + + @property def is_iphone(self): return self.description.startswith('iPhone') @@ -182,10 +191,6 @@ class Product(object): return title.startswith('~VIN,') @property - def is_locked(self): - return not self.is_unlocked() - - @property def parts_covered(self): return self.warrantyDetails.partCovered is True |