From 5c62300e6e287dfa005bf6ec059e550ef35bc4b4 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 11 Mar 2021 21:12:55 +0100 Subject: [PATCH] Added chrono as dep --- Cargo.lock | 33 +++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/ivago/controller.rs | 27 +++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dc408b..192035a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -122,6 +122,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + [[package]] name = "cipher" version = "0.2.5" @@ -388,6 +401,25 @@ dependencies = [ "log 0.3.9", ] +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.13.0" @@ -570,6 +602,7 @@ dependencies = [ name = "rust-api" version = "0.1.0" dependencies = [ + "chrono", "rocket", ] diff --git a/Cargo.toml b/Cargo.toml index 9f17c22..475de63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,4 @@ edition = "2018" [dependencies] rocket = "0.4.7" +chrono = "0.4.19" diff --git a/src/ivago/controller.rs b/src/ivago/controller.rs index 8aeef86..97d882c 100644 --- a/src/ivago/controller.rs +++ b/src/ivago/controller.rs @@ -1,9 +1,32 @@ +use chrono::NaiveDate; + + /// Searches the Ivago API for streets in the given city /// /// # Arguments /// -/// * `street` -name of the street +/// * `street` - name of the street /// * `city` - city the street is in -pub fn search_streets(street: String, city: String) -> Vec { +pub fn search_streets(street: String, city: Option) -> Vec { + Vec::new() +} + + +/// Represents a pickup time instance. All fields are a direct map of the +/// original API +pub struct PickupTime { + date: NaiveDate, + label: String, + classes: Vec, + url: String +} + +/// Return the known pickup times for the given street and/or city +/// +/// # Arguments +/// +/// * `street` - name of the street +/// * `city` - city the street is in +pub fn get_pickup_times(street: String, city: String) -> Vec { Vec::new() }