Module: DiasporaFederation::Federation::Fetcher
- Defined in:
- lib/diaspora_federation/federation/fetcher.rb
Overview
This module is for fetching entities from other pods.
Defined Under Namespace
Classes: NotFetchable
Class Method Summary collapse
-
.fetch_public(author, entity_type, guid) ⇒ Object
Fetches a public entity from a remote pod.
Class Method Details
.fetch_public(author, entity_type, guid) ⇒ Object
Fetches a public entity from a remote pod
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/diaspora_federation/federation/fetcher.rb', line 9 def self.fetch_public(, entity_type, guid) url = DiasporaFederation.callbacks.trigger( :fetch_person_url_to, , "/fetch/#{entity_name(entity_type)}/#{guid}" ) response = HttpClient.get(url) raise "Failed to fetch #{url}: #{response.status}" unless response.success? magic_env_xml = Nokogiri::XML::Document.parse(response.body).root magic_env = Salmon::MagicEnvelope.unenvelop(magic_env_xml) Receiver::Public.new(magic_env).receive rescue => e raise NotFetchable, "Failed to fetch #{entity_type}:#{guid} from #{}: #{e.class}: #{e.}" end |