def __init__(self, sn, **kwargs): if validate(sn, 'alternateDeviceId'): self.alternateDeviceId = sn self._gsx = GsxObject(alternateDeviceId=sn) else: self.serialNumber = sn self._gsx = GsxObject(serialNumber=sn) self._gsx._namespace = "glob:"
def warranty(self, parts=[], date_received=None, ship_to=None): """ 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('DGKFL06JDHJP').warranty().warrantyStatus 'Out Of Warranty (No Coverage)' >>> Product('DGKFL06JDHJP').warranty().estimatedPurchaseDate.pyval '06/02/11' >>> Product('WQ8094DW0P1').warranty().blaa # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: no such child: blaa >>> Product('WQ8094DW0P1').warranty([(u'661-5070', u'Z26',)]).warrantyStatus 'Out Of Warranty (No Coverage)' """ if self.should_check_activation: ad = self.activation() self._gsx.serialNumber = ad.serialNumber # "Please enter either a serial number or an IMEI number but not both." self._gsx.unset('alternateDeviceId') if ship_to is not None: self._gsx.shipTo = ship_to try: self._gsx.partNumbers = [] for k, v in parts: part = GsxObject(partNumber=k, comptiaCode=v) self._gsx.partNumbers.append(part) except Exception: pass if date_received is not None: self._gsx.unitReceivedDate = date_received self._gsx._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo") self.warrantyDetails = self._gsx._req.objects self.imageURL = self.warrantyDetails.imageURL self.productDescription = self.warrantyDetails.productDescription self.description = self.productDescription.lstrip('~VIN,') self.repair_strategies = [] try: for i in self.warrantyDetails.availableRepairStrategies: self.repair_strategies.append(i.availableRepairStrategy) except (AttributeError, TypeError): pass return self.warrantyDetails
def warranty(self, parts=[]): """ 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('DGKFL06JDHJP').warranty().warrantyStatus 'Out Of Warranty (No Coverage)' >>> Product('DGKFL06JDHJP').warranty().estimatedPurchaseDate.pyval '06/02/11' >>> Product('WQ8094DW0P1').warranty().blaa # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: no such child: blaa >>> Product('WQ8094DW0P1').warranty([(u'661-5070', u'Z26',)]).warrantyStatus 'Out Of Warranty (No Coverage)' """ if self.should_check_activation: self.activation() try: self._gsx.partNumbers = [] for k, v in parts: part = GsxObject(partNumber=k, comptiaCode=v) self._gsx.partNumbers.append(part) except Exception: pass self._gsx._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo") self.warrantyDetails = self._gsx._req.objects self.imageURL = self.warrantyDetails.imageURL self.productDescription = self.warrantyDetails.productDescription self.description = self.productDescription.lstrip('~VIN,') return self.warrantyDetails
def ack(id, status): ack = GsxObject(articleID=id) ack.acknowledgeType = status return Communication(acknowledgement=ack).acknowledge()