Class: Whatsapp::Webhook::UnknownField
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::UnknownField
- Defined in:
- lib/ruby/whatsapp/webhook/unknown_field.rb
Overview
Fallback value wrapper for any webhook field not in Change::FIELDS — either
a field Meta added after this gem was released, or one deliberately left generic.
Keeps the raw hash accessible instead of raising on an unrecognized notification.
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object?
-
#initialize(raw:) ⇒ UnknownField
constructor
A new instance of UnknownField.
- #to_h ⇒ Hash
Constructor Details
#initialize(raw:) ⇒ UnknownField
Returns a new instance of UnknownField.
13 14 15 |
# File 'lib/ruby/whatsapp/webhook/unknown_field.rb', line 13 def initialize(raw:) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
11 12 13 |
# File 'lib/ruby/whatsapp/webhook/unknown_field.rb', line 11 def raw @raw end |
Class Method Details
.deserialize(data) ⇒ UnknownField
31 32 33 |
# File 'lib/ruby/whatsapp/webhook/unknown_field.rb', line 31 def deserialize(data) new(raw: data || {}) end |
Instance Method Details
#[](key) ⇒ Object?
19 20 21 |
# File 'lib/ruby/whatsapp/webhook/unknown_field.rb', line 19 def [](key) raw[key] end |
#to_h ⇒ Hash
24 25 26 |
# File 'lib/ruby/whatsapp/webhook/unknown_field.rb', line 24 def to_h raw end |