Class: Whatsapp::Webhook::Contact
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::Contact
- Defined in:
- lib/ruby/whatsapp/webhook/contact.rb
Overview
A value-level contacts[] entry — identifies the WhatsApp user tied to a
notification (distinct from Message::Contacts, the inbound "share a contact
card" message type, which has its own richer shape).
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(profile_name:, wa_id:) ⇒ Contact
constructor
A new instance of Contact.
Constructor Details
#initialize(profile_name:, wa_id:) ⇒ Contact
Returns a new instance of Contact.
17 18 19 20 |
# File 'lib/ruby/whatsapp/webhook/contact.rb', line 17 def initialize(profile_name:, wa_id:) @profile_name = profile_name @wa_id = wa_id end |
Instance Attribute Details
#profile_name ⇒ String?
11 12 13 |
# File 'lib/ruby/whatsapp/webhook/contact.rb', line 11 def profile_name @profile_name end |
#wa_id ⇒ String?
15 16 17 |
# File 'lib/ruby/whatsapp/webhook/contact.rb', line 15 def wa_id @wa_id end |
Class Method Details
.deserialize(data) ⇒ Contact
25 26 27 28 29 30 31 32 |
# File 'lib/ruby/whatsapp/webhook/contact.rb', line 25 def deserialize(data) data ||= {} new( profile_name: data.dig("profile", "name"), wa_id: data["wa_id"] ) end |