reworking of the ICapParcel API (new name of ICapPackageTracking)

This commit is contained in:
Romain Bignon 2013-07-27 21:32:05 +02:00
commit 5c95363ac1
6 changed files with 65 additions and 32 deletions

View file

@ -21,19 +21,34 @@
from .base import IBaseCap, CapBaseObject, Field, StringField, DateField
class Location(CapBaseObject):
name = StringField('Location name')
class Event(CapBaseObject):
date = DateField('Date')
activity = StringField('Activity')
location = StringField('Location')
def __repr__(self):
return u'<Location name=%r date=%r activity=%r>' % (self.name, self.date, self.activity)
return u'<Event date=%r activity=%r location=%r>' % (self.date, self.activity, self.location)
class Parcel(CapBaseObject):
STATUS_UNKNOWN = 0
STATUS_PLANNED = 1
STATUS_IN_TRANSIT = 2
STATUS_ARRIVED = 3
class Package(CapBaseObject):
arrival = DateField('Scheduled arrival date')
status = Field('Status of parcel', int, default=STATUS_UNKNOWN)
info = StringField('Information about parcel status')
history = Field('History', list)
class ICapPackageTracking(IBaseCap):
def track_package(self, id):
class ICapParcel(IBaseCap):
def get_parcel_tracking(self, id):
"""
Get information abouut a parcel.
:param id: ID of the parcel
:type id: :class:`str`
:rtype: :class:`Parcel`
"""
raise NotImplementedError()