Class: Whatsapp::Webhook::Message::System
- Defined in:
- lib/ruby/whatsapp/webhook/message/system.rb
Overview
A system notice, e.g. that the customer changed their phone number.
Instance Attribute Summary collapse
-
#body ⇒ String?
Human-readable description of the change.
-
#change_type ⇒ String?
E.g.
- #identity ⇒ String?
-
#wa_id ⇒ String?
The customer's (possibly new) WhatsApp ID.
Attributes inherited from Base
#context, #from, #id, #referral, #timestamp, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(body:, identity:, wa_id:, change_type:, **base_attributes) ⇒ System
constructor
A new instance of System.
Methods inherited from Base
Constructor Details
#initialize(body:, identity:, wa_id:, change_type:, **base_attributes) ⇒ System
Returns a new instance of System.
24 25 26 27 28 29 30 31 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 24 def initialize(body:, identity:, wa_id:, change_type:, **base_attributes) super(**base_attributes) @body = body @identity = identity @wa_id = wa_id @change_type = change_type end |
Instance Attribute Details
#body ⇒ String?
Returns Human-readable description of the change.
10 11 12 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 10 def body @body end |
#change_type ⇒ String?
Returns e.g. "customer_changed_number", "customer_identity_changed".
22 23 24 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 22 def change_type @change_type end |
#identity ⇒ String?
14 15 16 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 14 def identity @identity end |
#wa_id ⇒ String?
Returns The customer's (possibly new) WhatsApp ID.
18 19 20 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 18 def wa_id @wa_id end |
Class Method Details
.deserialize(data) ⇒ System
36 37 38 39 40 41 42 43 44 |
# File 'lib/ruby/whatsapp/webhook/message/system.rb', line 36 def deserialize(data) new( body: data.dig("system", "body"), identity: data.dig("system", "identity"), wa_id: data.dig("system", "wa_id"), change_type: data.dig("system", "type"), **common_attributes(data) ) end |