Class: Whatsapp::Webhook::Entry
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::Entry
- Defined in:
- lib/ruby/whatsapp/webhook/entry.rb
Overview
A single entry[] item — one WhatsApp Business Account, with one or more
changes[] (each a distinct notification).
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, changes:) ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(id:, changes:) ⇒ Entry
Returns a new instance of Entry.
16 17 18 19 |
# File 'lib/ruby/whatsapp/webhook/entry.rb', line 16 def initialize(id:, changes:) @id = id @changes = changes end |
Instance Attribute Details
#changes ⇒ Array<Change>
14 15 16 |
# File 'lib/ruby/whatsapp/webhook/entry.rb', line 14 def changes @changes end |
#id ⇒ String
10 11 12 |
# File 'lib/ruby/whatsapp/webhook/entry.rb', line 10 def id @id end |
Class Method Details
.deserialize(data) ⇒ Entry
24 25 26 27 28 29 30 31 |
# File 'lib/ruby/whatsapp/webhook/entry.rb', line 24 def deserialize(data) data ||= {} new( id: data["id"], changes: Array(data["changes"]).map { |change_data| Change.deserialize(change_data) } ) end |