From 287a6b4985ed3a36be71e038d4ee6910afe6678b Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 23 Mar 2010 11:54:50 +0100 Subject: [PATCH] added the ICapTravel capability --- weboob/capabilities/travel.py | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 weboob/capabilities/travel.py diff --git a/weboob/capabilities/travel.py b/weboob/capabilities/travel.py new file mode 100644 index 00000000..f470462f --- /dev/null +++ b/weboob/capabilities/travel.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +""" +Copyright(C) 2010 Romain Bignon + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" + +class ICapTravel: + def iter_station_search(self, pattern): + """ + Iterates on search results of stations. + + @param pattern [str] the search pattern + @return [iter] the of Station objects + """ + raise NotImplementedError() + + def iter_station_departures(self, station_id): + """ + Iterate on departures. + + @param station_id [id] the station id + @return [iter] result of Departure objects + """ + raise NotImplementedError() + +class Station(object): + def __init__(self, _id, name): + self.id = _id + self.name = name + + def __repr__(self): + return "" % (self.id, self.name) + +class Departure(object): + def __init__(self, _id, _type, _time): + self.id = _id + self.type = _type + self.time = _time + self.departure_station = u'' + self.arrival_station = u'' + self.information = u'' + + def __repr__(self): + return "" % (self.id, + self.type, + self.time.strftime('%H:%M'), + self.departure_station, + self.arrival_station)