Class: Integral::Webhook::Event
- Inherits:
-
Object
- Object
- Integral::Webhook::Event
- Defined in:
- app/models/integral/webhook/event.rb
Overview
An event instance which a Webhook::Endpoint might be listening too, for example a post publication, creation or deletion
Instance Attribute Summary collapse
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
-
#as_json(*_args) ⇒ Object
Adds the event_name to the JSON representation.
-
#initialize(event_name, payload = {}) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(event_name, payload = {}) ⇒ Event
Returns a new instance of Event.
8 9 10 11 |
# File 'app/models/integral/webhook/event.rb', line 8 def initialize(event_name, payload = {}) @event_name = event_name @payload = payload end |
Instance Attribute Details
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
6 7 8 |
# File 'app/models/integral/webhook/event.rb', line 6 def event_name @event_name end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
6 7 8 |
# File 'app/models/integral/webhook/event.rb', line 6 def payload @payload end |
Instance Method Details
#as_json(*_args) ⇒ Object
Adds the event_name to the JSON representation
14 15 16 17 |
# File 'app/models/integral/webhook/event.rb', line 14 def as_json(*_args) payload[:event_name] = event_name payload end |