Class: DiasporaFederation::Federation::Receiver::AbstractReceiver

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/diaspora_federation/federation/receiver/abstract_receiver.rb

Overview

Common functionality for receivers

Direct Known Subclasses

Private, Public

Instance Method Summary collapse

Methods included from Logging

included

Constructor Details

#initialize(magic_envelope, recipient_id = nil) ⇒ AbstractReceiver

Creates a new receiver



11
12
13
14
15
# File 'lib/diaspora_federation/federation/receiver/abstract_receiver.rb', line 11

def initialize(magic_envelope, recipient_id=nil)
  @entity = magic_envelope.payload
  @sender = magic_envelope.sender
  @recipient_id = recipient_id
end

Instance Method Details

#receiveObject

Validates and receives the entity



18
19
20
21
22
23
# File 'lib/diaspora_federation/federation/receiver/abstract_receiver.rb', line 18

def receive
  validate_and_receive
rescue => e # rubocop:disable Style/RescueStandardError
  logger.error "failed to receive #{entity}"
  raise e
end