Class: InstagramConnect::Ingest::Handlers::Base
- Inherits:
-
Object
- Object
- InstagramConnect::Ingest::Handlers::Base
- 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.
Direct Known Subclasses
Comments, Mentions, MessageReactions, Messages, MessagingHandover, MessagingOptins, MessagingPostbacks, MessagingReferral, MessagingSeen, StoryInsights, Unknown
Instance Attribute Summary collapse
-
#notification ⇒ Object
readonly
The host callback this handler wants fired, and its argument.
Class Method Summary collapse
-
.dedupe_key(_event) ⇒ Object
Meta's own identifier for this event, used as the dedupe claim.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(envelope) ⇒ Base
constructor
A new instance of Base.
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
#notification ⇒ Object (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
#call ⇒ Object
28 29 30 |
# File 'lib/instagram_connect/ingest/handlers/base.rb', line 28 def call raise NotImplementedError end |