Class: InstagramConnect::Ingest::Handlers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/instagram_connect/ingest/handlers/base.rb

Overview

A handler turns one webhook event into persisted rows and returns the row it produced (or nil), which the dispatcher records on the ledger so an operator can trace an event to its result.

Subclasses implement .dedupe_key and #call.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(envelope) ⇒ Base

Returns a new instance of Base.



23
24
25
26
# File 'lib/instagram_connect/ingest/handlers/base.rb', line 23

def initialize(envelope)
  @envelope = envelope
  @notification = nil
end

Instance Attribute Details

#notificationObject (readonly)

The host callback this handler wants fired, and its argument. Read by the dispatcher after #call returns, so the callback runs outside the handler in its own rescue: a host hook must never roll back an ingest whose data is already stored.



21
22
23
# File 'lib/instagram_connect/ingest/handlers/base.rb', line 21

def notification
  @notification
end

Class Method Details

.dedupe_key(_event) ⇒ Object

Meta's own identifier for this event, used as the dedupe claim. Nil means the event carries no stable id and the dispatcher falls back to hashing the payload.



13
14
15
# File 'lib/instagram_connect/ingest/handlers/base.rb', line 13

def self.dedupe_key(_event)
  nil
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/instagram_connect/ingest/handlers/base.rb', line 28

def call
  raise NotImplementedError
end