aboutsummaryrefslogtreecommitdiff
path: root/src/guilds.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2021-11-12 13:10:14 +0100
committerDaniel <kingdread@gmx.de>2021-11-12 13:10:14 +0100
commit14d90bcbe6cef70d0ab99cb3285038fbd6385efa (patch)
tree6978fc122e4e6ce905b0773921315c776de08cff /src/guilds.rs
parent96187a020266cb07d516bb851ede988d7dea2be2 (diff)
downloadraidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.tar.gz
raidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.tar.bz2
raidgrep-14d90bcbe6cef70d0ab99cb3285038fbd6385efa.zip
Update dependencies
Only minor changes are needed.
Diffstat (limited to 'src/guilds.rs')
-rw-r--r--src/guilds.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/guilds.rs b/src/guilds.rs
index 24ec817..e847841 100644
--- a/src/guilds.rs
+++ b/src/guilds.rs
@@ -39,16 +39,11 @@ pub fn lookup(api_id: &str) -> Option<Guild> {
let mut cache = CACHE.write().unwrap();
let url = format!("https://api.guildwars2.com/v2/guild/{}", api_id);
- let result = ureq::get(&url)
+ let guild: Guild = ureq::get(&url)
.call()
+ .ok()?
.into_json()
.expect("Invalid JSON in API response");
- let name = result["name"].as_str()?;
- let tag = result["tag"].as_str()?;
- let guild = Guild {
- tag: tag.into(),
- name: name.into(),
- };
cache.insert(api_id.into(), guild.clone());
Some(guild)
}