Class: Nfe::WebhookEvent
- Inherits:
-
Data
- Object
- Data
- Nfe::WebhookEvent
- Defined in:
- lib/nfe/webhook_event.rb,
sig/nfe/webhook_event.rbs
Overview
Immutable value object for a verified webhook delivery, produced by Nfe::Webhook.construct_event after the HMAC-SHA1 signature checks out.
typeis the event type (e.g."invoice.issued"), unwrapped from the delivery envelope'sactionoreventkey.datais the payloadHash(the envelope'spayloadordatakey).idis a stable event/invoice id for deduplication, ornilwhen the envelope carries none. NFE.io sends no timestamp/nonce, so a valid signature proves authenticity but NOT freshness — handlers MUST be idempotent and dedupe on this id.created_atis the delivery timestamp string, ornil.
Instance Attribute Summary collapse
-
#created_at ⇒ String?
readonly
Returns the value of attribute created_at.
-
#data ⇒ Hash[untyped, untyped]
readonly
Returns the value of attribute data.
-
#id ⇒ String?
readonly
Returns the value of attribute id.
-
#type ⇒ String?
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, data:, id: nil, created_at: nil) ⇒ WebhookEvent
constructor
Allow
idandcreated_atto default tonilso callers (andconstruct_event) can omit them.
Constructor Details
#initialize(type:, data:, id: nil, created_at: nil) ⇒ WebhookEvent
Allow id and created_at to default to nil so callers (and
construct_event) can omit them.
18 19 20 |
# File 'lib/nfe/webhook_event.rb', line 18 def initialize(type:, data:, id: nil, created_at: nil) super end |
Instance Attribute Details
#created_at ⇒ String? (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'sig/nfe/webhook_event.rbs', line 6 def created_at @created_at end |
#data ⇒ Hash[untyped, untyped] (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'sig/nfe/webhook_event.rbs', line 4 def data @data end |
#id ⇒ String? (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'sig/nfe/webhook_event.rbs', line 5 def id @id end |
#type ⇒ String? (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'sig/nfe/webhook_event.rbs', line 3 def type @type end |
Class Method Details
.new(type:, data:, id:, created_at:) ⇒ instance .new(type, data, id, created_at) ⇒ instance
8 9 |
# File 'sig/nfe/webhook_event.rbs', line 8
def self.new: (type: String?, data: Hash[untyped, untyped], ?id: String?, ?created_at: String?) -> instance
| (String? type, Hash[untyped, untyped] data, ?String? id, ?String? created_at) -> instance
|