-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone.py
29 lines (24 loc) · 1.08 KB
/
phone.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import ebay_constants
class Phone(object):
def __init__(self, model, brand, cond, carrier, storage_capacity=None,
color=None):
self.model = model
self.brand = brand
self.cond = cond
self.carrier = carrier
self.storage_capacity = storage_capacity
self.color = color
@property
def ebay_cond(self):
return {
ebay_constants.kConditionKeyNew: ebay_constants.kConditionValueNew,
ebay_constants.kConditionKeyNewOther: ebay_constants.kConditionValueNewOther,
ebay_constants.kConditionKeyManufacturerRefurbished: ebay_constants.kConditionValueManufacturerRefurbished,
ebay_constants.kConditionKeySellerRefurbished: ebay_constants.kConditionValueSellerRefurbished,
ebay_constants.kConditionKeyUsed: ebay_constants.kConditionValueUsed,
ebay_constants.kConditionKeyForParts: ebay_constants.kConditionValueForParts,
}[self.cond]
def ToString(self):
attrs = [self.model, self.brand, self.cond, self.carrier,
self.storage_capacity, self.color]
return ' '.join([attr for attr in attrs if attr is not None])