aboutsummaryrefslogtreecommitdiffstats
path: root/gsxws/products.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-12-10 10:41:58 +0200
committerFilipp Lepalaan <f@230.to>2013-12-10 10:41:58 +0200
commitef5a2503979100537d92a558a173f5ec32716988 (patch)
treeeaf543096b6cb20d43190510af80f42b1fe54074 /gsxws/products.py
parent5e5946542b3b1fcf8d32165d4d45cb640b7e62c0 (diff)
downloadpy-gsxws-ef5a2503979100537d92a558a173f5ec32716988.tar.gz
py-gsxws-ef5a2503979100537d92a558a173f5ec32716988.tar.bz2
py-gsxws-ef5a2503979100537d92a558a173f5ec32716988.zip
Added is_mac property
Diffstat (limited to 'gsxws/products.py')
-rw-r--r--gsxws/products.py15
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