Esempio n. 1
0
 def second_class_offers(self):
     if not from_dict(self._data, ['secondClassOffers']):
         return []
     offer_list = []
     for offer in from_dict(self._data, ['secondClassOffers', 'offers']):
         if offer != None:
             offer_list.append(TravelOffer(offer, self))
     return offer_list
Esempio n. 2
0
 def fares(self):
     fare_list = []
     for fare in from_dict(self._json, ['fares']):
         fare_list.append(Fare(fare))
     return fare_list
Esempio n. 3
0
 def travels(self):
     travel_list = []
     for travel in from_dict(self._json, ['travelProposals']):
         travel_list.append(Travel(travel))
     return travel_list
Esempio n. 4
0
 def fare_code(self):
     return from_dict(self._data, ['metaData', 'MI', 'code'])
Esempio n. 5
0
 def mi_id(self):
     try:
         return from_dict(self._data, ['metaData', 'MI', 'miId'])
     except ValueError:
         return from_dict(self._data, ['metaData', 'MI', 'id'])
Esempio n. 6
0
 def id(self):
     return from_dict(self._data, ['id'])
Esempio n. 7
0
 def return_mandatory(self):
     return from_dict(self._data, ['returnMandatory'])
Esempio n. 8
0
 def fare_id(self):
     "return the fare id of the travel"
     return from_dict(self._data, ['passengerOfferBySegment', 0, 'idFare'])
Esempio n. 9
0
 def amount(self) -> int:
     return from_dict(self._data, 'amount')
Esempio n. 10
0
 def id(self) -> str:
     return from_dict(self._data, 'id')
Esempio n. 11
0
 def id(self) -> str:
     "return uuid of the travel"
     return from_dict(self._data, ['id'])
Esempio n. 12
0
 def departure_date(self) -> datetime.datetime:
     "return arrival date of the travel in datetime format"
     return datetime.datetime.strptime(
         from_dict(self._data, ['departureDate']), "%Y-%m-%dT%H:%M:%S")
Esempio n. 13
0
 def functional_id(self) -> str:
     "return functionalId of the travel"
     return from_dict(self._data, ['functionalId'])
Esempio n. 14
0
 def duration(self) -> int:
     "return duration in second"
     return from_dict(self._data, ['duration'])
Esempio n. 15
0
 def destination(self) -> Station:
     "Return station object of travel destination"
     return Station(
         from_dict(self._data,
                   ['destination', 'station', 'metaData', 'MI', 'code']))
Esempio n. 16
0
 def origin(self) -> Station:
     "Return station object of travel origin"
     return Station(
         from_dict(self._data,
                   ['origin', 'station', 'metaData', 'MI', 'code']))