aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-14 18:30:56 +0200
committerTeddy Wing2018-04-14 18:30:56 +0200
commitef3a5a6ee6d878503a0c781db676592e3c4f54fa (patch)
tree35c7d058941eaad8fd6a278a1d7919eb4d1115d2
parentd960c2d1b778e2f01ee174ce31474084397d4cc3 (diff)
downloadmeetup-find-events-rss-ef3a5a6ee6d878503a0c781db676592e3c4f54fa.tar.bz2
find_upcoming_events(): Try to parse data from the Meetup API
* Clone the token so we can use it without a borrow error * Get the response text from our request to the API and try to parse it This gives me the following panic: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("invalid type: null, expected a sequence"), line: 0, column: 0 }', libcore/result.rs:945:5 Still trying to figure out where my problem is.
-rw-r--r--meetup/src/client.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/meetup/src/client.rs b/meetup/src/client.rs
index f47c439..6f98a1f 100644
--- a/meetup/src/client.rs
+++ b/meetup/src/client.rs
@@ -24,9 +24,8 @@ impl Client {
radius: Option<String>,
page: Option<String>,
) -> Result<Vec<Event>, Box<Error>> {
- let json = include_str!("../testdata/meetup--find-upcoming_events.json").to_owned();
-
let mut params = vec![
+ ("key", self.token.clone()),
("lat", latitude),
("lon", longitude),
("end_date_range", end_date_range),
@@ -42,11 +41,13 @@ impl Client {
}
let client = reqwest::Client::new();
- client.get(&format!("{}{}", MEETUP_BASE_URL, "/find/upcoming_events"))
+ let response_text = client
+ .get(&format!("{}{}", MEETUP_BASE_URL, "/find/upcoming_events"))
.query(&params)
- .send()?;
+ .send()?
+ .text()?;
- Ok(parse_json(json)?)
+ Ok(parse_json(response_text)?)
}
}