Class: SimpleConnect::Responses::DeliverResponse
- Inherits:
-
Object
- Object
- SimpleConnect::Responses::DeliverResponse
- Defined in:
- lib/simple_connect/responses/deliver_response.rb
Overview
Wraps the ‘events.deliver` acknowledgement.
Server returns:
202 on a new event → { status, log_id, event_id }
200 on an idempotent replay → { status, log_id, event_id, duplicate: true }
Either code is a success; consumers check ‘#duplicate?` to distinguish. If the request was signed with a recently-rotated previous secret, the server adds `“used_previous_secret”: true` at the top level — a hint to rotate credentials before the grace window ends.
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#log_id ⇒ Object
readonly
Returns the value of attribute log_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #duplicate? ⇒ Boolean
-
#initialize(json) ⇒ DeliverResponse
constructor
A new instance of DeliverResponse.
- #to_h ⇒ Object
- #used_previous_secret? ⇒ Boolean
Constructor Details
#initialize(json) ⇒ DeliverResponse
Returns a new instance of DeliverResponse.
17 18 19 20 21 22 23 24 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 17 def initialize(json) @json = json.is_a?(Hash) ? json : {} @status = @json["status"] @log_id = @json["log_id"] @event_id = @json["event_id"] @duplicate = @json["duplicate"] == true @used_previous_secret = @json["used_previous_secret"] == true end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
15 16 17 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 15 def event_id @event_id end |
#log_id ⇒ Object (readonly)
Returns the value of attribute log_id.
15 16 17 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 15 def log_id @log_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
15 16 17 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 15 def status @status end |
Instance Method Details
#duplicate? ⇒ Boolean
26 27 28 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 26 def duplicate? @duplicate end |
#to_h ⇒ Object
34 35 36 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 34 def to_h @json.dup end |
#used_previous_secret? ⇒ Boolean
30 31 32 |
# File 'lib/simple_connect/responses/deliver_response.rb', line 30 def used_previous_secret? @used_previous_secret end |