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

Class Method Details

.fetch_public(author, entity_type, guid) ⇒ Object

Fetches a public entity from a remote pod

Parameters:

  • author (String)

    the diaspora* ID of the author of the entity

  • entity_type (Symbol, String)

    snake_case version of the entity class

  • guid (String)

    guid of the entity to fetch

Raises:



12
13
14
15
16
17
18
19
# File 'lib/diaspora_federation/federation/fetcher.rb', line 12

def self.fetch_public(author, entity_type, guid)
  type = entity_name(entity_type).to_s
  raise "Already fetching ..." if fetching[type].include?(guid)

  fetch_from_url(author, type, guid)
rescue => e # rubocop:disable Style/RescueStandardError
  raise NotFetchable, "Failed to fetch #{entity_type}:#{guid} from #{author}: #{e.class}: #{e.message}"
end