Class: Whatsapp::Webhook::Message::Contacts::Name
- Inherits:
-
Object
- Object
- Whatsapp::Webhook::Message::Contacts::Name
- Defined in:
- lib/ruby/whatsapp/webhook/message/contacts/name.rb
Overview
The name component of an inbound contact card.
Instance Attribute Summary collapse
- #first_name ⇒ String?
- #formatted_name ⇒ String?
- #last_name ⇒ String?
- #middle_name ⇒ String?
- #prefix ⇒ String?
- #suffix ⇒ String?
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(formatted_name:, first_name: nil, last_name: nil, middle_name: nil, prefix: nil, suffix: nil) ⇒ Name
constructor
A new instance of Name.
Constructor Details
#initialize(formatted_name:, first_name: nil, last_name: nil, middle_name: nil, prefix: nil, suffix: nil) ⇒ Name
Returns a new instance of Name.
33 34 35 36 37 38 39 40 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 33 def initialize(formatted_name:, first_name: nil, last_name: nil, middle_name: nil, prefix: nil, suffix: nil) @formatted_name = formatted_name @first_name = first_name @last_name = last_name @middle_name = middle_name @prefix = prefix @suffix = suffix end |
Instance Attribute Details
#first_name ⇒ String?
15 16 17 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 15 def first_name @first_name end |
#formatted_name ⇒ String?
11 12 13 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 11 def formatted_name @formatted_name end |
#last_name ⇒ String?
19 20 21 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 19 def last_name @last_name end |
#middle_name ⇒ String?
23 24 25 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 23 def middle_name @middle_name end |
#prefix ⇒ String?
27 28 29 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 27 def prefix @prefix end |
#suffix ⇒ String?
31 32 33 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 31 def suffix @suffix end |
Class Method Details
.deserialize(data) ⇒ Name
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ruby/whatsapp/webhook/message/contacts/name.rb', line 45 def deserialize(data) data ||= {} new( formatted_name: data["formatted_name"], first_name: data["first_name"], last_name: data["last_name"], middle_name: data["middle_name"], prefix: data["prefix"], suffix: data["suffix"] ) end |