diff --git a/src/ivago/controller/pickup_times.rs b/src/ivago/controller/pickup_times.rs index 2434713..7e8d3fb 100644 --- a/src/ivago/controller/pickup_times.rs +++ b/src/ivago/controller/pickup_times.rs @@ -51,6 +51,7 @@ impl TryFrom<&str> for BasicDate { match re.captures(s) { None => Err(()), Some(caps) => Ok(BasicDate { + // TODO change this to ? operator if possible year: caps.get(1).unwrap().as_str().parse().unwrap(), month: caps.get(2).unwrap().as_str().parse().unwrap(), day: caps.get(3).unwrap().as_str().parse().unwrap(), @@ -86,12 +87,9 @@ impl Serialize for PickupTime { where S: Serializer, { - let mut s = serializer.serialize_struct("PickupTime", 4)?; + let mut s = serializer.serialize_struct("PickupTime", 2)?; s.serialize_field("date", &self.date)?; s.serialize_field("label", &self.label)?; - s.serialize_field("classes", &self.classes)?; - s.serialize_field("url", &self.url)?; - s.end() } } @@ -101,8 +99,6 @@ impl Serialize for PickupTime { pub struct PickupTime { date: BasicDate, label: String, - classes: Vec, - url: String, } pub fn get_pickup_times( @@ -142,13 +138,6 @@ pub fn get_pickup_times( // TODO should I check here if the parsing worked? date: BasicDate::try_from(map.get("date").unwrap().as_str()).unwrap(), label: map.get("label").unwrap().to_string(), - classes: map - .get("classes") - .unwrap() - .split_whitespace() - .map(|x| String::from(x)) - .collect(), - url: map.get("url").unwrap().to_string(), }) }