Class: Whatsapp::Webhook::Notification
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::Notification
- Defined in:
- lib/ruby/whatsapp/webhook/notification.rb
Overview
Top-level deserialization entry point for an incoming webhook POST body.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object:, entry:) ⇒ Notification
constructor
A new instance of Notification.
Constructor Details
#initialize(object:, entry:) ⇒ Notification
Returns a new instance of Notification.
17 18 19 20 |
# File 'lib/ruby/whatsapp/webhook/notification.rb', line 17 def initialize(object:, entry:) @object = object @entry = entry end |
Instance Attribute Details
#entry ⇒ Array<Entry>
15 16 17 |
# File 'lib/ruby/whatsapp/webhook/notification.rb', line 15 def entry @entry end |
#object ⇒ String
11 12 13 |
# File 'lib/ruby/whatsapp/webhook/notification.rb', line 11 def object @object end |
Class Method Details
.deserialize(data) ⇒ Notification
25 26 27 28 29 30 31 32 |
# File 'lib/ruby/whatsapp/webhook/notification.rb', line 25 def deserialize(data) data ||= {} new( object: data["object"], entry: Array(data["entry"]).map { |entry_data| Entry.deserialize(entry_data) } ) end |