From 83097572ce707c973d6287528a604d5025081859 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Mon, 20 Jul 2015 04:02:08 +0200 Subject: [PATCH] refactor discovery: return entities instead of hashes --- lib/diaspora_federation/discovery/discovery.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/diaspora_federation/discovery/discovery.rb b/lib/diaspora_federation/discovery/discovery.rb index 82bbb92..079b6fd 100644 --- a/lib/diaspora_federation/discovery/discovery.rb +++ b/lib/diaspora_federation/discovery/discovery.rb @@ -21,7 +21,7 @@ module DiasporaFederation raise DiscoveryError, "Handle does not match: Wanted #{handle} but got #{clean_handle(webfinger.acct_uri)}" end - Entities::Person.new(person_hash) + person end private @@ -64,18 +64,18 @@ module DiasporaFederation @hcard ||= HCard.from_html get(webfinger.hcard_url) end - def person_hash - { + def person + Entities::Person.new( guid: hcard.guid || webfinger.guid, diaspora_handle: handle, url: webfinger.seed_url, exported_key: hcard.public_key || webfinger.public_key, - profile: Entities::Profile.new(profile_hash) - } + profile: profile + ) end - def profile_hash - { + def profile + Entities::Profile.new( diaspora_handle: handle, first_name: hcard.first_name, last_name: hcard.last_name, @@ -83,7 +83,7 @@ module DiasporaFederation image_url_medium: hcard.photo_medium_url, image_url_small: hcard.photo_small_url, searchable: hcard.searchable - } + ) end end end