Class: Whatsapp::Webhook::Message::Unknown
- Defined in:
- lib/ruby/whatsapp/webhook/message/unknown.rb
Overview
Fallback for a message type not in MESSAGE_TYPES — either a
type Meta added after this gem was released, or a message the Cloud API
itself couldn't process (carries an errors[] array in that case).
Instance Attribute Summary collapse
- #errors ⇒ Array<Error>
-
#raw ⇒ Hash
The full, untyped raw message hash.
Attributes inherited from Base
#context, #from, #id, #referral, #timestamp, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw:, errors:, **base_attributes) ⇒ Unknown
constructor
A new instance of Unknown.
Methods inherited from Base
Constructor Details
#initialize(raw:, errors:, **base_attributes) ⇒ Unknown
Returns a new instance of Unknown.
18 19 20 21 22 23 |
# File 'lib/ruby/whatsapp/webhook/message/unknown.rb', line 18 def initialize(raw:, errors:, **base_attributes) super(**base_attributes) @raw = raw @errors = errors end |
Instance Attribute Details
#errors ⇒ Array<Error>
16 17 18 |
# File 'lib/ruby/whatsapp/webhook/message/unknown.rb', line 16 def errors @errors end |
#raw ⇒ Hash
Returns The full, untyped raw message hash.
12 13 14 |
# File 'lib/ruby/whatsapp/webhook/message/unknown.rb', line 12 def raw @raw end |
Class Method Details
.deserialize(data) ⇒ Unknown
28 29 30 31 32 33 34 |
# File 'lib/ruby/whatsapp/webhook/message/unknown.rb', line 28 def deserialize(data) new( raw: data, errors: Array(data["errors"]).map { |error_data| Error.deserialize(error_data) }, **common_attributes(data) ) end |