diff options
Diffstat (limited to 'src/guilds.rs')
-rw-r--r-- | src/guilds.rs | 9 |
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) } |